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.

45 lines
1.1 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
  1. #ifndef __KERNEL_USB_RELAY_MODULE_HEADER__
  2. #define __KERNEL_USB_RELAY_MODULE_HEADER__
  3. #include "kernelModule.h"
  4. // Configuration
  5. #define CMD_ON 0xff
  6. #define CMD_OFF 0xfd
  7. #define CMD_SET_SERIAL 0xfa
  8. #define Serial_Length 6 // 5+1 for the \0 string terminator
  9. // Struct for relay boards
  10. typedef struct S_relay_board
  11. {
  12. char serial[Serial_Length];
  13. unsigned char relay_count;
  14. unsigned char state;
  15. char * path;
  16. } relay_board;
  17. int enumerate_relay_boards(const char * product, int verbose, int debug);
  18. int operate_relay(const char * path, unsigned char relay, unsigned char state);
  19. int set_serial(const char * path, char * newserial);
  20. relay_board * find_board(const char * serial);
  21. int get_relay_board_count(void);
  22. relay_board * get_relay_boards(void);
  23. void shutdown(void);
  24. class kernelModuleUSBRelay : public kernelModule
  25. {
  26. private:
  27. relay_board m_sBoardDef;
  28. uint32_t m_nNO_CONFIG;
  29. uint32_t m_nCURRENT_STATE;
  30. uint32_t m_aCHANNEL_CONFIGS[32];
  31. public:
  32. explicit kernelModuleUSBRelay(uint32_t ModuleID);
  33. virtual ~kernelModuleUSBRelay();
  34. virtual bool dispatchEvent(EVENT_CONTAINER * Evt);
  35. };
  36. #endif