0

Help sending IR command via javascript to iTach

Hi all,

I'm trying to send an IR command to my iTach device from a cordova APP (javascript language).

I do this with the help of the plugin "sockets-for-cordova".

I create a connection, send my command (i'm trying to turn on my TV), and receive a response.. but it's an error code, and nothing happens.

I tested my command with iLearn program, and all is ok.
But when i send it trought the app i receive the error: 008 (invalid pulse count).

This is the code snippet i use for sending the command:

--------

var dataString = "sendir,1:3,1,37878,1,1,341,170,22,20,22,20,22,63,22,20,22,20,22,20,22,20,22,20,22,63,22,63,22,20,22,63,22,63,22,63,22,63,22,63,22,20,22,20,22,20,22,63,22,20,22,20,22,20,22,20,22,63,22,63,22,63,22,20,22,63,21,64,21,64,21,64,21,37000x0D";
// i put 0x0D a the end of the string otherwise i receive the error 016 (carriage return missing).

var data = new Uint8Array(dataString.length);
for (var i = 0; i < data.length; i++) {
  data[i] = dataString.charCodeAt(i);
}
socket.write(data);

--------

I don't know what i'm doing wrong :(

Connection is ok, i use the IP of my iTach and port 4998... connection is established and i receive iTach response.
I assume it is wrong the dataString i'm sending (or maybe the conversion in Uint8..?)

Any help would be very appreciated.

Thanks in advance.

Alessandro

2 comments

Please sign in to leave a comment.