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 9 made on Tuesday November 30, 2010 at 06:46
Barry Gordon
Founding Member
Joined:
Posts:
August 2001
2,157
I would set up a socket.onData event handler, and issue the second and subsequent write commands from there. In that way you get the response from the unit first and then reissue. Just keep a state variable that starts at 0 and is incremented each time a write is issued. The first write is from the on connect and set the state to 1. At on data issue a command based on the value of the state variable and increment the state variable.

Or as a general case:

Have an array lets call it macroArray. Enter the strings for the write commands (data only, not the socket. Put them into array as strings using push, e.g. macroArray.push("GET /web/remotecontrol?command=6 HTTP/1.1\r\n\r\n"). Pull the command strings out using pop. That should make the array a LIFO Structure, so the first command to be executed should be the last command pushed in. Execute the command using socket.write(macroArray.pop). Execute the first command in the onConnect and all others in onData event handlers. When the array has a length of zero on entry to the onData handler do not issue the write but rather close the socket.

In this way you push your macro into the array and issue the connect. It then handles itself and this works for any macro of any length.


Hosting Services by ipHouse