peer to peer rx terminal

Dependencies:   ISL29011 libxDot-dev-mbed5-deprecated

Fork of peer-to-peer_rxtx by Natalia Requejo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RadioEvent.h Source File

RadioEvent.h

00001 #ifndef __RADIO_EVENT_H__
00002 #define __RADIO_EVENT_H__
00003 
00004 #include "mDotEvent.h"
00005 
00006 class RadioEvent : public mDotEvent
00007 {
00008  
00009 public:
00010     RadioEvent() {}
00011  
00012     virtual ~RadioEvent() {}
00013     
00014     std::string buffer;
00015  
00016     virtual void MacEvent(LoRaMacEventFlags* flags, LoRaMacEventInfo* info) {
00017         if (flags->Bits.Rx) {
00018  
00019             if (info->RxBufferSize > 0) {
00020                 // print RX data as string and hexadecimal 
00021                 std::string rx((const char*)info->RxBuffer, info->RxBufferSize);
00022                 printf("Rx data: %s [%s]\r\n", rx.c_str(), mts::Text::bin2hexString(info->RxBuffer, info->RxBufferSize).c_str());
00023                 buffer += rx;
00024             }
00025         }
00026     }
00027     
00028     string print(){
00029         std::string pepe;
00030         pepe = buffer;
00031         buffer = "";
00032         return(pepe);    
00033     }
00034         
00035     
00036 };
00037 
00038 #endif
00039