demo.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except
  4. in compliance with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2016
  6. All rights reserved.
  7. */
  8. #ifndef _DEMO_H_
  9. #define _DEMO_H_
  10. #include "types.h"
  11. #include "dsi_framer_ant.hpp"
  12. #include "dsi_thread.h"
  13. #include "dsi_serial_generic.hpp"
  14. #define CHANNEL_TYPE_MASTER (0)
  15. #define CHANNEL_TYPE_SLAVE (1)
  16. #define CHANNEL_TYPE_INVALID (2)
  17. class Demo {
  18. public:
  19. Demo();
  20. virtual ~Demo();
  21. BOOL Init(UCHAR ucDeviceNumber_, UCHAR ucChannelType_);
  22. void Start();
  23. void Close();
  24. private:
  25. BOOL InitANT();
  26. //Starts the Message thread.
  27. static DSI_THREAD_RETURN RunMessageThread(void *pvParameter_);
  28. //Listens for a response from the module
  29. void MessageThread();
  30. //Decodes the received message
  31. void ProcessMessage(ANT_MESSAGE stMessage, USHORT usSize_);
  32. // print user menu
  33. void PrintMenu();
  34. BOOL bBursting; //holds whether the bursting phase of the test has started
  35. BOOL bBroadcasting;
  36. BOOL bMyDone;
  37. BOOL bDone;
  38. UCHAR ucChannelType;
  39. DSISerialGeneric* pclSerialObject;
  40. DSIFramerANT* pclMessageObject;
  41. DSI_THREAD_ID uiDSIThread;
  42. DSI_CONDITION_VAR condTestDone;
  43. DSI_MUTEX mutexTestDone;
  44. BOOL bDisplay;
  45. UCHAR aucTransmitBuffer[ANT_STANDARD_DATA_PAYLOAD_SIZE];
  46. // UCHAR pucData[USER_DATA_LENGTH]; //data to transfer in a burst
  47. };
  48. #endif //TEST_H