0

I'm trying to interpret a bunch of bytes I'm receiving from a GPS tracker. There are 3 sequential bytes that I believe mean hours, minutes and seconds. I recorded timestamps along with the messages I receive and noticed this:

when hour 0: byte 1 in message is 0x30
when hour 1: byte 1 in message is 0x31
...

when minute 0: byte 2 in message is 0x30
when minute 1: byte 2 in message is 0x31
...

But some bytes are skipped as follows:

for hours:

Hou 10   16          2
----------------------
00: 48 - 30 - 00110000
01: 49 - 31 - 00110001
02: 50 - 32 - 00110010
03: 51 - 33 - 00110011
04: 52 - 34 - 00110100
05: 53 - 35 - 00110101
06: 54 - 36 - 00110110
07: 55 - 37 - 00110111
08: 56 - 38 - 00111000
09: 57 - 39 - 00111001 <- jump
10: 65 - 41 - 01000001
11: 66 - 42 - 01000010
12: 67 - 43 - 01000011
13: 68 - 44 - 01000100
14: 69 - 45 - 01000101
15: 70 - 46 - 01000110
16: 71 - 47 - 01000111
17: 72 - 48 - 01001000
18: 73 - 49 - 01001001
19: 74 - 4a - 01001010
20: 75 - 4b - 01001011
21: 76 - 4c - 01001100
22: 77 - 4d - 01001101
23: 78 - 4e - 01001110

for minutes and seconds:

min  10   16          2
-----------------------
00:  48 - 30 - 00110000
01:  49 - 31 - 00110001
02:  50 - 32 - 00110010
03:  51 - 33 - 00110011
04:  52 - 34 - 00110100
05:  53 - 35 - 00110101
06:  54 - 36 - 00110110
07:  55 - 37 - 00110111
08:  56 - 38 - 00111000
09:  57 - 39 - 00111001 <- jump
10:  65 - 41 - 01000001
11:  66 - 42 - 01000010
12:  67 - 43 - 01000011
13:  68 - 44 - 01000100
14:  69 - 45 - 01000101
15:  70 - 46 - 01000110
16:  71 - 47 - 01000111
17:  72 - 48 - 01001000
18:  73 - 49 - 01001001
19:  74 - 4a - 01001010
20:  75 - 4b - 01001011
21:  76 - 4c - 01001100
22:  77 - 4d - 01001101
23:  78 - 4e - 01001110
24:  79 - 4f - 01001111
25:  80 - 50 - 01010000
26:  81 - 51 - 01010001
27:  82 - 52 - 01010010
28:  83 - 53 - 01010011
29:  84 - 54 - 01010100
30:  85 - 55 - 01010101
31:  86 - 56 - 01010110
32:  87 - 57 - 01010111
33:  88 - 58 - 01011000
34:  89 - 59 - 01011001
35:  90 - 5a - 01011010 <- jump
36:  97 - 61 - 01100001
37:  98 - 62 - 01100010
38:  99 - 63 - 01100011
39: 100 - 64 - 01100100
40: 101 - 65 - 01100101
41: 102 - 66 - 01100110
42: 103 - 67 - 01100111
43: 104 - 68 - 01101000
44: 105 - 69 - 01101001
45: 106 - 6a - 01101010
46: 107 - 6b - 01101011
47: 108 - 6c - 01101100
48: 109 - 6d - 01101101
49: 110 - 6e - 01101110
50: 111 - 6f - 01101111
51: 112 - 70 - 01110000
52: 113 - 71 - 01110001
53: 114 - 72 - 01110010
54: 115 - 73 - 01110011
55: 116 - 74 - 01110100
56: 117 - 75 - 01110101
57: 118 - 76 - 01110110
58: 119 - 77 - 01110111
59: 120 - 78 - 01111000

Do you guys know of any encoding like this? Does it make sense? There would be any reason for encoding this way?

2

Converting the numbers to ASCII, we get:

  • 0 ~ 9 = 0 ~ 9 (0x30 ~ 0x39)
  • 10 ~ 35 = A ~ Z (0x41 ~ 0x5a)
  • 36 ~ 61 = a ~ z (0x61 ~ 0x7a)

It is encoded this way probably to make it human-readable.

1
  • Crazy way to encode!
    – Gustavo
    Feb 18 '17 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.