44 #include <px4_platform_common/posix.h> 51 int result = PX4_ERROR;
53 tune_control.
tune_id =
static_cast<int>(TuneID::NOTIFY_NEGATIVE);
56 tune_control_s::ORB_QUEUE_LENGTH);
59 PX4_INFO(
"Volume silenced for testing predefined tunes 0-20.");
60 tune_control.
volume = tune_control_s::VOLUME_LEVEL_MIN;
62 for (
size_t i = 0; i <= 20; i++) {
66 if (result != PX4_OK) {
67 PX4_INFO(
"Error publishing TuneID: %d", tune_control.
tune_id);
72 tune_control.
tune_id =
static_cast<int>(TuneID::NOTIFY_POSITIVE);
76 tune_control.
tune_id = atoi(argv[1]);
78 if (tune_control.
tune_id <= 20) {
79 PX4_INFO(
"TuneID: %d", tune_control.
tune_id);
84 int volume = tune_control_s::VOLUME_LEVEL_DEFAULT;
87 PX4_INFO(
"Custom tune.");
90 tune_control.
volume = tune_control_s::VOLUME_LEVEL_DEFAULT;
int test_tone(int argc, char *argv[])
static orb_advert_t tune_control_pub
High-resolution timer with callouts and timekeeping.
orb_advert_t orb_advertise_queue(const struct orb_metadata *meta, const void *data, unsigned int queue_size)
Library for parsing tunes from melody-strings or dedicated tune messages.
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
Driver for the PX4 audio alarm port, /dev/tone_alarm.
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, const void *data)
int orb_unadvertise(orb_advert_t handle)
static tune_control_s tune_control
void set_string(const char *const string, uint8_t volume)
Set tune to be played using a string.