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.

39 lines
1.3 KiB

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. char serial[Serial_Length];
  12. unsigned char relay_count;
  13. unsigned char state;
  14. char *path;
  15. } relay_board;
  16. int enumerate_relay_boards( const char *product, int verbose, int debug);
  17. int operate_relay( const char *path,unsigned char relay, unsigned char state);
  18. int set_serial( const char *path,char *newserial);
  19. relay_board *find_board( const char *serial);
  20. int get_relay_board_count( void);
  21. relay_board* get_relay_boards(void);
  22. void shutdown(void);
  23. class kernelModuleUSBRelay: public kernelModule {
  24. private:
  25. relay_board m_sBoardDef;
  26. uint32_t m_nNO_CONFIG;
  27. uint32_t m_nCURRENT_STATE;
  28. uint32_t m_aCHANNEL_CONFIGS[32];
  29. public:
  30. explicit kernelModuleUSBRelay( uint32_t ModuleID );
  31. virtual ~kernelModuleUSBRelay();
  32. virtual bool dispatchEvent( EVENT_CONTAINER *Evt );
  33. };
  34. #endif