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.

Committer:
yangcq88517
Date:
Wed Mar 16 15:04:46 2016 +0000
Revision:
9:0ce800923eda
Parent:
2:f8e393a81c25
bug fix

Who changed what in which revision?

UserRevisionLine numberNew 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 9:0ce800923eda 28
yangcq88517 9:0ce800923eda 29 void SetPayload(Payload * payload);
yangcq88517 0:8e83b9448758 30
yangcq88517 2:f8e393a81c25 31 char * GetData();
yangcq88517 0:8e83b9448758 32
yangcq88517 0:8e83b9448758 33 /// <summary>
yangcq88517 0:8e83b9448758 34 /// 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 35 /// </summary>
yangcq88517 0:8e83b9448758 36 /// <returns></returns>
yangcq88517 0:8e83b9448758 37 ResponseFlag GetResponseFlag();
yangcq88517 0:8e83b9448758 38
yangcq88517 0:8e83b9448758 39 void SetResponseFlag(const ResponseFlag flag);
yangcq88517 0:8e83b9448758 40
yangcq88517 0:8e83b9448758 41 // sub command id
yangcq88517 0:8e83b9448758 42 SubCommandID GetSubCommandID();
yangcq88517 0:8e83b9448758 43
yangcq88517 0:8e83b9448758 44 /// <summary>
yangcq88517 0:8e83b9448758 45 /// must call SetSubCommandID first then SetFrameID, and any other data afterwards
yangcq88517 0:8e83b9448758 46 /// </summary>
yangcq88517 0:8e83b9448758 47 void SetSubCommandID(const SubCommandID id) ;
yangcq88517 0:8e83b9448758 48
yangcq88517 0:8e83b9448758 49 /// <summary>
yangcq88517 0:8e83b9448758 50 /// must call SetSubCommandID first then SetFrameID, and any other data afterwards
yangcq88517 0:8e83b9448758 51 /// </summary>
yangcq88517 0:8e83b9448758 52 void SetSubCommandID(const int value);
yangcq88517 0:8e83b9448758 53
yangcq88517 0:8e83b9448758 54 // frame id
yangcq88517 0:8e83b9448758 55 char GetFrameID();
yangcq88517 0:8e83b9448758 56
yangcq88517 0:8e83b9448758 57 /// <summary>
yangcq88517 0:8e83b9448758 58 /// must call SetSubCommandID first then SetFrameID, and any other data afterwards
yangcq88517 0:8e83b9448758 59 /// </summary>
yangcq88517 0:8e83b9448758 60 void SetFrameID(const char frameID);
yangcq88517 0:8e83b9448758 61
yangcq88517 0:8e83b9448758 62 // content
yangcq88517 0:8e83b9448758 63 int GetPosition();
yangcq88517 0:8e83b9448758 64
yangcq88517 0:8e83b9448758 65 void SetPosition(const int position);
yangcq88517 0:8e83b9448758 66
yangcq88517 0:8e83b9448758 67 void Allocate(const int length);
yangcq88517 0:8e83b9448758 68
yangcq88517 0:8e83b9448758 69 void Rewind();
yangcq88517 0:8e83b9448758 70
yangcq88517 0:8e83b9448758 71 void SetContent(const char value);
yangcq88517 0:8e83b9448758 72
yangcq88517 0:8e83b9448758 73 void SetContent(const char * value, const int offset, const int length);
yangcq88517 0:8e83b9448758 74 };
yangcq88517 0:8e83b9448758 75 }
yangcq88517 0:8e83b9448758 76
yangcq88517 0:8e83b9448758 77 #endif