Skip to content

Instantly share code, notes, and snippets.

@daniel-bytes
Created January 5, 2014 16:34
Show Gist options
  • Save daniel-bytes/8270371 to your computer and use it in GitHub Desktop.
Save daniel-bytes/8270371 to your computer and use it in GitHub Desktop.
class MonomeDemo
: public SerialOsc::Listener
{
public:
MonomeDemo(SerialOsc *osc)
: osc(osc)
{
osc->start(this);
}
public:
virtual void deviceFound(const MonomeDevice * const device)
{
std::cout << "Found device " << device->id << " (type " << device->type << ")." << std::endl;
osc->sendDeviceLedAllCommand(device, false);
}
virtual void deviceRemoved(const std::string &id)
{
std::cout << "Device " << id << " removed." << std::endl;
}
virtual void buttonPressMessageReceived(MonomeDevice *device, int x, int y, bool state)
{
std::cout << "Button press from " << device->id << " received. Prefix = " << device->prefix << ", x = " << x << ", y = " << y << ", state = " << state << std::endl;
osc->sendDeviceLedCommand(device, x, y, state);
}
private:
SerialOsc *osc;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment