Librairie xbee.

Dependents:   NerfUS-Coord NerfUSTarget

Fork of APP3_xbee by Team APP

xbee.h

Committer:
dupm2216
Date:
2017-02-12
Revision:
4:e97cfe6cc18c
Parent:
3:37ea92feece2
Child:
5:cd3c79853dc8

File content as of revision 4:e97cfe6cc18c:

#ifndef XBEE_HPP
#define XBEE_HPP

#include <vector>
#include <cassert>
#include "mbed.h"
#include "rtos.h"

//See xbee document page 99
const char FRAME_TYPE_RECEIVE_PACKET = 0x90;
const char FRAME_TYPE_TRANSMIT_STATUS = 0x8B;
const char FRAME_TYPE_AT_COMMAND_RESPONSE = 0x88;

const char TRANSMIT_STATUS_SUCCESS = 0x00;
const char AT_COMMAND_RESPONSE_STATUS_OK = 0x00;

extern Mail<vector<char>, 30> parsed_frames;

void send_message_via_xbee(const char* message, const int length);
vector<char> generate_transmit_request(const char* message, const int length);
void read_frame();
vector<char> parse_receive_packet(const vector<char>& frame);
vector<char> parse_transmit_status(const vector<char>& frame);
vector<char> parse_at_command_response(const vector<char>& frame);
void handle_parsed_frames_from_mailbox();
void handle_frame(const vector<char>& frame);

//Simplify the frame to only contain the frame type and the relevant data for our application
vector<char> parse_frame(const vector<char>& frame);

#endif