Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
xbee.h
- Committer:
- dupm2216
- Date:
- 2017-02-14
- Revision:
- 8:b9c096965c00
- Parent:
- 6:b70f32a80d51
- Child:
- 9:04063c29ab43
- Child:
- 10:612739c6d27d
File content as of revision 8:b9c096965c00:
#ifndef XBEE_HPP
#define XBEE_HPP
#include <vector>
#include <cassert>
#include "mbed.h"
#include "rtos.h"
struct ingoing_value_t
{
char content[11];
int size;
};
//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;
const char EVENT_TYPE_BUTTON = 0x00;
const char EVENT_TYPE_ACCELEROMETER = 0x01;
const char BUTTON_PRESSED = 0x00;
const char BUTTON_RELEASED = 0x01;
extern Mail<ingoing_value_t, 30> parsed_frames;
extern RawSerial xbee;
void send_message_via_xbee(const char* message, const int length);
vector<char> generate_transmit_request(const char* message, const int length);
vector<char> generate_led_command(const bool power_on);
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);
void parsed_frame_to_string(const vector<char>& parsed_frame, char* readable_string_output);
void parsed_button_event_frame_to_string(const vector<char>& parsed_frame, char* readable_string_output);
void parsed_accelerometer_event_frame_to_string(const vector<char>& parsed_frame, char* readable_string_output);
//Simplify the frame to only contain the frame type and the relevant data for our application
vector<char> parse_frame(const vector<char>& frame);
vector<char> ingoing_value_to_vector(const ingoing_value_t& value);
#endif