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.
AlohaFrame.h
00001 #ifndef ALOHAFRAME_H_ 00002 #define ALOHAFRAME_H_ 00003 00004 #include <stdint.h> 00005 00006 #define MAX_FRAME_SZ 20 00007 #define MAX_PAYLOAD_SZ 16 00008 #define FIXED_BYTE MAX_FRAME_SZ - MAX_PAYLOAD_SZ 00009 #define ALOHA_MAX_TYPE 16 00010 00011 class AlohaFrame 00012 { 00013 private: 00014 uint8_t _buffer[MAX_FRAME_SZ]; 00015 00016 bool _isVerified; 00017 00018 public: 00019 typedef enum 00020 { 00021 Aloha_Join_Request = 0x0, 00022 Aloha_Join_Accepted, 00023 Aloha_Join_Denied, 00024 Aloha_Authentication, 00025 Aloha_Deauthentication, 00026 Aloha_RTS, 00027 Aloha_CTS, 00028 Aloha_Data, 00029 Aloha_ACK, 00030 Aloha_NACK, 00031 } AlohaType_t; 00032 00033 public: 00034 AlohaFrame(); 00035 AlohaFrame(uint8_t *data, uint8_t sz=MAX_PAYLOAD_SZ); 00036 ~AlohaFrame(); 00037 00038 public: 00039 void generateCrc(); 00040 00041 bool verify(); 00042 00043 uint8_t serialize(uint8_t *buffer); 00044 00045 public: 00046 void setType(uint8_t type); 00047 void setPayloadLength(uint8_t length); 00048 void setSourceAddress(uint8_t sa); 00049 void setDestinationAddress(uint8_t da); 00050 void setFullMessageFlag(uint8_t fmf); 00051 void setSequenceID(uint8_t seqid); 00052 void setPayload(uint8_t idx, uint8_t payload); 00053 00054 uint8_t getType(); 00055 uint8_t getPayloadLength(); 00056 uint8_t getSourceAddress(); 00057 uint8_t getDestinationAddress(); 00058 uint8_t getFullMessageFlag(); 00059 uint8_t getSequenceID(); 00060 uint8_t getPayload(uint8_t idx); 00061 uint8_t getCrc(); 00062 00063 #ifdef _DEBUG 00064 public: 00065 void unit_test(); 00066 #endif 00067 }; 00068 00069 #endif
Generated on Wed Jul 20 2022 10:55:18 by
1.7.2