Murata RF modules are designed to simplify wireless development and certification by minimizing the amount of RF expertise you need to wirelessly enable a wide range of applications.
Payload.h@0:8e83b9448758, 2015-02-03 (annotated)
- Committer:
- yangcq88517
- Date:
- Tue Feb 03 21:24:15 2015 +0000
- Revision:
- 0:8e83b9448758
- Child:
- 2:f8e393a81c25
MuRata WiFi Module
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangcq88517 | 0:8e83b9448758 | 1 | #ifndef SmartLab_MuRata_Payload |
yangcq88517 | 0:8e83b9448758 | 2 | #define SmartLab_MuRata_Payload |
yangcq88517 | 0:8e83b9448758 | 3 | |
yangcq88517 | 0:8e83b9448758 | 4 | #include "mbed.h" |
yangcq88517 | 0:8e83b9448758 | 5 | |
yangcq88517 | 0:8e83b9448758 | 6 | #include "ResponseFlag.h" |
yangcq88517 | 0:8e83b9448758 | 7 | #include "SubCommandID.h" |
yangcq88517 | 0:8e83b9448758 | 8 | |
yangcq88517 | 0:8e83b9448758 | 9 | |
yangcq88517 | 0:8e83b9448758 | 10 | namespace SmartLabMuRata |
yangcq88517 | 0:8e83b9448758 | 11 | { |
yangcq88517 | 0:8e83b9448758 | 12 | class Payload |
yangcq88517 | 0:8e83b9448758 | 13 | { |
yangcq88517 | 0:8e83b9448758 | 14 | private : |
yangcq88517 | 0:8e83b9448758 | 15 | |
yangcq88517 | 0:8e83b9448758 | 16 | static const int EXPANDSIZE = 1024; |
yangcq88517 | 0:8e83b9448758 | 17 | |
yangcq88517 | 0:8e83b9448758 | 18 | char * data; |
yangcq88517 | 0:8e83b9448758 | 19 | |
yangcq88517 | 0:8e83b9448758 | 20 | int position; |
yangcq88517 | 0:8e83b9448758 | 21 | |
yangcq88517 | 0:8e83b9448758 | 22 | int max; |
yangcq88517 | 0:8e83b9448758 | 23 | |
yangcq88517 | 0:8e83b9448758 | 24 | public: |
yangcq88517 | 0:8e83b9448758 | 25 | Payload(); |
yangcq88517 | 0:8e83b9448758 | 26 | |
yangcq88517 | 0:8e83b9448758 | 27 | Payload(Payload * payload); |
yangcq88517 | 0:8e83b9448758 | 28 | |
yangcq88517 | 0:8e83b9448758 | 29 | const char * GetData(); |
yangcq88517 | 0:8e83b9448758 | 30 | |
yangcq88517 | 0:8e83b9448758 | 31 | /// <summary> |
yangcq88517 | 0:8e83b9448758 | 32 | /// The first byte of the Payload of the command describes the specific operation to perform for the Command ID, and it contains the Response Flag and Sub-Command ID (RFSCID). The Payload may be a request (REQ) from the host to the module, a response (RSP) from the module to that request, an indication (IND) from the module to the host, and the optional confirmation (CFM) from the host for that indication. |
yangcq88517 | 0:8e83b9448758 | 33 | /// </summary> |
yangcq88517 | 0:8e83b9448758 | 34 | /// <returns></returns> |
yangcq88517 | 0:8e83b9448758 | 35 | ResponseFlag GetResponseFlag(); |
yangcq88517 | 0:8e83b9448758 | 36 | |
yangcq88517 | 0:8e83b9448758 | 37 | void SetResponseFlag(const ResponseFlag flag); |
yangcq88517 | 0:8e83b9448758 | 38 | |
yangcq88517 | 0:8e83b9448758 | 39 | // sub command id |
yangcq88517 | 0:8e83b9448758 | 40 | SubCommandID GetSubCommandID(); |
yangcq88517 | 0:8e83b9448758 | 41 | |
yangcq88517 | 0:8e83b9448758 | 42 | /// <summary> |
yangcq88517 | 0:8e83b9448758 | 43 | /// must call SetSubCommandID first then SetFrameID, and any other data afterwards |
yangcq88517 | 0:8e83b9448758 | 44 | /// </summary> |
yangcq88517 | 0:8e83b9448758 | 45 | void SetSubCommandID(const SubCommandID id) ; |
yangcq88517 | 0:8e83b9448758 | 46 | |
yangcq88517 | 0:8e83b9448758 | 47 | /// <summary> |
yangcq88517 | 0:8e83b9448758 | 48 | /// must call SetSubCommandID first then SetFrameID, and any other data afterwards |
yangcq88517 | 0:8e83b9448758 | 49 | /// </summary> |
yangcq88517 | 0:8e83b9448758 | 50 | void SetSubCommandID(const int value); |
yangcq88517 | 0:8e83b9448758 | 51 | |
yangcq88517 | 0:8e83b9448758 | 52 | // frame id |
yangcq88517 | 0:8e83b9448758 | 53 | char GetFrameID(); |
yangcq88517 | 0:8e83b9448758 | 54 | |
yangcq88517 | 0:8e83b9448758 | 55 | /// <summary> |
yangcq88517 | 0:8e83b9448758 | 56 | /// must call SetSubCommandID first then SetFrameID, and any other data afterwards |
yangcq88517 | 0:8e83b9448758 | 57 | /// </summary> |
yangcq88517 | 0:8e83b9448758 | 58 | void SetFrameID(const char frameID); |
yangcq88517 | 0:8e83b9448758 | 59 | |
yangcq88517 | 0:8e83b9448758 | 60 | // content |
yangcq88517 | 0:8e83b9448758 | 61 | int GetPosition(); |
yangcq88517 | 0:8e83b9448758 | 62 | |
yangcq88517 | 0:8e83b9448758 | 63 | void SetPosition(const int position); |
yangcq88517 | 0:8e83b9448758 | 64 | |
yangcq88517 | 0:8e83b9448758 | 65 | void Allocate(const int length); |
yangcq88517 | 0:8e83b9448758 | 66 | |
yangcq88517 | 0:8e83b9448758 | 67 | void Rewind(); |
yangcq88517 | 0:8e83b9448758 | 68 | |
yangcq88517 | 0:8e83b9448758 | 69 | void SetContent(const char value); |
yangcq88517 | 0:8e83b9448758 | 70 | |
yangcq88517 | 0:8e83b9448758 | 71 | void SetContent(const char * value, const int offset, const int length); |
yangcq88517 | 0:8e83b9448758 | 72 | }; |
yangcq88517 | 0:8e83b9448758 | 73 | } |
yangcq88517 | 0:8e83b9448758 | 74 | |
yangcq88517 | 0:8e83b9448758 | 75 | #endif |