Demo HCI Implementation for WiMOD-LR Devices  V1.3.1
WiMODLR_TEST.h
1 /*
2  * WiMODLR_TEST.h
3  *
4  * Created on: Jan 4, 2017
5  * Author: tux
6  */
7 
8 #ifndef ARDUINO_HWTEST_WIMODLR_TEST_H_
9 #define ARDUINO_HWTEST_WIMODLR_TEST_H_
10 
12 
13 #include <WiMODLR_BASE.h>
14 #include "HwTest/WiMOD_SAP_PTS.h"
15 #include "utils/FreqCalc.h"
16 
17 //-----------------------------------------------------------------------------
18 // common defines
19 //-----------------------------------------------------------------------------
21 #define WIMOD_LR_TEST_SERIAL_BAUDRATE 115200
22 
23 #define WiMOD_LR_TEST_TX_BUFFER_SIZE 100
24 
25 //-----------------------------------------------------------------------------
26 // API class declaration for the WiMOD LR TEST Stack
27 //
28 //-----------------------------------------------------------------------------
29 
30 class WiMODLRTEST : public TWiMODLRHCI {
31 public:
32  WiMODLRTEST(Stream& s);
33  ~WiMODLRTEST(void);
34 
35  void begin(void);
36  void end(void);
37 
38  bool Ping(TWiMDLRResultCodes* hciResult = NULL, UINT8* rspStatus = NULL);
39 
40  bool SetProductionMode(TWiMDLRResultCodes* hciResult = NULL, UINT8* rspStatus = NULL);
41  bool SetApplicationMode(TWiMDLRResultCodes* hciResult = NULL, UINT8* rspStatus = NULL);
42  bool SetTestMode(TWiMDLRResultCodes* hciResult = NULL, UINT8* rspStatus = NULL);
43 
44  bool SetDigitalOutput(UINT8* msg, UINT8 msgLen, TWiMDLRResultCodes* hciResult = NULL, UINT8* rspStatus = NULL);
45  bool SetRadioTestMode(const TWiMODTEST_PTS_TestConfig* testCfg, TWiMDLRResultCodes* hciResult = NULL, UINT8* rspStatus = NULL);
46 
47  void calcFreqToRegister(uint32_t freq, uint8_t* msb, uint8_t* mid, uint8_t* lsb);
48  uint32_t calcRegisterToFreq(uint8_t msb, uint8_t mid, uint8_t lsb);
49 
50  TWiMDLRResultCodes GetLastHciResult(void);
51  UINT8 GetLastResponseStatus(void);
52 
53 protected:
54 
55  bool copyResultInfos(TWiMDLRResultCodes* hciResult, UINT8* rspStatus, UINT8 successValue);
56  virtual void ProcessUnexpectedRxMessage(TWiMODLR_HCIMessage& rxMsg);
57 
58 
59  WiMOD_SAP_DevMgmt SapDevMgmt;
60 // WiMOD_SAP_RadioLink SapRadioLink; /*!< Service Access Point for 'RadioLink' */
61  WiMOD_SAP_PTS SapPTS;
62 
63 private:
64  UINT8 txBuffer[WiMOD_LR_BASE_TX_BUFFER_SIZE];
65 
66  UINT8 localStatusRsp;
67  bool cmdResult;
68 
69  TWiMDLRResultCodes localHciRes;
70 
71  TWiMDLRResultCodes lastHciRes;
72  UINT8 lastStatusRsp;
73 
74 };
75 
77 #endif /* ARDUINO_HWTEST_WIMODLR_TEST_H_ */
TWiMDLRResultCodes
Result codes for the local serial communication itself.
Definition: WiMODLRHCI.h:149
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
Implementation for the ServiceAccessPoint DeviceManagement.
Definition: WiMOD_SAP_DEVMGMT.h:109
virtual void end(void)
shutdown function
Definition: WiMODLRHCI.cpp:98
Declarations for the High-level Interface for WiMOD LR-Base firmware.
virtual void begin(void)
Init function of the generic HCI message handler.
Definition: WiMODLRHCI.cpp:83