vedirect_protocol:faq
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
vedirect_protocol:faq [2020-06-05 21:30] – [Q6: What is the end of line character when sending a HEX message?] mvader | vedirect_protocol:faq [2020-07-20 21:25] – [Q8: How do I calculate the TEXT checksum?] mbosma | ||
---|---|---|---|
Line 76: | Line 76: | ||
How often you send a HEX message doesn' | How often you send a HEX message doesn' | ||
- | ===== 2. Framehandler reference implementation ===== | ||
- | This the main data receival routine of our consumer stack. | + | ==== Q8: How do I calculate |
+ | I need to get data from a BMV, but how do I check the data integrity? The [[https:// | ||
+ | |||
+ | **Answer: | ||
+ | Consider the following output: | ||
< | < | ||
+ | PID 0x203 | ||
+ | V 26201 | ||
+ | I 0 | ||
+ | P 0 | ||
+ | CE 0 | ||
+ | SOC 1000 | ||
+ | TTG -1 | ||
+ | Alarm OFF | ||
+ | Relay OFF | ||
+ | AR 0 | ||
+ | BMV 700 | ||
+ | FW 0307 | ||
+ | Checksum � | ||
+ | </ | ||
+ | And as a raw data dump: | ||
+ | < | ||
+ | 00000000 | ||
+ | 00000010 | ||
+ | 00000020 | ||
+ | 00000030 | ||
+ | 00000040 | ||
+ | 00000050 | ||
+ | 00000060 | ||
+ | </ | ||
+ | The checksum needs to be calculated from the start (0d) till the end of the frame, including the checksum value from the frame (d8). | ||
+ | |||
+ | In code you can loop through the message as in the following pseudo code: | ||
+ | <code c> | ||
+ | int checksum = 0; | ||
+ | char message[] = { ... }; | ||
+ | for (int i = 0; i < message.length; | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (checksum == 0) { | ||
+ | /* Checksum is valid => process message */ | ||
+ | | ||
+ | } else { | ||
+ | /* Invalid checksum => reject message */ | ||
+ | } | ||
+ | </ | ||
+ | ===== 2. Framehandler reference implementation ===== | ||
+ | |||
+ | This the main data receival routine of our consumer stack that both handles TEXT and HEX messages. | ||
+ | |||
+ | <code cpp> | ||
#include " | #include " | ||
vedirect_protocol/faq.txt · Last modified: 2023-03-31 12:04 by mvader