dsi_debug.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 DSIDEBUG_H_
  9. #define DSIDEBUG_H_
  10. // Debug configuration
  11. //#define DEBUG_FILE
  12. //#define DEBUG_VERBOSE // Creates big debug file!
  13. //#define DEBUG_RX
  14. #if defined(DEBUG_FILE)
  15. #include "types.h"
  16. #define DSI_DEBUG_MAX_STRLEN ((USHORT)1088) //Max size of ANT message is 255, each byte is 4 printed chars, plus 68 additional room for timestamps and header label (a larger number probably indicates garbage in serialWrite())
  17. class DSIDebug
  18. {
  19. public:
  20. static BOOL Init();
  21. static void Close();
  22. static BOOL ThreadInit(const char* pucName_);
  23. static BOOL ThreadWrite(const char* pcMessage_);
  24. ///////////////////////////////////////////
  25. // Note: ThreadPrintf performs an extra string copy,
  26. // so use ThreadWrite when not using formated strings
  27. ///////////////////////////////////////////
  28. static BOOL ThreadPrintf(const char* pcMessage_, ...);
  29. static BOOL ThreadEnable(BOOL bEnable_);
  30. static BOOL SerialWrite(UCHAR ucPortNum_, const char* pcHeader_, UCHAR* pucData_, USHORT usSize_);
  31. static BOOL SerialEnable(UCHAR ucPortNum_, BOOL bEnable_);
  32. static BOOL ResetTime();
  33. static BOOL SetDirectory(const char* pcDirectory_ = "");
  34. static void SetDebug(BOOL bDebugOn_);
  35. private:
  36. static BOOL bInitialized;
  37. };
  38. #endif /* DEBUG_FILE */
  39. #endif /* DSIDEBUG_H_ */