Send command in HEX

Data are received from Telegram token in HEX format. The problem is that the function  that.device.Send sends data in ASCII, not in HEX and then a wrong message is sent.

IR.AddListener(IR.EVENT_CHANNEL_SET,that.device,function(name)    
{
       that.Msg = IR.GetVariable("Drivers."+that.DriverName+".Telegram"); 
       //Msg string will be "7F F2 FA 00 01 00 BD 67 FA FF FE 06 87 0D"
       IR.Log("Driver: Msg = "+ that.Msg);
       that.device.Send([that.Msg]);   
 }); 
You can use something like
var value = parseInt("FF", 16);
to convert a hex string to a hex number
for(var cnt=0;cnt               
{
	partMSG=telegram.substring(cnt,cnt+2);
	partTel = parseInt(partMSG, 16);
	that.device.Send([partTel]);
}                 

This article was helpful for 1 person. Is this article helpful for you?