Fixed more bogues
Revision 18:10bc91c3fb42, committed 2017-03-30
- Comitter:
- GaiSensei
- Date:
- Thu Mar 30 17:55:53 2017 +0000
- Parent:
- 17:969aa15f783d
- Commit message:
- Fixed more bogues
Changed in this revision
include/xbee.h | Show annotated file Show diff for this revision Revisions of this file |
mbed_source/xbee.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 969aa15f783d -r 10bc91c3fb42 include/xbee.h --- a/include/xbee.h Thu Mar 30 17:31:40 2017 +0000 +++ b/include/xbee.h Thu Mar 30 17:55:53 2017 +0000 @@ -62,8 +62,8 @@ void handle_frame(const vector<char>& frame); void parse_nerfus_message(const vector<char>& parsed_frame); -void parse_coordinator_command(const vector<char>& parsed_frame, vector<uint8_t> coordinator_command); -void parse_routor_message(const vector<char>& parsed_frame, vector<uint8_t> routor_message); +void parse_coordinator_command(const vector<char>& parsed_frame); +void parse_routor_message(const vector<char>& parsed_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);
diff -r 969aa15f783d -r 10bc91c3fb42 mbed_source/xbee.cpp --- a/mbed_source/xbee.cpp Thu Mar 30 17:31:40 2017 +0000 +++ b/mbed_source/xbee.cpp Thu Mar 30 17:55:53 2017 +0000 @@ -293,41 +293,52 @@ } void parse_nerfus_message(const vector<char>& parsed_frame) -{ - vector<uint8_t> message; - message.push_back(0x97); - - const char event_type = parsed_frame[1]; +{ + const char event_type = parsed_frame[0]; switch(event_type) { case EVENT_TYPE_COORDINATOR_TO_ROUTER: - parse_coordinator_command(parsed_frame, message); + parse_coordinator_command(parsed_frame); break; case EVENT_TYPE_ROUTOR_TO_COORDINATOR: - parse_routor_message(parsed_frame, message); + parse_routor_message(parsed_frame); break; } } -void parse_coordinator_command(const vector<char>& parsed_frame, vector<uint8_t> coordinator_command) +void parse_coordinator_command(const vector<char>& parsed_frame) { + vector<uint8_t> coordinator_command; + coordinator_command.push_back(parsed_frame[1]); coordinator_command.push_back(parsed_frame[2]); coordinator_command.push_back(parsed_frame[3]); coordinator_command.push_back(parsed_frame[4]); - coordinator_command.push_back(parsed_frame[5]); //Appeler fonction Max + + printf("%s\r\n","Max routor :"); + printf("%c\r\n", coordinator_command.at(0)); + printf("%c\r\n", coordinator_command.at(1)); + printf("%c\r\n", coordinator_command.at(2)); + printf("%c\r\n", coordinator_command.at(3)); } -void parse_routor_message(const vector<char>& parsed_frame, vector<uint8_t> routor_message) +void parse_routor_message(const vector<char>& parsed_frame) { + vector<uint8_t> routor_message; + routor_message.push_back(parsed_frame[1]); routor_message.push_back(parsed_frame[2]); routor_message.push_back(parsed_frame[3]); - routor_message.push_back(parsed_frame[4]); - routor_message.push_back(parsed_frame[5]); + routor_message.push_back(parsed_frame[4]); //Appeler fonction Ismaël + + printf("%s\r\n","Ismael coordonnateur :"); + printf("%c\r\n", routor_message.at(0)); + printf("%c\r\n", routor_message.at(1)); + printf("%c\r\n", routor_message.at(2)); + printf("%c\r\n", routor_message.at(3)); } void parsed_button_event_frame_to_string(const vector<char>& parsed_frame, char* readable_string_output)