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.
Dependents: LoRaBaseStation LoRaTerminal
BasicPacket/BasicPacket.h
- Committer:
- rba90
- Date:
- 2016-06-29
- Revision:
- 0:f32c0e562e9a
- Child:
- 2:f4f46b04ab8a
File content as of revision 0:f32c0e562e9a:
#ifndef BASICPACKET_H_ #define BASICPACKET_H_ #include <stdint.h> class BasicPacket { private: // keep those private! // inherit class should always use public method to access those private // property uint8_t _buffer[4]; // verify() function will toggle this variable // any other modification to internal properties // will revert this variable to false bool _isVerified; public: BasicPacket(); BasicPacket(uint8_t *data); ~BasicPacket(); public: // calculate CRC value and write it into CRC field void generateCrc(); // calculate CRC value and compare it with that in CRC field bool verify(); // make a copy of internal buffer // the user void serialize(uint8_t *buffer); public: void setFid(uint8_t fid); void setField1(uint8_t field); void setField2(uint8_t field); void setField3(uint8_t field); uint8_t getFid(); uint8_t getField1(); uint8_t getField2(); uint8_t getField3(); uint8_t getCrc(); }; #endif