Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 1 made on Tuesday December 12, 2017 at 15:18
peteS
Long Time Member
Joined:
Posts:
June 2003
20
Hi All

I'm trying to write a PS to control my Sky satellite box from my 9400 directly via TCP. I can connect fine, and using the information at [Link: github.com], I can read and write the data, but nothing happens. The relevant section in the nodejs .js is

function sendCommand(code, cb) {
var commandBytes = [4,1,0,0,0,0, Math.floor(224 + (code/16)), code % 16];

var client = net.connect({
host: host,
port: port || 49160
});

var l = 12;
client.on('data', function(data) {
clearTimeout(connectTimeoutTimer)
// Clear timeout
if (data.length < 24) {
client.write(data.slice(0, l))
l = 1;
} else {
client.write(new Buffer(commandBytes), function() {
commandBytes[1]=0;
client.write(new Buffer(commandBytes), function() {
client.destroy();
cb(null)
});
});
}
});

.. which I've replaced with

function onData(){
System.print("Ondata.");
receivedText = socket.read();
System.print(receivedText.length)
var len =12;
if (receivedText.length < 24){
socket.write(receivedText.slice(0,len));
len = 1;
} else {
System.print("Writing Data")

socket.write [0x04,0x01,0x00,0x00,0x00,0x00,0xE0,0x00];
socket.write [0x04,0x00,0x00,0x00,0x00,0x00,0xE0,0x00];

socket.close;
socket=null;
}

}

I've just hardcoded code=0 in effect, so 0xE0 is Math.floor(224 + (code/16)) and 0x00 is code % 16. But, nothing happens. I'm guessing that you can't just write the hex values to the socket, but Buffer doesn't seem to exist in ProntoScript.

Any ideas how I could change this? Also, any ideas how to debug?

Thanks

pete S


Hosting Services by ipHouse