Add support for multiple light bars/remotes (#3), bump to version 0.2

This commit is contained in:
Erik Borowski
2024-12-01 02:47:01 +01:00
parent a0b246aae1
commit 8901d409ca
12 changed files with 658 additions and 243 deletions

34
remote.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef REMOTE_H
#define REMOTE_H
#include "constants.h"
#include "radio.h"
class Radio;
class Remote
{
public:
Remote(Radio *radio, uint32_t serial, const char *name);
~Remote();
uint32_t getSerial();
String getSerialString();
const char *getName();
bool registerCommandListener(std::function<void(Remote *, byte, byte)> callback);
bool unregisterCommandListener(std::function<void(Remote *, byte, byte)> callback);
void callback(byte command, byte options);
private:
Radio *radio;
uint32_t serial;
const char *name;
String serialString;
std::function<void(Remote *, byte, byte)> commandListeners[constants::MAX_COMMAND_LISTENERS];
uint8_t numCommandListeners = 0;
};
#endif