Teltonika Driver Id

Karl.6 months 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 Tananaev6 months ago

There must be a way.

Karl.6 months ago

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

Anton Tananaev6 months ago

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

Karl.6 months 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.6 months 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 Tananaev6 months ago

It's already a string from your expression.

Karl.6 months 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 Tananaev6 months ago

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

Karl.6 months 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 Tananaev6 months ago

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

Karl.6 months ago

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

Anton Tananaev6 months ago

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

Karl.6 months ago

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

Anton Tananaev6 months ago

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