| Demo HCI Implementation for WiMOD-LR Devices V1.3.1

- Main Page
- Classes
- Files

- File List
- File Members

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
109 class WiMOD_SAP_DevMgmt {
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
118 TWiMDLRResultCodes GetDeviceInfo(TWiMODLR_DevMgmt_DevInfo* info, UINT8* statusRsp);
119
120 TWiMDLRResultCodes GetFirmwareInfo(TWiMODLR_DevMgmt_FwInfo* info, UINT8* statusRsp);
121
122 TWiMDLRResultCodes GetSystemStatus(TWiMODLR_DevMgmt_SystemStatus* info, UINT8* statusRsp);
123
124 TWiMDLRResultCodes GetRtc(UINT32* rtcTime, UINT8* statusRsp);
125
126 TWiMDLRResultCodes SetRtc(const UINT32 rtcTime, UINT8* statusRsp);
127
128 TWiMDLRResultCodes GetRadioConfig(TWiMODLR_DevMgmt_RadioConfig* radioCfg, UINT8* statusRsp);
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
149 void RegisterPowerUpIndicationClient(TDevMgmtPowerUpCallback cb);
150
151 void RegisterRtcAlarmIndicationClient(TDevMgmtRtcAlarmCallback cb);
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_ */
TWiMODLR_DevMgmt_SystemStatus
Basic information about system status of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:208
WiMOD_SAP_DevMgmt::GetAesKey
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::WiMOD_SAP_DevMgmt
WiMOD_SAP_DevMgmt(TWiMODLRHCI *hci, UINT8 *buffer, UINT16 bufferSize)
Constructor.
Definition: WiMOD_SAP_DEVMGMT.cpp:64
WiMOD_SAP_DevMgmt::GetFirmwareInfo
TWiMDLRResultCodes GetFirmwareInfo(TWiMODLR_DevMgmt_FwInfo *info, UINT8 *statusRsp)
GetFirmwareInfo Cmd - Get basic info about the running firmware.
Definition: WiMOD_SAP_DEVMGMT.cpp:185
WiMOD_SAP_DevMgmt::GetSystemStatus
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
WiMOD_SAP_DEVMGMT_IDs.h
Supporting IDs and definitions for the DeviceManagement ServiceAccessPoint.
TWiMDLRResultCodes
TWiMDLRResultCodes
Result codes for the local serial communication itself.
Definition: WiMODLRHCI.h:149
WiMOD_SAP_DevMgmt::GetRtcAlarm
TWiMDLRResultCodes GetRtcAlarm(TWiMODLR_DevMgmt_RtcAlarm *rtcAlarm, UINT8 *statusRsp)
GetRtcAlarm Cmd - Get information about RTC alarm feature.
Definition: WiMOD_SAP_DEVMGMT.cpp:646
WiMOD_SAP_DevMgmt::RegisterPowerUpIndicationClient
void RegisterPowerUpIndicationClient(TDevMgmtPowerUpCallback cb)
Register a callback function for processing a PowerUp Indication message.
Definition: WiMOD_SAP_DEVMGMT.cpp:709
TDevMgmtRtcAlarmCallback
void(* TDevMgmtRtcAlarmCallback)(void)
Definition: WiMOD_SAP_DEVMGMT.h:96
WiMOD_SAP_DevMgmt::SetRadioConfig
TWiMDLRResultCodes SetRadioConfig(const TWiMODLR_DevMgmt_RadioConfig *radioCfg, UINT8 *statusRsp)
SetRadioConfig Cmd - Set the radio settings of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:411
TWiMODLR_HCIMessage
basic low level HCI message structure used for all serial messages to/from WiMOD
Definition: WiMODLRHCI.h:120
TWiMODLRHCI
Internal helper class for processing SLIP frames.
Definition: WiMODLRHCI.h:229
WiMOD_SAP_DevMgmt::RegisterRtcAlarmIndicationClient
void RegisterRtcAlarmIndicationClient(TDevMgmtRtcAlarmCallback cb)
Register a callback function for processing a RTC Alarm Indication message.
Definition: WiMOD_SAP_DEVMGMT.cpp:721
TWiMOD_OperationMode
TWiMOD_OperationMode
This enum describes the possible operation modes of the WiMOD (only for LR-BASE). ...
Definition: WiMOD_SAP_DEVMGMT_IDs.h:410
WiMOD_SAP_DevMgmt
Implementation for the ServiceAccessPoint DeviceManagement.
Definition: WiMOD_SAP_DEVMGMT.h:109
TWiMODLR_DevMgmt_RadioConfig
Structure containing the radio (stack) config parameters of the WiMOD (only for LR-BASE) ...
Definition: WiMOD_SAP_DEVMGMT_IDs.h:376
TWiMODLR_DevMgmt_RtcAlarm
Structure containing the RTC Alarm config parameters of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:452
TWiMODLR_DevMgmt_FwInfo
Basic information about the current firmware of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:194
WiMOD_SAP_DevMgmt::GetOperationMode
TWiMDLRResultCodes GetOperationMode(TWiMOD_OperationMode *opMode, UINT8 *statusRsp)
GetOperationMode Cmd - Get the current operation mode of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:499
WiMOD_SAP_DevMgmt::GetDeviceInfo
TWiMDLRResultCodes GetDeviceInfo(TWiMODLR_DevMgmt_DevInfo *info, UINT8 *statusRsp)
Reset Cmd - Do a reset / reboot of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:144
WiMOD_SAP_DevMgmt::SetOperationMode
TWiMDLRResultCodes SetOperationMode(const TWiMOD_OperationMode opMode, UINT8 *statusRsp)
SetOperationMode Cmd - Set the current operation mode of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:525
WiMOD_SAP_DevMgmt::SetAesKey
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
WiMOD_SAP_DevMgmt::ClearRtcAlarm
TWiMDLRResultCodes ClearRtcAlarm(UINT8 *statusRsp)
GetRtcAlarm Cmd - Clear a pending RTC alarm.
Definition: WiMOD_SAP_DEVMGMT.cpp:684
WiMOD_SAP_DevMgmt::Reset
TWiMDLRResultCodes Reset(UINT8 *statusRsp)
Reset Cmd - Do a reset / reboot of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:118
WiMOD_SAP_DevMgmt::~WiMOD_SAP_DevMgmt
~WiMOD_SAP_DevMgmt(void)
Destructor.
Definition: WiMOD_SAP_DEVMGMT.cpp:77
WiMOD_SAP_DevMgmt::GetRtc
TWiMDLRResultCodes GetRtc(UINT32 *rtcTime, UINT8 *statusRsp)
GetRtc Cmd - Get the current RTC time/date from WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:285
TWiMODLR_DevMgmt_DevInfo
Structure containing basic information about the WiMOD device.
Definition: WiMOD_SAP_DEVMGMT_IDs.h:156
WiMOD_SAP_DevMgmt::Ping
TWiMDLRResultCodes Ping(UINT8 *statusRsp)
Ping Cmd - Checks if the serial connection of to the WiMOD module is OK.
Definition: WiMOD_SAP_DEVMGMT.cpp:91
TDevMgmtPowerUpCallback
void(* TDevMgmtPowerUpCallback)(void)
Definition: WiMOD_SAP_DEVMGMT.h:93
WiMOD_SAP_DevMgmt::SetRtcAlarm
TWiMDLRResultCodes SetRtcAlarm(const TWiMODLR_DevMgmt_RtcAlarm *rtcAlarm, UINT8 *statusRsp)
GetRtcAlarm Cmd - Get information about the RTC alarm event.
Definition: WiMOD_SAP_DEVMGMT.cpp:610
WiMOD_SAP_DevMgmt::GetRadioConfig
TWiMDLRResultCodes GetRadioConfig(TWiMODLR_DevMgmt_RadioConfig *radioCfg, UINT8 *statusRsp)
GetRadioConfig Cmd - Get the radio settings of the WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:351
WiMOD_SAP_DevMgmt::ResetRadioConfig
TWiMDLRResultCodes ResetRadioConfig(UINT8 *statusRsp)
ResetRadioConfig Cmd - Reset the radio config to factory defaults.
Definition: WiMOD_SAP_DEVMGMT.cpp:473
WiMOD_SAP_DevMgmt::SetRtc
TWiMDLRResultCodes SetRtc(const UINT32 rtcTime, UINT8 *statusRsp)
SetRtc Cmd - Set the current RTC time/date of WiMOD.
Definition: WiMOD_SAP_DEVMGMT.cpp:322