Demo HCI Implementation for WiMOD-LR Devices  V1.3.1
WiMOD_SAP_DEVMGMT.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------
32 
33 
34 #ifndef ARDUINO_WIMOD_SAP_DEVMGMT_H_
35 #define ARDUINO_WIMOD_SAP_DEVMGMT_H_
36 
37 
38 /*
39  * THIS IS AN EXAMPLE IMPLEMENTATION ACCORDING THE THE HCI SPEC: V1.8
40  * FOR FIRMWARE: LR-BASE
41  *
42  * SEE FILE: WiMOD_LR_Base_HCI_Spec_V1_8.pdf for detailed information
43  *
44  */
45 
46 //------------------------------------------------------------------------------
47 //
48 // Section Includes Files
49 //
50 //------------------------------------------------------------------------------
51 
52 #include "WiMOD_SAP_DEVMGMT_IDs.h"
53 #include "../HCI/WiMODLRHCI.h"
54 
55 /*
56  * C++11 supports a better way for function pointers / function objects
57  * But C++11 mode is not supported by all platforms.
58  */
59 #ifdef WIMOD_USE_CPP11
60 #include <functional>
61 #endif
62 
63 //------------------------------------------------------------------------------
64 //
65 // Section defines
66 //
67 //------------------------------------------------------------------------------
69 #define WiMOD_DEVMGMT_MSG_SIZE (100)
70 
71 
72 //-----------------------------------------------------------------------------
73 //
74 // types for callback functions
75 //
76 //-----------------------------------------------------------------------------
77 
78 // C++11 check
79 #ifdef WIMOD_USE_CPP11
80  /* C++11 function callback definitions */
81 
83  typedef std::function<void (void)> TDevMgmtPowerUpCallback;
84 
85 
87  typedef std::function<void (void)> TDevMgmtRtcAlarmCallback;
88 
89 #else
90  /* pre C++11 function callback definitions */
91 
93  typedef void (*TDevMgmtPowerUpCallback)(void);
94 
96  typedef void (*TDevMgmtRtcAlarmCallback)(void);
97 
98 #endif
99 
100 //------------------------------------------------------------------------------
101 //
102 // Section class
103 //
104 //------------------------------------------------------------------------------
105 
110 public:
111  WiMOD_SAP_DevMgmt(TWiMODLRHCI* hci, UINT8* buffer, UINT16 bufferSize);
112  ~WiMOD_SAP_DevMgmt(void);
113 
114  TWiMDLRResultCodes Ping(UINT8* statusRsp);
115 
116  TWiMDLRResultCodes Reset(UINT8* statusRsp);
117 
119 
121 
123 
124  TWiMDLRResultCodes GetRtc(UINT32* rtcTime, UINT8* statusRsp);
125 
126  TWiMDLRResultCodes SetRtc(const UINT32 rtcTime, UINT8* statusRsp);
127 
129 
130  TWiMDLRResultCodes SetRadioConfig(const TWiMODLR_DevMgmt_RadioConfig* radioCfg, UINT8* statusRsp);
131 
132  TWiMDLRResultCodes ResetRadioConfig(UINT8* statusRsp);
133 
134  TWiMDLRResultCodes GetOperationMode(TWiMOD_OperationMode* opMode, UINT8* statusRsp);
135 
136  TWiMDLRResultCodes SetOperationMode(const TWiMOD_OperationMode opMode, UINT8* statusRsp);
137 
138  TWiMDLRResultCodes SetAesKey(const UINT8* key, UINT8* statusRsp);
139 
140  TWiMDLRResultCodes GetAesKey(UINT8* key, UINT8* statusRsp);
141 
142  TWiMDLRResultCodes SetRtcAlarm(const TWiMODLR_DevMgmt_RtcAlarm* rtcAlarm, UINT8* statusRsp);
143 
144  TWiMDLRResultCodes GetRtcAlarm(TWiMODLR_DevMgmt_RtcAlarm* rtcAlarm, UINT8* statusRsp);
145 
146  TWiMDLRResultCodes ClearRtcAlarm(UINT8* statusRsp);
147 
148 
150 
152 
153  void DispatchDeviceMgmtMessage(TWiMODLR_HCIMessage& rxMsg);
154 protected:
155 
156 private:
158  UINT8* txPayload;
159  UINT16 txyPayloadSize;
160 
161  TDevMgmtPowerUpCallback PowerUpCallack;
162  TDevMgmtRtcAlarmCallback RtcAlarmCallback;
163 
164  TWiMODLRHCI* HciParser;
166 };
167 
168 
169 #endif /* ARDUINO_WIMOD_SAP_DEVMGMT_H_ */
Basic information about system status of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:208
TWiMDLRResultCodes GetAesKey(UINT8 *key, UINT8 *statusRsp)
GetAesKey Cmd - Get the 128bit AES that that is used for encryption.
Definition: WiMOD_SAP_DEVMGMT.cpp:580
WiMOD_SAP_DevMgmt(TWiMODLRHCI *hci, UINT8 *buffer, UINT16 bufferSize)
Constructor.
Definition: WiMOD_SAP_DEVMGMT.cpp:64
TWiMDLRResultCodes GetFirmwareInfo(TWiMODLR_DevMgmt_FwInfo *info, UINT8 *statusRsp)
GetFirmwareInfo Cmd - Get basic info about the running firmware.
Definition: WiMOD_SAP_DEVMGMT.cpp:185
TWiMDLRResultCodes GetSystemStatus(TWiMODLR_DevMgmt_SystemStatus *info, UINT8 *statusRsp)
GetSystemStatus Cmd - Get basic info about the system status of WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:230
Supporting IDs and definitions for the DeviceManagement ServiceAccessPoint.
TWiMDLRResultCodes
Result codes for the local serial communication itself.
Definition: WiMODLRHCI.h:149
TWiMDLRResultCodes GetRtcAlarm(TWiMODLR_DevMgmt_RtcAlarm *rtcAlarm, UINT8 *statusRsp)
GetRtcAlarm Cmd - Get information about RTC alarm feature.
Definition: WiMOD_SAP_DEVMGMT.cpp:646
void RegisterPowerUpIndicationClient(TDevMgmtPowerUpCallback cb)
Register a callback function for processing a PowerUp Indication message.
Definition: WiMOD_SAP_DEVMGMT.cpp:709
void(* TDevMgmtRtcAlarmCallback)(void)
Definition: WiMOD_SAP_DEVMGMT.h:96
TWiMDLRResultCodes SetRadioConfig(const TWiMODLR_DevMgmt_RadioConfig *radioCfg, UINT8 *statusRsp)
SetRadioConfig Cmd - Set the radio settings of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:411
basic low level HCI message structure used for all serial messages to/from WiMOD
Definition: WiMODLRHCI.h:120
Internal helper class for processing SLIP frames.
Definition: WiMODLRHCI.h:229
void RegisterRtcAlarmIndicationClient(TDevMgmtRtcAlarmCallback cb)
Register a callback function for processing a RTC Alarm Indication message.
Definition: WiMOD_SAP_DEVMGMT.cpp:721
TWiMOD_OperationMode
This enum describes the possible operation modes of the WiMOD (only for LR-BASE). ...
Definition: WiMOD_SAP_DEVMGMT_IDs.h:410
Implementation for the ServiceAccessPoint DeviceManagement.
Definition: WiMOD_SAP_DEVMGMT.h:109
Structure containing the radio (stack) config parameters of the WiMOD (only for LR-BASE) ...
Definition: WiMOD_SAP_DEVMGMT_IDs.h:376
Structure containing the RTC Alarm config parameters of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:452
Basic information about the current firmware of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:194
TWiMDLRResultCodes GetOperationMode(TWiMOD_OperationMode *opMode, UINT8 *statusRsp)
GetOperationMode Cmd - Get the current operation mode of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:499
TWiMDLRResultCodes GetDeviceInfo(TWiMODLR_DevMgmt_DevInfo *info, UINT8 *statusRsp)
Reset Cmd - Do a reset / reboot of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:144
TWiMDLRResultCodes SetOperationMode(const TWiMOD_OperationMode opMode, UINT8 *statusRsp)
SetOperationMode Cmd - Set the current operation mode of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:525
TWiMDLRResultCodes SetAesKey(const UINT8 *key, UINT8 *statusRsp)
SetAesKey Cmd - Set the 128bit AES that is to be used for encryption.
Definition: WiMOD_SAP_DEVMGMT.cpp:551
TWiMDLRResultCodes ClearRtcAlarm(UINT8 *statusRsp)
GetRtcAlarm Cmd - Clear a pending RTC alarm.
Definition: WiMOD_SAP_DEVMGMT.cpp:684
TWiMDLRResultCodes Reset(UINT8 *statusRsp)
Reset Cmd - Do a reset / reboot of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:118
~WiMOD_SAP_DevMgmt(void)
Destructor.
Definition: WiMOD_SAP_DEVMGMT.cpp:77
TWiMDLRResultCodes GetRtc(UINT32 *rtcTime, UINT8 *statusRsp)
GetRtc Cmd - Get the current RTC time/date from WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:285
Structure containing basic information about the WiMOD device.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:156
TWiMDLRResultCodes Ping(UINT8 *statusRsp)
Ping Cmd - Checks if the serial connection of to the WiMOD module is OK.
Definition: WiMOD_SAP_DEVMGMT.cpp:91
void(* TDevMgmtPowerUpCallback)(void)
Definition: WiMOD_SAP_DEVMGMT.h:93
TWiMDLRResultCodes SetRtcAlarm(const TWiMODLR_DevMgmt_RtcAlarm *rtcAlarm, UINT8 *statusRsp)
GetRtcAlarm Cmd - Get information about the RTC alarm event.
Definition: WiMOD_SAP_DEVMGMT.cpp:610
TWiMDLRResultCodes GetRadioConfig(TWiMODLR_DevMgmt_RadioConfig *radioCfg, UINT8 *statusRsp)
GetRadioConfig Cmd - Get the radio settings of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:351
TWiMDLRResultCodes ResetRadioConfig(UINT8 *statusRsp)
ResetRadioConfig Cmd - Reset the radio config to factory defaults.
Definition: WiMOD_SAP_DEVMGMT.cpp:473
TWiMDLRResultCodes SetRtc(const UINT32 rtcTime, UINT8 *statusRsp)
SetRtc Cmd - Set the current RTC time/date of WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:322