mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
add keyboard interface (#95)
This commit is contained in:
@@ -25,18 +25,21 @@
|
||||
|
||||
namespace DRIVERS {
|
||||
|
||||
enum type {
|
||||
USB_MOUSE_ABSOLUTE,
|
||||
USB_MOUSE_RELATIVE,
|
||||
USB_MOUSE_ABSOLUTE_WIN98,
|
||||
};
|
||||
enum type {
|
||||
DUMMY = 0,
|
||||
USB_MOUSE_ABSOLUTE,
|
||||
USB_MOUSE_RELATIVE,
|
||||
USB_MOUSE_ABSOLUTE_WIN98,
|
||||
USB_KEYBOARD,
|
||||
PS2_KEYBOARD,
|
||||
};
|
||||
|
||||
class Driver {
|
||||
public:
|
||||
Driver(type _type) : _type(_type) {}
|
||||
uint8_t getType() { return _type; }
|
||||
class Driver {
|
||||
public:
|
||||
Driver(type _type) : _type(_type) {}
|
||||
uint8_t getType() { return _type; }
|
||||
|
||||
private:
|
||||
type _type;
|
||||
};
|
||||
private:
|
||||
type _type;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,9 +26,41 @@
|
||||
|
||||
namespace DRIVERS {
|
||||
|
||||
typedef struct {
|
||||
bool caps;
|
||||
bool scroll;
|
||||
bool num;
|
||||
} KeyboardLedsState;
|
||||
typedef struct {
|
||||
bool caps;
|
||||
bool scroll;
|
||||
bool num;
|
||||
} KeyboardLedsState;
|
||||
|
||||
|
||||
struct Keyboard : public Driver {
|
||||
using Driver::Driver;
|
||||
|
||||
virtual void begin() {}
|
||||
|
||||
/**
|
||||
* Release all keys
|
||||
*/
|
||||
virtual void clear() {}
|
||||
|
||||
/**
|
||||
* Sends key
|
||||
* @param code ???
|
||||
* @param state true pressed, false released
|
||||
*/
|
||||
virtual void sendKey(uint8_t code, bool state) {}
|
||||
|
||||
virtual void periodic() {}
|
||||
|
||||
/**
|
||||
* False if online or unknown. Otherwise true.
|
||||
*/
|
||||
virtual bool isOffline() { return false; }
|
||||
|
||||
virtual KeyboardLedsState getLeds() {
|
||||
KeyboardLedsState result = {};
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace DRIVERS {
|
||||
|
||||
class Mouse : public Driver {
|
||||
using Driver::Driver;
|
||||
};
|
||||
class Mouse : public Driver {
|
||||
using Driver::Driver;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user