mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Add name to HAL Notifier
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "hal/Notifier.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
#include <wpi/condition_variable.h>
|
||||
#include <wpi/mutex.h>
|
||||
@@ -20,6 +21,7 @@
|
||||
|
||||
namespace {
|
||||
struct Notifier {
|
||||
std::string name;
|
||||
uint64_t waitTime;
|
||||
bool updatedAlarm = false;
|
||||
bool active = true;
|
||||
@@ -71,6 +73,14 @@ HAL_NotifierHandle HAL_InitializeNotifier(int32_t* status) {
|
||||
return handle;
|
||||
}
|
||||
|
||||
void HAL_SetNotifierName(HAL_NotifierHandle notifierHandle, const char* name,
|
||||
int32_t* status) {
|
||||
auto notifier = notifierHandles->Get(notifierHandle);
|
||||
if (!notifier) return;
|
||||
std::scoped_lock lock(notifier->mutex);
|
||||
notifier->name = name;
|
||||
}
|
||||
|
||||
void HAL_StopNotifier(HAL_NotifierHandle notifierHandle, int32_t* status) {
|
||||
auto notifier = notifierHandles->Get(notifierHandle);
|
||||
if (!notifier) return;
|
||||
|
||||
Reference in New Issue
Block a user