
Kartik Patel - 2012-12-28 10:00:25
Hello Sir,
$packet .= "\x04";
$packet .= "\x00\x00\x00";
$packet .= "\x00\x00\x00\x00";
$packet .= "\x00\x00\x00\x00";
$packet .= "\x19\x02\x01\x02\x01\x01\x00\x03"; // Serial Number
This is my sample code. At last of the code it represents the serial number of my device, to which i have to send my packet.
My problem is that, If there are number of devices and device have their unique serial number. So i want to send packet with that number. and for that i m just fetch the serial number from database and just convert that code into hexcode
Decimal Serial Number : 25 2 1 2 1 1 0 3
Hec Serial Number : 19 02 01 02 01 01 00 03
This hex serial number is stored into $SR_NO;
and when i m going to call this variable instead of manually enter, it is not work.
$packet .= "\x04";
$packet .= "\x00\x00\x00";
$packet .= "\x00\x00\x00\x00";
$packet .= "\x00\x00\x00\x00";
$packet .= "$SR_NO";
but if I fill it manually
$packet .= "\x04";
$packet .= "\x00\x00\x00";
$packet .= "\x00\x00\x00\x00";
$packet .= "\x00\x00\x00\x00";
$packet .= "\x19\x02\x01\x02\x01\x01\x00\x03"; // Serial Number
it will work.
According to my application it is necessary to pur serial number dynamically
So can you please suggest me that how can i resolve my problem ?
Thanks
(Kartik Patel)