Hi there,
I have got payload as follow.
000254fdbd805308a088e5
I need to slice it and take particular part from it and then need to convert it into signed decimal number. How can I do that ?
I have tried as follow, but it is failing at parseFloat function, it doesn't give me any data even I tried parseInt function as well, but it also doesn't work.
data = ((msg.payload).slice((msg.payload.length)-8,(msg.payload.length)-4)) ; // this return "fdbd8053" from payload mentioned above
var val = parseFloat(longitude,32);
return val;
Another issue is that instead of using slice command to extract the data I decided to use hardcore value just to check parseFloat command. I did it as follow.
data = 0xfdbd8053 ;
var val = parseFloat(longitude,32);
return val;
This is returning a decimal value of
4257054879, which unsigned. I need it signed conversion. The value should come as -37912417.
How can I solve this two problems.
Your help will be great !!
Thanks
Akshay