'Last Received Object Identifier' for GetEventInformation service.
This commit is contained in:
@@ -73,6 +73,9 @@ void handler_get_event_information(
|
|||||||
BACNET_GET_EVENT_INFORMATION_DATA getevent_data;
|
BACNET_GET_EVENT_INFORMATION_DATA getevent_data;
|
||||||
int valid_event = 0;
|
int valid_event = 0;
|
||||||
|
|
||||||
|
/* initialize type of 'Last Received Object Identifier' using max value */
|
||||||
|
object_id.type = MAX_BACNET_OBJECT_TYPE;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
@@ -120,6 +123,17 @@ void handler_get_event_information(
|
|||||||
for (j = 0; j < 0xffff; j++) {
|
for (j = 0; j < 0xffff; j++) {
|
||||||
valid_event = Get_Event_Info[i] (j, &getevent_data);
|
valid_event = Get_Event_Info[i] (j, &getevent_data);
|
||||||
if (valid_event > 0) {
|
if (valid_event > 0) {
|
||||||
|
/* encode GetEvent_data only when type of object_id has max value */
|
||||||
|
if (object_id.type != MAX_BACNET_OBJECT_TYPE) {
|
||||||
|
if ((object_id.type == getevent_data.objectIdentifier.type) &&
|
||||||
|
(object_id.instance == getevent_data.objectIdentifier.instance)) {
|
||||||
|
/* found 'Last Received Object Identifier'
|
||||||
|
so should set type of object_id to max value */
|
||||||
|
object_id.type = MAX_BACNET_OBJECT_TYPE;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
getevent_data.next = NULL;
|
getevent_data.next = NULL;
|
||||||
len =
|
len =
|
||||||
getevent_ack_encode_apdu_data(&Handler_Transmit_Buffer
|
getevent_ack_encode_apdu_data(&Handler_Transmit_Buffer
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ typedef struct BACnet_Get_Event_Information_Data {
|
|||||||
} BACNET_GET_EVENT_INFORMATION_DATA;
|
} BACNET_GET_EVENT_INFORMATION_DATA;
|
||||||
|
|
||||||
/* return 0 if no active event at this index
|
/* return 0 if no active event at this index
|
||||||
return -1 if end of list
|
return -1 if end of list
|
||||||
return +1 if active event */
|
return +1 if active event */
|
||||||
typedef int (
|
typedef int (
|
||||||
*get_event_info_function) (
|
*get_event_info_function) (
|
||||||
|
|||||||
Reference in New Issue
Block a user