Files
firmware/src/input/InputBroker.h

41 lines
1.1 KiB
C
Raw Normal View History

2022-01-11 16:02:55 +01:00
#pragma once
#include "Observer.h"
#define ANYKEY 0xFF
2022-10-06 16:00:33 +02:00
#define MATRIXKEY 0xFE
2024-09-05 22:32:24 -04:00
#define INPUT_BROKER_MSG_BRIGHTNESS_UP 0x11
#define INPUT_BROKER_MSG_BRIGHTNESS_DOWN 0x12
#define INPUT_BROKER_MSG_REBOOT 0x90
#define INPUT_BROKER_MSG_SHUTDOWN 0x9b
#define INPUT_BROKER_MSG_GPS_TOGGLE 0x9e
#define INPUT_BROKER_MSG_MUTE_TOGGLE 0xac
#define INPUT_BROKER_MSG_SEND_PING 0xaf
#define INPUT_BROKER_MSG_LEFT 0xb4
#define INPUT_BROKER_MSG_UP 0xb5
#define INPUT_BROKER_MSG_DOWN 0xb6
#define INPUT_BROKER_MSG_RIGHT 0xb7
#define INPUT_BROKER_MSG_FN_SYMBOL_ON 0xf1
#define INPUT_BROKER_MSG_FN_SYMBOL_OFF 0xf2
2022-01-12 09:26:42 +01:00
typedef struct _InputEvent {
2023-01-21 14:34:29 +01:00
const char *source;
2022-01-12 09:26:42 +01:00
char inputEvent;
char kbchar;
uint16_t touchX;
uint16_t touchY;
2022-01-12 09:26:42 +01:00
} InputEvent;
2023-01-21 14:34:29 +01:00
class InputBroker : public Observable<const InputEvent *>
2022-01-11 16:02:55 +01:00
{
CallbackObserver<InputBroker, const InputEvent *> inputEventObserver =
CallbackObserver<InputBroker, const InputEvent *>(this, &InputBroker::handleInputEvent);
public:
InputBroker();
2022-01-13 14:06:10 +01:00
void registerSource(Observable<const InputEvent *> *source);
2022-01-11 16:02:55 +01:00
protected:
int handleInputEvent(const InputEvent *event);
};
extern InputBroker *inputBroker;