Bruno Allaire-Lemay / NerfUSXbee
Committer:
dupm2216
Date:
Sun Feb 12 20:31:46 2017 +0000
Revision:
3:37ea92feece2
Parent:
0:8f5379c94a69
Child:
4:e97cfe6cc18c
Parse arbitrary supported frame; ; Supported frames:; ; - Receive packet; ; - Transmit status; ; - AT command response; ; Also refactored the assert_vector_equal function so that the assert message show the problematic line more accurately

Who changed what in which revision?

UserRevisionLine numberNew 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 0:8f5379c94a69 17 void send_message_via_xbee(const char* message, const int length);
dupm2216 0:8f5379c94a69 18 vector<char> generate_transmit_request(const char* message, const int length);
dupm2216 0:8f5379c94a69 19 void read_frame();
dupm2216 3:37ea92feece2 20 vector<char> parse_receive_packet(const vector<char>& frame);
dupm2216 3:37ea92feece2 21 vector<char> parse_transmit_status(const vector<char>& frame);
dupm2216 3:37ea92feece2 22 vector<char> parse_at_command_response(const vector<char>& frame);
dupm2216 0:8f5379c94a69 23 void handle_message();
dupm2216 0:8f5379c94a69 24
dupm2216 3:37ea92feece2 25 //Simplify the frame to only contain the frame type and the relevant data for our application
dupm2216 3:37ea92feece2 26 vector<char> parse_frame(const vector<char>& frame);
dupm2216 3:37ea92feece2 27
dupm2216 0:8f5379c94a69 28 #endif