Event Button Click 389 teltonik

userjr2 years ago

Best regards

I have a query with a particular teltonik event.
I need to understand the Hex to be able to translate user actions depending on the value, however according to the teltonik wiki documentation I depend on the original data and not on the transformation.

case 389:
                Log365.info("LOG =");
                Log365.info(""+(int) readValue(buf, 1, true));
                position.set(Position.KEY_ALARM, position.BUTTON_CLICK);
                break;
case 390:
                switch ((int) readValue(buf, length, false)) {
                    case 0:
                        position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON);
                        break;
                    Case 1:
                        position.set(Position.KEY_ALARM, Position.ALARM_POWER_OFF);
                        break;
                }
                break;

My case is 398, and I try to use the same expression as 390 but the integer doesn't work for me since the wiki depends on the hex directly...

And the info for doc event teltoniks is that:

range: 0x11 - 0x53

Button ID (X) and Action (Y) Value 0xXY
X - button ID:
1 - alarm button
2 - power button
3 - button 1
4 - button 2
5 - button 3
Y - action:
1 - 1 click
2 - 2 clicks
3 - long click

https://wiki.teltonika-mobility.com/view/GH5200_AVL_ID_List

If you could give me some advice, it would be well received. Thank you very much

Anton Tananaev2 years ago

Hex is just a representation of an integer.