Add support for multiple light bars/remotes (#3), bump to version 0.2
This commit is contained in:
34
remote.h
Normal file
34
remote.h
Normal 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
|
Reference in New Issue
Block a user