mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal] Notifier: simplify ack API (#8457)
Adding an ack parameter to both set and cancel is cleaner than adding all the set alarm parameters to the ack function. It also provides an ack-and-cancel method.
This commit is contained in:
@@ -82,49 +82,45 @@ Java_org_wpilib_hardware_hal_NotifierJNI_destroyNotifier
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_NotifierJNI
|
||||
* Method: setNotifierAlarm
|
||||
* Signature: (IJJZ)V
|
||||
* Signature: (IJJZZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_NotifierJNI_setNotifierAlarm
|
||||
(JNIEnv* env, jclass cls, jint notifierHandle, jlong alarmTime,
|
||||
jlong intervalTime, jboolean absolute)
|
||||
jlong intervalTime, jboolean absolute, jboolean ack)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetNotifierAlarm((HAL_NotifierHandle)notifierHandle,
|
||||
static_cast<uint64_t>(alarmTime),
|
||||
static_cast<uint64_t>(intervalTime), absolute, &status);
|
||||
HAL_SetNotifierAlarm(
|
||||
(HAL_NotifierHandle)notifierHandle, static_cast<uint64_t>(alarmTime),
|
||||
static_cast<uint64_t>(intervalTime), absolute, ack, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_NotifierJNI
|
||||
* Method: cancelNotifierAlarm
|
||||
* Signature: (I)V
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_NotifierJNI_cancelNotifierAlarm
|
||||
(JNIEnv* env, jclass cls, jint notifierHandle)
|
||||
(JNIEnv* env, jclass cls, jint notifierHandle, jboolean ack)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_CancelNotifierAlarm((HAL_NotifierHandle)notifierHandle, &status);
|
||||
HAL_CancelNotifierAlarm((HAL_NotifierHandle)notifierHandle, ack, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_wpilib_hardware_hal_NotifierJNI
|
||||
* Method: acknowledgeNotifierAlarm
|
||||
* Signature: (IZJJZ)V
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_wpilib_hardware_hal_NotifierJNI_acknowledgeNotifierAlarm
|
||||
(JNIEnv* env, jclass cls, jint notifierHandle, jboolean setAlarm,
|
||||
jlong alarmTime, jlong intervalTime, jboolean absolute)
|
||||
(JNIEnv* env, jclass cls, jint notifierHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AcknowledgeNotifierAlarm((HAL_NotifierHandle)notifierHandle, setAlarm,
|
||||
static_cast<uint64_t>(alarmTime),
|
||||
static_cast<uint64_t>(intervalTime), absolute,
|
||||
&status);
|
||||
HAL_AcknowledgeNotifierAlarm((HAL_NotifierHandle)notifierHandle, &status);
|
||||
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user