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
45 lines
1.1 KiB
#ifndef __KERNEL_USB_RELAY_MODULE_HEADER__
|
|
#define __KERNEL_USB_RELAY_MODULE_HEADER__
|
|
|
|
#include "kernelModule.h"
|
|
|
|
// Configuration
|
|
#define CMD_ON 0xff
|
|
#define CMD_OFF 0xfd
|
|
#define CMD_SET_SERIAL 0xfa
|
|
|
|
#define Serial_Length 6 // 5+1 for the \0 string terminator
|
|
|
|
// Struct for relay boards
|
|
typedef struct S_relay_board
|
|
{
|
|
char serial[Serial_Length];
|
|
unsigned char relay_count;
|
|
unsigned char state;
|
|
char * path;
|
|
} relay_board;
|
|
|
|
int enumerate_relay_boards(const char * product, int verbose, int debug);
|
|
int operate_relay(const char * path, unsigned char relay, unsigned char state);
|
|
int set_serial(const char * path, char * newserial);
|
|
relay_board * find_board(const char * serial);
|
|
int get_relay_board_count(void);
|
|
relay_board * get_relay_boards(void);
|
|
void shutdown(void);
|
|
|
|
class kernelModuleUSBRelay : public kernelModule
|
|
{
|
|
private:
|
|
|
|
relay_board m_sBoardDef;
|
|
uint32_t m_nNO_CONFIG;
|
|
uint32_t m_nCURRENT_STATE;
|
|
uint32_t m_aCHANNEL_CONFIGS[32];
|
|
|
|
public:
|
|
|
|
explicit kernelModuleUSBRelay(uint32_t ModuleID);
|
|
virtual ~kernelModuleUSBRelay();
|
|
virtual bool dispatchEvent(EVENT_CONTAINER * Evt);
|
|
};
|
|
#endif
|