@VehbiEmiroglu
I presume both Put helpers expect a response?
Not major but would be handy if there was a way to sep/bypass the timeout on something like this for CCTV integration I am working on.
Currently have to settle for a workaround using print job to print template with only program settings updated in automation to send info to cctv for overlay.
I could get it working with existing web helpers but think they have a timeout of 30-60 seconds and unfortunately the CCTV system doesnt return a response from posts causing hangup in samba while script waits for response.
My alternate idea was to post from samba to lightweight webserver Winehouse which would return a response and it communicate with cctv but opted for printer method for now.
Again only a question, or if you had any other ideas to work around this?
Would just really simplify what is currently overly complex to just a quick script call.
Hmm yes Put requests wait a response now. But may be we will add a new Put type for this.
If you can and isnât an issue, donât expect you to go out your way but if you did get opportunity
So how do you communicate with the CCTV? Does it have a web interface and you are sending API calls to it?
It listens on TCP port.
There isnât huge amount of documentation of protocols used but setting as epson works with IP printer in windows just using generic driver.
If I change to tcp listen with port i can post data to that port and it show. Have to set a start and send string to make it ignore the post headers etc but it works just leaves samba hanging since it doesnt send a response in reply.
I think you may be over complicating it. Most CCTV overlays I have looked at before take data as if a printer, this is to provide compatibility with most POS software. This is why you wonât get a response and itâs the wrong method to use a PUT or POST like a web API because like you say it has HTTP headers and it will expect a response - this is standard behaviour and therefore you should not send data to it using this method.
Just set a print job to send what you want to display, what are you trying to do where that would not work?
I want just hoping to simplify as currently I am having to save to program setting something lik '[menuitemname] added to ticket [ticketnumber], then execute print job with that program setting as only thing in template.
I imagine the basic option would be the till would send whole ticket to cctv on payment like a printer but was hoping to have a full action log, ie, cancelled, void, login, payment and change etc.
That then also makes it interesting since each âprint overrides the previous overlayâ so have since been trying to have 1-8 program settings and after printing it moves 1 to 2, 2 to 3, 3 to 4 etc so the next one goes into 1 and template shows all settings giving the effect of a virtical tickertape style log.
Text isnât very clear on remote viewer but bit like that but only done add, cancel and login for now.
Yeah this is what I have seen with other POS software
I think this is a good idea
Maybe check if there is a command reference somewhere for the CCTV and if you can possibly override that setting, then it may be able to keep âhistoryâ on screen like you are trying to implement yourself thus saving you the trouble.
There would be cleaner ways of doing that - you could save JSON data to a program setting, or you could store each item as a delimited list in the program setting which you can then easily convert to and from a JavaScript Array and more easily manipulate it.
The current setup could indeed be refined. Mostly by using scripting to process etc hence the query about direct port without reply since if it were possible it would shrink it down to a single script which could be called at many places with single line or single action.
This is not a good idea, because you are asking them to implement something against HTTP standards. Anything sent over HTTP will always give a response, even if âno responseâ is given, a response of 200 OK
is given. No response assumes the message did not get through.
You can still do that using a print job, you just have to pass it via a program setting. But you could still do that using a single action (e.g. action to trigger an automation command to handle all the steps from program setting to execute print job) or a single {CALL:X}
(you can update program settings and trigger a print job via GraphQL which can be used internally in a script).
Program Settings
function readSetting(settingName,settingType) {
switch (settingType)
{
case 'global':
var response = gql.Exec('{getGlobalSetting(name:"'+settingName+'"){name,value}}');
var result = JSON.parse(response);
var settingValue = result.data.getGlobalSetting.value;
break;
case 'local':
default:
var response = gql.Exec('{getLocalSetting(name:"'+settingName+'"){name,value}}');
var result = JSON.parse(response);
var settingValue = result.data.getLocalSetting.value;
break;
}
return settingValue;
}
function updateSetting(settingName,settingValue,settingType) {
switch (settingType)
{
case 'global':
var response = gql.Exec('mutation m{updateGlobalSetting(name:"'+settingName+'",value:"'+settingValue+'"){name,value}}');
var result = JSON.parse(response);
var settingValue = result.data.updateGlobalSetting.value;
break;
case 'local':
default:
var response = gql.Exec('mutation m{updateLocalSetting(name:"'+settingName+'",value:"'+settingValue+'"){name,value}}');
var result = JSON.parse(response);
var settingValue = result.data.updateLocalSetting.value;
break;
}
return settingValue;
}
function deleteSetting(settingName) {
var response = gql.Exec("mutation m{deleteSetting(name:"+settingName+"){name,value}}");
var result = JSON.parse(response);
var settingValue = result.data.deleteSetting.value;
return settingValue;
}