2016-02-17 21:25:41 -04:00
|
|
|
#pragma once
|
2014-11-14 10:14:40 -04:00
|
|
|
|
2015-08-11 03:28:44 -03:00
|
|
|
#include <AP_Common/AP_Common.h>
|
2022-10-20 03:40:41 -03:00
|
|
|
#include "AP_Notify_config.h"
|
2015-02-26 03:07:33 -04:00
|
|
|
|
2015-12-01 16:22:26 -04:00
|
|
|
class AP_Notify;
|
|
|
|
|
2014-11-14 10:14:40 -04:00
|
|
|
class NotifyDevice {
|
|
|
|
public:
|
|
|
|
virtual ~NotifyDevice() {}
|
|
|
|
// init - initialised the device
|
|
|
|
virtual bool init(void) = 0;
|
|
|
|
// update - updates device according to timed_updated. Should be
|
|
|
|
// called at 50Hz
|
|
|
|
virtual void update() = 0;
|
2016-07-22 00:37:25 -03:00
|
|
|
|
2022-10-21 08:48:51 -03:00
|
|
|
#if AP_NOTIFY_MAVLINK_LED_CONTROL_SUPPORT_ENABLED
|
2015-02-26 03:07:33 -04:00
|
|
|
// handle a LED_CONTROL message, by default device ignore message
|
2019-04-30 07:22:48 -03:00
|
|
|
virtual void handle_led_control(const mavlink_message_t &msg) {}
|
2022-10-21 08:48:51 -03:00
|
|
|
#endif
|
2015-12-01 16:22:26 -04:00
|
|
|
|
2019-03-18 23:35:15 -03:00
|
|
|
// play a MML tune
|
|
|
|
virtual void play_tune(const char *tune) {}
|
2019-04-30 07:22:48 -03:00
|
|
|
|
2019-12-09 17:06:35 -04:00
|
|
|
// RGB control
|
|
|
|
// give RGB and flash rate, used with scripting
|
|
|
|
virtual void rgb_control(uint8_t r, uint8_t g, uint8_t b, uint8_t rate_hz) {}
|
|
|
|
|
2020-08-31 17:28:35 -03:00
|
|
|
// RGB control multiple leds independently
|
|
|
|
// give RGB value for single led
|
|
|
|
virtual void rgb_set_id(uint8_t r, uint8_t g, uint8_t b, uint8_t id) {}
|
|
|
|
|
2015-12-01 16:22:26 -04:00
|
|
|
// this pointer is used to read the parameters relative to devices
|
|
|
|
const AP_Notify *pNotify;
|
2014-11-14 10:14:40 -04:00
|
|
|
};
|