Librairie xbee.
Dependents: NerfUS-Coord NerfUSTarget
Fork of APP3_xbee by
xbee.h@4:e97cfe6cc18c, 2017-02-12 (annotated)
- Committer:
- dupm2216
- Date:
- Sun Feb 12 21:33:48 2017 +0000
- Revision:
- 4:e97cfe6cc18c
- Parent:
- 3:37ea92feece2
- Child:
- 5:cd3c79853dc8
Handle received frames of any type
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dupm2216 | 0:8f5379c94a69 | 1 | #ifndef XBEE_HPP |
dupm2216 | 0:8f5379c94a69 | 2 | #define XBEE_HPP |
dupm2216 | 0:8f5379c94a69 | 3 | |
dupm2216 | 0:8f5379c94a69 | 4 | #include <vector> |
dupm2216 | 0:8f5379c94a69 | 5 | #include <cassert> |
dupm2216 | 0:8f5379c94a69 | 6 | #include "mbed.h" |
dupm2216 | 0:8f5379c94a69 | 7 | #include "rtos.h" |
dupm2216 | 0:8f5379c94a69 | 8 | |
dupm2216 | 3:37ea92feece2 | 9 | //See xbee document page 99 |
dupm2216 | 3:37ea92feece2 | 10 | const char FRAME_TYPE_RECEIVE_PACKET = 0x90; |
dupm2216 | 3:37ea92feece2 | 11 | const char FRAME_TYPE_TRANSMIT_STATUS = 0x8B; |
dupm2216 | 3:37ea92feece2 | 12 | const char FRAME_TYPE_AT_COMMAND_RESPONSE = 0x88; |
dupm2216 | 3:37ea92feece2 | 13 | |
dupm2216 | 3:37ea92feece2 | 14 | const char TRANSMIT_STATUS_SUCCESS = 0x00; |
dupm2216 | 3:37ea92feece2 | 15 | const char AT_COMMAND_RESPONSE_STATUS_OK = 0x00; |
dupm2216 | 3:37ea92feece2 | 16 | |
dupm2216 | 4:e97cfe6cc18c | 17 | extern Mail<vector<char>, 30> parsed_frames; |
dupm2216 | 4:e97cfe6cc18c | 18 | |
dupm2216 | 0:8f5379c94a69 | 19 | void send_message_via_xbee(const char* message, const int length); |
dupm2216 | 0:8f5379c94a69 | 20 | vector<char> generate_transmit_request(const char* message, const int length); |
dupm2216 | 0:8f5379c94a69 | 21 | void read_frame(); |
dupm2216 | 3:37ea92feece2 | 22 | vector<char> parse_receive_packet(const vector<char>& frame); |
dupm2216 | 3:37ea92feece2 | 23 | vector<char> parse_transmit_status(const vector<char>& frame); |
dupm2216 | 3:37ea92feece2 | 24 | vector<char> parse_at_command_response(const vector<char>& frame); |
dupm2216 | 4:e97cfe6cc18c | 25 | void handle_parsed_frames_from_mailbox(); |
dupm2216 | 4:e97cfe6cc18c | 26 | void handle_frame(const vector<char>& frame); |
dupm2216 | 0:8f5379c94a69 | 27 | |
dupm2216 | 3:37ea92feece2 | 28 | //Simplify the frame to only contain the frame type and the relevant data for our application |
dupm2216 | 3:37ea92feece2 | 29 | vector<char> parse_frame(const vector<char>& frame); |
dupm2216 | 3:37ea92feece2 | 30 | |
dupm2216 | 0:8f5379c94a69 | 31 | #endif |