Teltonika Driver Id

Karl.a year ago

Hi,

I have recently added a Teltonika FMC650 to my device list, its connected to the vehicle tachograph.

I am getting io195 and io196 but they aren't being converted to the correct format. Can I use a computed attribute to convert from decimal to hex and then to ascii?

https://wiki.teltonika-gps.com/view/DriverID

Thanks

Anton Tananaeva year ago

There must be a way.

Karl.a year ago

Is there no way to automatically decode it when it comes in from the device?

Anton Tananaeva year ago

I already said yes. I'm pretty sure it's possible with computed attributes.

Karl.a year ago

Can you provide any help on how to convert a decimal to a hexidecimal string through computed attributes?

I have tried

io195 ? Integer.toHexString(io195) : ""
Karl.a year ago

I have managed to convert it to hexadecimal using the following code

var hex1 = new ("java.lang.Long", io195).toHexString(io195)
hex1

I just ned to convert it to a string now. Do you know how to do that using JEXL?

Thanks

Anton Tananaeva year ago

It's already a string from your expression.

Karl.a year ago

4921925560175704000 converted from decimal to hex is 444E3138313037C0
444E3138313037C0 converted from hex to a ascii = DN18107À

Maybe I should have said Ascii instead of converting it to a string?

Anton Tananaeva year ago

This makes no sense. Why did you convert it into hex then if you actually need ASCII.

Karl.a year ago

https://wiki.teltonika-gps.com/view/DriverID

Read the link above.

Driver 1 ID is divided trough two IO elements and to read actual Driver 1 ID written on driver card, two conversions need to be proceeded.

Anton Tananaeva year ago

If they have it on a wiki page, it doesn't mean it makes sense. It still doesn't.

Karl.a year ago

Can you tell me a better way to get DN18107À from 4921925560175704000?

Anton Tananaeva year ago

Probably you have to convert the value into bytes first and then create a string from bytes.

Karl.a year ago

Ok, can you help me do that using a computed attribute?

Anton Tananaeva year ago

It would require some research, so probably not on the forum.