indented to standard from script
This commit is contained in:
@@ -95,9 +95,9 @@ void Notification_Class_Init(
|
||||
memset(&NC_Info[NotifyIdx], 0x00, sizeof(NOTIFICATION_CLASS_INFO));
|
||||
/* set the basic parameters */
|
||||
NC_Info[NotifyIdx].Ack_Required = 0;
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_OFFNORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_FAULT] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_NORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_OFFNORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_FAULT] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_NORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -189,8 +189,8 @@ int Notification_Class_Read_Property(
|
||||
|
||||
apdu = rpdata->application_data;
|
||||
CurrentNotify =
|
||||
&NC_Info[Notification_Class_Instance_To_Index(rpdata->
|
||||
object_instance)];
|
||||
&NC_Info[Notification_Class_Instance_To_Index
|
||||
(rpdata->object_instance)];
|
||||
|
||||
switch (rpdata->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
@@ -400,8 +400,8 @@ bool Notification_Class_Write_Property(
|
||||
|
||||
|
||||
CurrentNotify =
|
||||
&NC_Info[Notification_Class_Instance_To_Index(wp_data->
|
||||
object_instance)];
|
||||
&NC_Info[Notification_Class_Instance_To_Index
|
||||
(wp_data->object_instance)];
|
||||
|
||||
/* decode the some of the request
|
||||
*/
|
||||
@@ -455,9 +455,8 @@ bool Notification_Class_Write_Property(
|
||||
while (iOffset < wp_data->application_data_len) {
|
||||
/* Decode Valid Days */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset], wp_data->application_data_len,
|
||||
&value);
|
||||
bacapp_decode_application_data(&wp_data->application_data
|
||||
[iOffset], wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) ||
|
||||
(value.tag != BACNET_APPLICATION_TAG_BIT_STRING)) {
|
||||
@@ -480,9 +479,8 @@ bool Notification_Class_Write_Property(
|
||||
iOffset += len;
|
||||
/* Decode From Time */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset], wp_data->application_data_len,
|
||||
&value);
|
||||
bacapp_decode_application_data(&wp_data->application_data
|
||||
[iOffset], wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) || (value.tag != BACNET_APPLICATION_TAG_TIME)) {
|
||||
/* Bad decode, wrong tag or following required parameter missing */
|
||||
@@ -496,9 +494,8 @@ bool Notification_Class_Write_Property(
|
||||
iOffset += len;
|
||||
/* Decode To Time */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset], wp_data->application_data_len,
|
||||
&value);
|
||||
bacapp_decode_application_data(&wp_data->application_data
|
||||
[iOffset], wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) || (value.tag != BACNET_APPLICATION_TAG_TIME)) {
|
||||
/* Bad decode, wrong tag or following required parameter missing */
|
||||
@@ -517,9 +514,8 @@ bool Notification_Class_Write_Property(
|
||||
RECIPIENT_TYPE_DEVICE;
|
||||
/* Decode Network Number */
|
||||
len =
|
||||
bacapp_decode_context_data(&wp_data->
|
||||
application_data[iOffset],
|
||||
wp_data->application_data_len, &value,
|
||||
bacapp_decode_context_data(&wp_data->application_data
|
||||
[iOffset], wp_data->application_data_len, &value,
|
||||
PROP_RECIPIENT_LIST);
|
||||
|
||||
if ((len == 0) ||
|
||||
@@ -530,21 +526,21 @@ bool Notification_Class_Write_Property(
|
||||
return false;
|
||||
}
|
||||
/* store value */
|
||||
TmpNotify.Recipient_List[idx].Recipient._.
|
||||
DeviceIdentifier = value.type.Object_Id.instance;
|
||||
TmpNotify.Recipient_List[idx].Recipient.
|
||||
_.DeviceIdentifier = value.type.Object_Id.instance;
|
||||
|
||||
iOffset += len;
|
||||
}
|
||||
/* opening tag [1] - Recipient */
|
||||
else if (decode_is_opening_tag_number(&wp_data->
|
||||
application_data[iOffset], 1)) {
|
||||
else if (decode_is_opening_tag_number
|
||||
(&wp_data->application_data[iOffset], 1)) {
|
||||
iOffset++;
|
||||
TmpNotify.Recipient_List[idx].Recipient.RecipientType =
|
||||
RECIPIENT_TYPE_ADDRESS;
|
||||
/* Decode Network Number */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset],
|
||||
bacapp_decode_application_data
|
||||
(&wp_data->application_data[iOffset],
|
||||
wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) ||
|
||||
@@ -561,8 +557,8 @@ bool Notification_Class_Write_Property(
|
||||
iOffset += len;
|
||||
/* Decode Address */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset],
|
||||
bacapp_decode_application_data
|
||||
(&wp_data->application_data[iOffset],
|
||||
wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) ||
|
||||
@@ -573,16 +569,16 @@ bool Notification_Class_Write_Property(
|
||||
return false;
|
||||
}
|
||||
/* store value */
|
||||
if (TmpNotify.Recipient_List[idx].Recipient._.Address.
|
||||
net == 0) {
|
||||
memcpy(TmpNotify.Recipient_List[idx].Recipient._.
|
||||
Address.mac, value.type.Octet_String.value,
|
||||
if (TmpNotify.Recipient_List[idx].Recipient._.
|
||||
Address.net == 0) {
|
||||
memcpy(TmpNotify.Recipient_List[idx].Recipient.
|
||||
_.Address.mac, value.type.Octet_String.value,
|
||||
value.type.Octet_String.length);
|
||||
TmpNotify.Recipient_List[idx].Recipient._.Address.
|
||||
mac_len = value.type.Octet_String.length;
|
||||
TmpNotify.Recipient_List[idx].Recipient._.
|
||||
Address.mac_len = value.type.Octet_String.length;
|
||||
} else {
|
||||
memcpy(TmpNotify.Recipient_List[idx].Recipient._.
|
||||
Address.adr, value.type.Octet_String.value,
|
||||
memcpy(TmpNotify.Recipient_List[idx].Recipient.
|
||||
_.Address.adr, value.type.Octet_String.value,
|
||||
value.type.Octet_String.length);
|
||||
TmpNotify.Recipient_List[idx].Recipient._.Address.len =
|
||||
value.type.Octet_String.length;
|
||||
@@ -590,8 +586,8 @@ bool Notification_Class_Write_Property(
|
||||
|
||||
iOffset += len;
|
||||
/* closing tag [1] - Recipient */
|
||||
if (decode_is_closing_tag_number(&wp_data->
|
||||
application_data[iOffset], 1))
|
||||
if (decode_is_closing_tag_number(&wp_data->application_data
|
||||
[iOffset], 1))
|
||||
iOffset++;
|
||||
else {
|
||||
/* Bad decode, wrong tag or following required parameter missing */
|
||||
@@ -608,9 +604,8 @@ bool Notification_Class_Write_Property(
|
||||
|
||||
/* Process Identifier */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset], wp_data->application_data_len,
|
||||
&value);
|
||||
bacapp_decode_application_data(&wp_data->application_data
|
||||
[iOffset], wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) ||
|
||||
(value.tag != BACNET_APPLICATION_TAG_UNSIGNED_INT)) {
|
||||
@@ -626,9 +621,8 @@ bool Notification_Class_Write_Property(
|
||||
iOffset += len;
|
||||
/* Issue Confirmed Notifications */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset], wp_data->application_data_len,
|
||||
&value);
|
||||
bacapp_decode_application_data(&wp_data->application_data
|
||||
[iOffset], wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) ||
|
||||
(value.tag != BACNET_APPLICATION_TAG_BOOLEAN)) {
|
||||
@@ -644,9 +638,8 @@ bool Notification_Class_Write_Property(
|
||||
iOffset += len;
|
||||
/* Transitions */
|
||||
len =
|
||||
bacapp_decode_application_data(&wp_data->
|
||||
application_data[iOffset], wp_data->application_data_len,
|
||||
&value);
|
||||
bacapp_decode_application_data(&wp_data->application_data
|
||||
[iOffset], wp_data->application_data_len, &value);
|
||||
|
||||
if ((len == 0) ||
|
||||
(value.tag != BACNET_APPLICATION_TAG_BIT_STRING)) {
|
||||
@@ -687,16 +680,16 @@ bool Notification_Class_Write_Property(
|
||||
CurrentNotify->Recipient_List[idx] =
|
||||
TmpNotify.Recipient_List[idx];
|
||||
|
||||
if (CurrentNotify->Recipient_List[idx].Recipient.
|
||||
RecipientType == RECIPIENT_TYPE_DEVICE) {
|
||||
if (CurrentNotify->Recipient_List[idx].
|
||||
Recipient.RecipientType == RECIPIENT_TYPE_DEVICE) {
|
||||
/* copy Device_ID */
|
||||
DeviceID =
|
||||
CurrentNotify->Recipient_List[idx].Recipient._.
|
||||
DeviceIdentifier;
|
||||
CurrentNotify->Recipient_List[idx].Recipient.
|
||||
_.DeviceIdentifier;
|
||||
address_bind_request(DeviceID, &max_apdu, &src);
|
||||
|
||||
} else if (CurrentNotify->Recipient_List[idx].Recipient.
|
||||
RecipientType == RECIPIENT_TYPE_ADDRESS) {
|
||||
} else if (CurrentNotify->Recipient_List[idx].
|
||||
Recipient.RecipientType == RECIPIENT_TYPE_ADDRESS) {
|
||||
/* copy Address */
|
||||
/* src = CurrentNotify->Recipient_List[idx].Recipient._.Address; */
|
||||
/* address_bind_request(BACNET_MAX_INSTANCE, &max_apdu, &src); */
|
||||
@@ -816,17 +809,19 @@ void Notification_Class_common_reporting_function(
|
||||
/* Priority and AckRequired */
|
||||
switch (event_data->toState) {
|
||||
case EVENT_STATE_NORMAL:
|
||||
event_data->priority = CurrentNotify->Priority[TRANSITION_TO_NORMAL];
|
||||
event_data->priority =
|
||||
CurrentNotify->Priority[TRANSITION_TO_NORMAL];
|
||||
event_data->ackRequired =
|
||||
(CurrentNotify->
|
||||
Ack_Required & TRANSITION_TO_NORMAL_MASKED) ? true : false;
|
||||
(CurrentNotify->Ack_Required & TRANSITION_TO_NORMAL_MASKED) ?
|
||||
true : false;
|
||||
break;
|
||||
|
||||
case EVENT_STATE_FAULT:
|
||||
event_data->priority = CurrentNotify->Priority[TRANSITION_TO_FAULT];
|
||||
event_data->priority =
|
||||
CurrentNotify->Priority[TRANSITION_TO_FAULT];
|
||||
event_data->ackRequired =
|
||||
(CurrentNotify->
|
||||
Ack_Required & TRANSITION_TO_FAULT_MASKED) ? true : false;
|
||||
(CurrentNotify->Ack_Required & TRANSITION_TO_FAULT_MASKED) ?
|
||||
true : false;
|
||||
break;
|
||||
|
||||
case EVENT_STATE_OFFNORMAL:
|
||||
@@ -835,8 +830,8 @@ void Notification_Class_common_reporting_function(
|
||||
event_data->priority =
|
||||
CurrentNotify->Priority[TRANSITION_TO_OFFNORMAL];
|
||||
event_data->ackRequired =
|
||||
(CurrentNotify->
|
||||
Ack_Required & TRANSITION_TO_OFFNORMAL_MASKED) ? true : false;
|
||||
(CurrentNotify->Ack_Required & TRANSITION_TO_OFFNORMAL_MASKED)
|
||||
? true : false;
|
||||
break;
|
||||
|
||||
default: /* shouldn't happen */
|
||||
@@ -911,13 +906,13 @@ void Notification_Class_find_recipient(
|
||||
RECIPIENT_TYPE_DEVICE) {
|
||||
/* Device ID */
|
||||
DeviceID =
|
||||
CurrentNotify->Recipient_List[idx].Recipient._.
|
||||
DeviceIdentifier;
|
||||
CurrentNotify->Recipient_List[idx].Recipient.
|
||||
_.DeviceIdentifier;
|
||||
/* Send who_ is request only when address of device is unknown. */
|
||||
if (!address_bind_request(DeviceID, &max_apdu, &src))
|
||||
Send_WhoIs(DeviceID, DeviceID);
|
||||
} else if (CurrentNotify->Recipient_List[idx].Recipient.
|
||||
RecipientType == RECIPIENT_TYPE_ADDRESS) {
|
||||
} else if (CurrentNotify->Recipient_List[idx].
|
||||
Recipient.RecipientType == RECIPIENT_TYPE_ADDRESS) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user