Bugfix/example-app-uevent-event-parsing (#1221)

* Added Send_UEvent_Notify_Device function for device-specific unconfirmed event notifications.

* Fixed event_notify_parse() loop index to start from zero.

* Added device ID binding support in the UEvent command-line application.

* Fixed the UEvent command-line application help output.

* Fixed initialization of event data in the UEvent command-line application by adding static CharacterString for message text and handling the failure case.
This commit is contained in:
Steve Karg
2026-02-05 13:41:56 -06:00
committed by GitHub
parent edff06a9c0
commit 94e79efead
6 changed files with 193 additions and 17 deletions
+30
View File
@@ -47,3 +47,33 @@ int Send_UEvent_Notify(
return bytes_sent;
}
/**
* @brief Sends an Unconfirmed Alarm/Event Notification.
* @ingroup BIBB-AE-N-A
* @param buffer [in,out] The buffer to build the message in for sending.
* @param data [in] The information about the Event to be sent.
* @param device_id [in] ID of the destination device
* @return Size of the message sent (bytes), or a negative value on error.
*/
int Send_UEvent_Notify_Device(
uint8_t *buffer,
const BACNET_EVENT_NOTIFICATION_DATA *data,
uint32_t device_id)
{
int bytes_sent = 0;
BACNET_ADDRESS dest = { 0 };
unsigned max_apdu = 0;
bool status = false;
uint8_t segmentation = 0;
uint16_t maxsegments = 0;
/* is the device bound? */
status = address_segment_get_by_device(
device_id, &max_apdu, &dest, &segmentation, &maxsegments);
if (status) {
bytes_sent = Send_UEvent_Notify(buffer, data, &dest);
}
return bytes_sent;
}
+6
View File
@@ -31,6 +31,12 @@ int Send_UEvent_Notify(
const BACNET_EVENT_NOTIFICATION_DATA *data,
BACNET_ADDRESS *dest);
BACNET_STACK_EXPORT
int Send_UEvent_Notify_Device(
uint8_t *buffer,
const BACNET_EVENT_NOTIFICATION_DATA *data,
uint32_t device_id);
#ifdef __cplusplus
}
#endif /* __cplusplus */
+1 -1
View File
@@ -3139,7 +3139,7 @@ bool event_notify_parse(
BACNET_PROPERTY_STATES tag = PROP_STATE_BOOLEAN_VALUE;
BACNET_BIT_STRING *pBitString = NULL;
for (argi = 1; argi < argc; argi++) {
for (argi = 0; argi < argc; argi++) {
if (target_args == 1) {
/* process-id */
if (!bacnet_string_to_uint32(