Here's some code:
(javascript snippet from the 'key pad' webpage)
function dccClick(content, timeId)
{
var timeFactor=0;
if (timeId != '0')
{
timeFactor = document.getElementById(timeId).value;
timeFactor = timeFactor * 60; // convert minutes to seconds
}
var gwurl="192.168.2.70:2000"
var parm="pkt=0B24080C072440"+content+numToHex(timeFactor%256)+numToHex(Math.floor(timeFactor/256));
sendToGW(gwurl,parm); // using ajax HTTP POST request
}
The data being sent to the Controller (via the Gateway @ 192.168.2.70:2000 ) is encapsulated in the packet, contained in 'parm'.
Packet looks like:
'0B24080C07244002010A00'
Annotated, it looks like this:
'0B24' = packetlen=11, packet type is 'TM_COMMAND',
'080C' = Cmd = 'TM_SEND_TO', DeviceID=12
so the following packet gets sent to 12 (DC_Controller) by the Gateway:
'0724' = packetlen=7, packet type is 'TM_COMMAND'
'4002010A00' = Cmd=DC_Controller_Command, zone=2, state=1 (ON), runTime=10 minutes...
'TM_SEND_TO' is a wonderful thing...
By the way, the hardcoded url is a temporary thing, eventually the code will look up the url from the server's MySQL database...
Tom