mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal] Add method to detect if the CAN Stream has overflowed (#6105)
This commit is contained in:
@@ -151,7 +151,8 @@ Java_edu_wpi_first_hal_can_CANJNI_readCANStreamSession
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!CheckStatus(env, status)) {
|
||||
if (status != HAL_ERR_CANSessionMux_SessionOverrun &&
|
||||
!CheckStatus(env, status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -181,6 +182,12 @@ Java_edu_wpi_first_hal_can_CANJNI_readCANStreamSession
|
||||
reinterpret_cast<jbyte*>(msg->data));
|
||||
}
|
||||
|
||||
if (status == HAL_ERR_CANSessionMux_SessionOverrun) {
|
||||
ThrowCANStreamOverflowException(env, messages,
|
||||
static_cast<jint>(messagesRead));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return static_cast<jint>(messagesRead);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user