0
Answered

Receiving/Feedback of RS232 using Global Cache

Qorin 8 years ago in Products / Other drivers updated by Jackie Roos 8 years ago 8

Hi,


I would like to receive data by using the GlobalCache Wifi to Serial.


I used H-Term to periodically send data to globalcache along with USB to RS232 as my test setup (I am able to receive data from Iridium in H-Term)


Below is the code that I have implemented in java script.


var timer = 0;
var onTime = 50; // in ms
var pageNumber = 1;
var funcOp = 0xFF;

this.DriverName = "Global Cache";
this.device;
this.Online = false;
this.device = IR.GetDevice(this.DriverName);

var init = 0;
IR.AddListener(IR.EVENT_START,0,function(){
IR.Log("Hellooo!!!");
});
IR.AddListener(IR.EVENT_EXIT,0,function(){
});
IR.AddListener(IR.EVENT_RECEIVE_TEXT, this.device, function(text,id){
IR.Log("receive 1 = "+ text);
IR.GetPage("Gowing").GetItem("txtT").Text = "AAAAA";
});
IR.AddListener(IR.EVENT_WORK, 0, function(time){
var that = this;
var packXPC;
timer += time;
if(init == 0){
IR.AddListener(IR.EVENT_DEVICE_FOUND, that.device, function(name){
IR.Log("Name :"+name);
}, that);
IR.AddListener(IR.EVENT_ONLINE, that.device, function(text){
IR.Log(that.DriverName+" DEVICE is Online");
that.Online = true;
init = 1;
}, that);
IR.AddListener(IR.EVENT_OFFLINE, that.device, function(text){
IR.Log(that.DriverName+" DEVICE is Offline");
that.Online = false;
}, that);
}
if(timer > onTime){
timer = 0;
switch(pageNumber){
case 1:
packXPC = [pageNumber, funcOp];
break;
default:
packXPC = [0xFF, 0xFF];
}
sendPackage(packXPC);
/*IR.AddListener(IR.EVENT_RECEIVE_TEXT, that.device, function(text, id){
IR.Log("receive = "+ text); // Output the received data in the log
}, that);
/*IR.AddListener(IR.EVENT_RECEIVE_DATA, that.device, function(text, id){
IR.Log("receive 1 = "+ text);
})*/

}
});


So far, I did not receive anything in the log nor in the text box in the GUI when I test it.

Has anyone ever encountered this problem or has solved it?
Any feedback would be appreciated.


Thank you!

Q





Answer

+1
Answer

Hi :)


4998 is the IR port. 4999 and above are the serial ports.


In the GUI editor did you set up a new AV & Custom Systems Driver TCP/IP driver?


We use this routinely to send and receive commands to serial devices via a Global Cache IP2SL. For serial devices via GC, I don't use the the GC driver at all, as it is not necessary and the AV & Custom Systems driver gives more flexibility.


Have you setup the GC IP2SL to have multiple connections in iHelp?



Hi

You cannot use the GC driver for feedback :)


Create a new TCP/IP driver in the GUI editor with the same IP address as the IP2SL and port 4999. In this example I will call it IP2SL


in the JS do something like:


function myIPtoSL(DeviceName){
var that = this;
that.DeviceName = DeviceName; // device name in the project
that.Device= IR.GetDevice(that.DeviceName); // identifier of the device instance in the system


IR.AddListener(IR.EVENT_RECEIVE_TEXT, that.Device, function(text, id){
IR.Log("receive = "+ text); // Output the received data in the log
}, that);
}; //function myIP2SL //create an instance of myIPtoSL
var IP2SL = new myIPtoSL("IP2SL");

Hi!


Does your function work with your Global Cache device? Because i tried it and i still didn't receive any data from the device.


is there certain condition for your JS to work?

when I tried yours, I also have the GC driver working to send data.


I have one question tho... In the API of globalcache the dedicated port is like what you said 4999. However in Iridium the GC driver port is 4998.


and when I changed the port to 4999, I can't even send data.

does this also happening to you?

+1
Answer

Hi :)


4998 is the IR port. 4999 and above are the serial ports.


In the GUI editor did you set up a new AV & Custom Systems Driver TCP/IP driver?


We use this routinely to send and receive commands to serial devices via a Global Cache IP2SL. For serial devices via GC, I don't use the the GC driver at all, as it is not necessary and the AV & Custom Systems driver gives more flexibility.


Have you setup the GC IP2SL to have multiple connections in iHelp?



Hi Jackie,


do you have any problem with receiving when the router is not connected to the internet??

Qorin

No issues at all. If the router is not connected to the internet it is acting as a switch - make sure the GC has the router IP address as it's gateway, check that the GC IP address it static, and perhaps set up address reservation in the router for the GC.

cheers

Hi


no actually, I thought that are meant for multiple ports.

I will give it a try and let you know how it goes.


but regarding the port, it is strange then. since it works with 4998.


and thanks a lot for all your replies!

It works, I get rid of the GC driver and just use the custom TCP !

thanks a lot!!!