node-serialport: readline Hex encoding problem
Hi i have problems reading line with hex encoding
1) c0a8
2) fe534d415254434c4f5544aaaa091600010c022d2cd1c0a8
3) fe534d415254434c4f5544aaaa091600010c022d2cd1c0a8
4) fe534d415254434c4f5544aaaa12012b01b8efffffff03fefefe0c2d0223afc0a8
5) fe534d415254434c4f5544aaaa0e012b01b8f036ffff000000d80bc0a8
6) fe534d415254434c4f5544aaaa091600010c022d2cd1c0a8
7) fe534d415254434c4f5544aaaa0653004178e2c0a8
8) fe534d415254434c4f5544aaaa1a150001523128312e3433293c31322d313e5b315d2a002af89ac0a8
9) fe534d415254434c4f5544aaaa1a150002523128312e3433293c31322d323e5b325d2a002ab006c0a8
10) fe534d415254434c4f5544aaaa1a150003523128312e3433293c31322d333e5b335d2a002a8872c0a8
11) fe534d415254434c4f5544aaaa1a150004523128312e3433293c31322d343e5b345d2a002a213ec0a8
12) fe534d415254434c4f5544aaaa1a150005523128312e3433293c31322d353e5b355d2a002a194ac0a8
13) fe534d415254434c4f5544aaaa1a150006523128312e3433293c31322d363e5b365d2a002a51d6c0a8
14) fe534d415254434c4f5544aaaa1a150007523128312e3433293c31322d373e5b375d2a002a69a2c0a8
15) fe534d415254434c4f5544aaaa1a150008523128312e3433293c31322d383e5b385d2a002a136fc0a8
16) fe534d415254434c4f5544aaaa1a150009523128312e3433293c31322d393e5b395d2a002a2b1bc0a8
17) fe534d415254434c4f5544aaaa1a1500
18) 523128312e3433293c31322d31303e5b31305d2ac295c0a8
19) fe534d415254434c4f5544aaaa1a15000b523128312e3433293c31322d31313e5b31315d2a9832c0a8
20) fe534d415254434c4f5544aaaa1a15000c523128312e3433293c31322d31323e5b31325d2a1060c0a8
21) fe534d415254434c4f5544aaaa12012b01b8efffffff03fefefe0c2d0223afc0a8
22) fe534d415254434c4f5544aaaa0e012b01b8f036ffff000000d80bc0a8
23) fe534d415254434c4f5544aaaa091600010c022d2cd1c0a8
24) fe534d415254434c4f5544aaaa091600010c022d2cd1c0a8
25) fe534d415254434c4f5544aaaa12012b01b8efffffff03fefefe0c2d0223afc0a8
- first problem is line 1 and it always happen randomly
- bigger problem is line 17 & 18 and ‘0a’ is mising ! The complete line is
fe534d415254434c4f5544aaaa1a15000.0a.523128312e3433293c31322d31303e5b31305d2ac295c0a8
my packets always start with fe534d415254434c4f5544aaaa
please help me
Thanks
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (9 by maintainers)
☝️ uses utf8 by default
To use HEX pass the encoding on the second argument.
Glad we could help!
@reconbot @HipsterBrown Hi Here is what you want and my problems solved
1 ) I found ‘0a’ “The line feed” was the responsible for parser going to next line , i changed delimiter to ‘c0a80a’ and now it perfectly works
2 )And for the error
when the encoding is hex , i should not use ‘\n’ , ‘\r’ , if we use ‘hex’ it works correctly
Thanks a lot for your helps and answers 👍
If you log data events of the source data and the parser we can construct a test from the output and determine if the parser is doing something wrong.