You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.3 KiB

7 years ago
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
7 years ago
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
7 years ago
​
​
​
  1. #ifndef __PROTOCOL_MASTBAUM_HEADER__
  2. #define __PROTOCOL_MASTBAUM_HEADER__
  3. #include "protocol.h"
  4. #include "../../components/base/basicTransport.h"
  5. //#define AMIR_MODE
  6. #define MASTBAUM_TAG_PROTO "MASTBAUM_PROTO"
  7. #define MASTBAUM_TAG_COM_PORT "COM_PORT"
  8. #define MASTBAUM_TAG_COM_SPEED "COM_SPEED"
  9. #define MASTBAUM_PACKAGE_START_TAG 0xAA
  10. #define MASTBAUM_MASTER_TAG 0xC0
  11. typedef enum E_MASTBAUM_COMMANDS {
  12. M_CMD_NONE = 0,
  13. M_CMD_GET_STATUS = 1,
  14. M_CMD_ARM_ON = 2,
  15. M_CMD_ARM_OFF = 3,
  16. M_CMD_SOFT_RESET = 4,
  17. M_CMD_FULL_RESET = 5,
  18. M_CMD_GET_SETTINGS = 6,
  19. M_CMD_SET_SETTINGS = 7,
  20. M_CMD_TST_ALARM = 8,
  21. M_CMD_CLR_ALARM = 9,
  22. M_CMD_GET_TARGETS = 10,
  23. M_CMD_ERROR = 255
  24. } MASTBAUM_COMMANDS;
  25. typedef enum E_MASTBAUM_TARGET_TYPES{
  26. M_TARGET_NONE = 0,
  27. M_TARGET_SINGLE = 1,
  28. M_TARGET_DOUBLE = 2,
  29. M_TARGET_TRIPLE = 3
  30. } MASTBAUM_TARGET_TYPES;
  31. //https://www.ebay.com/itm/Lenovo-ThinkPad-X31-1-4GHz-Mainboard-Motherboard-27R1892-3870/263221188908?_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D20160727114228%26meid%3Dfddf3ad4eb5f4211a98c6d3d770e0d2d%26pid%3D100290%26rk%3D1%26rkt%3D4%26sd%3D263221188908%26itm%3D263221188908&_trksid=p2060778.c100290.m3507
  32. class Kernel;
  33. class protocolMastBaum: public protocolParser {
  34. private:
  35. basicLogCollection * m_pLog;
  36. protected:
  37. basicTransport * m_pDataTransport;
  38. uint8_t m_bDeviceID;
  39. virtual int packetChecker(U8 *Buffer, size_t BufferSize);
  40. virtual protocolPackage * packetExtractor(U8 *Buffer, size_t BufferSize);
  41. virtual bool packetHandler(protocolPackage *Package);
  42. bool completePackage( U8 *Buffer, size_t BufferSize );
  43. Kernel * m_pKernel;
  44. public:
  45. explicit protocolMastBaum( config_setting_t *Settings = NULL );
  46. virtual ~protocolMastBaum();
  47. virtual bool create( void );
  48. bool requestSettings( void );
  49. bool requestStatus( void );
  50. bool requestTargets( void );
  51. //bool sendACK( bool takeMasterBack );
  52. bool sendFullReset( void );
  53. bool sendSoftReset( void );
  54. void attachKernel( Kernel * ptr ){ m_pKernel = ptr; };
  55. bool sendMode( bool mode );
  56. bool sendSettings( uint8_t sst, uint16_t offset, float layer_2_layer = 0, float min_speed = 0 );
  57. bool sendLED( bool mode );
  58. };
  59. #endif