PK
‹o(
I I scripts/main.jsfunction debug(text)
{
IR.Log(text);
}
function Worker()
{
//debug('worker');
if(this.d1)
{
var r = this.d1.Send(['Hello']);
debug('Send ' + r);
}
}
function AddDevice(name)
{
var d1 = IR.CreateDevice(IR.DEVICE_CUSTOM_SERIAL, name,
{'PortName': name,
'BaudRate': 9600,
'DataBits': 8,
'Parity':0,
'StopBits':0,
'Use485': true
});
d1.Connect();
IR.AddListener(IR.EVENT_ONLINE, d1, function(){
debug('online');
});
IR.AddListener(IR.EVENT_OFFLINE, d1, function(){
debug('offline');
});
IR.AddListener(IR.EVENT_RECEIVE_DATA, d1, function(data, id){
debug('recieve: id=' + id + 'size=' + data.length);
for(var i = 0; i < data.length; i++)
{
data[i] = data[i].toString(16);
}
debug(data);
});
return d1;
}
IR.AddListener(IR.EVENT_START,0,function()
{
debug('Start');
var d1 = AddDevice('/dev/ttyUSB0');
var context = {};
context.d1 = d1;
IR.SetInterval(1000, Worker, context);
});
PK
¼ª¾ ¾ Project.irp
PK
•‰0ª ª
Config.xml
PK
‹o(
I I scripts/main.jsPK
¼ª¾ ¾ v Project.irpPK
•‰0ª ª
] Config.xmlPK ® /