Converted comments to C style using convert.sh script.
This commit is contained in:
@@ -97,7 +97,7 @@ void handler_write_property_multiple(
|
|||||||
decode_len = 0;
|
decode_len = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// decode Object Identifier
|
/* decode Object Identifier
|
||||||
*/
|
*/
|
||||||
len = wpm_decode_object_id(&service_request[decode_len],
|
len = wpm_decode_object_id(&service_request[decode_len],
|
||||||
service_len - decode_len, &wp_data);
|
service_len - decode_len, &wp_data);
|
||||||
@@ -105,13 +105,13 @@ void handler_write_property_multiple(
|
|||||||
{
|
{
|
||||||
uint8_t tag_number = 0;
|
uint8_t tag_number = 0;
|
||||||
|
|
||||||
// Opening tag 1 - List of Properties
|
decode_len += len;
|
||||||
/* Opening tag 1 - List of Properties
|
/* Opening tag 1 - List of Properties
|
||||||
*/
|
*/
|
||||||
if (decode_is_opening_tag_number(&service_request[decode_len++], 1))
|
if (decode_is_opening_tag_number(&service_request[decode_len++], 1))
|
||||||
{
|
{
|
||||||
// decode a 'Property Identifier'; (3) an optional 'Property Array Index';
|
do
|
||||||
// (4) a 'Property Value'; and (5) an optional 'Priority'.
|
{
|
||||||
/* decode a 'Property Identifier'; (3) an optional 'Property Array Index';
|
/* decode a 'Property Identifier'; (3) an optional 'Property Array Index';
|
||||||
*/
|
*/
|
||||||
/* (4) a 'Property Value'; and (5) an optional 'Priority'.
|
/* (4) a 'Property Value'; and (5) an optional 'Priority'.
|
||||||
@@ -120,7 +120,7 @@ void handler_write_property_multiple(
|
|||||||
service_len - decode_len, &wp_data);
|
service_len - decode_len, &wp_data);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
break; // do while (decoding List of Properties)
|
decode_len += len;
|
||||||
if (Device_Write_Property(&wp_data) == false)
|
if (Device_Write_Property(&wp_data) == false)
|
||||||
{
|
{
|
||||||
error = true;
|
error = true;
|
||||||
@@ -131,23 +131,23 @@ void handler_write_property_multiple(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
break; // do while (decoding List of Properties)
|
fprintf(stderr, "Bad Encoding!\n");
|
||||||
#endif
|
#endif
|
||||||
wp_data.error_class = ERROR_CLASS_PROPERTY;
|
wp_data.error_class = ERROR_CLASS_PROPERTY;
|
||||||
// Closing tag 1 - List of Properties
|
wp_data.error_code = ERROR_CODE_OTHER;
|
||||||
error = true;
|
error = true;
|
||||||
break; /* do while (decoding List of Properties)
|
break; /* do while (decoding List of Properties)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Closing tag 1 - List of Properties
|
/* Closing tag 1 - List of Properties
|
||||||
tag_number = 0; // it was not tag 1, decode next Property Identifier ...
|
*/
|
||||||
if (decode_is_closing_tag_number(&service_request[decode_len], 1))
|
if (decode_is_closing_tag_number(&service_request[decode_len], 1))
|
||||||
{
|
{
|
||||||
while(tag_number != 1); // end decoding List of Properties for "that" object
|
tag_number = 1;
|
||||||
decode_len++;
|
decode_len++;
|
||||||
}
|
}
|
||||||
break; //do while (decode service request)
|
else
|
||||||
tag_number = 0; /* it was not tag 1, decode next Property Identifier ...
|
tag_number = 0; /* it was not tag 1, decode next Property Identifier ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ void handler_write_property_multiple(
|
|||||||
if (error)
|
if (error)
|
||||||
break; /*do while (decode service request)
|
break; /*do while (decode service request)
|
||||||
*/
|
*/
|
||||||
break; //do while (decode service request)
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ int Analog_Value_Read_Property(
|
|||||||
bitstring_set_bit(&bit_string, TRANSITION_TO_FAULT, true);
|
bitstring_set_bit(&bit_string, TRANSITION_TO_FAULT, true);
|
||||||
bitstring_set_bit(&bit_string, TRANSITION_TO_NORMAL, true);
|
bitstring_set_bit(&bit_string, TRANSITION_TO_NORMAL, true);
|
||||||
|
|
||||||
/// Fixme: finish it
|
/*/ Fixme: finish it */
|
||||||
|
|
||||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -104,31 +104,31 @@ void Notification_Class_Init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* init with special values for tests */
|
/* init with special values for tests */
|
||||||
// NC_Info[0].Ack_Required = TRANSITION_TO_NORMAL_MASKED;
|
/* NC_Info[0].Ack_Required = TRANSITION_TO_NORMAL_MASKED;
|
||||||
// NC_Info[0].Priority[0] = 248;
|
*/
|
||||||
// NC_Info[0].Priority[1] = 192;
|
/* NC_Info[0].Priority[0] = 248;
|
||||||
// NC_Info[0].Priority[2] = 200;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].ValidDays = 0x1F; /* from monday to friday */
|
/* NC_Info[0].Priority[1] = 192;
|
||||||
// NC_Info[0].Recipient_List[0].FromTime.hour = 6;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].FromTime.min = 15;
|
/* NC_Info[0].Priority[2] = 200;
|
||||||
// NC_Info[0].Recipient_List[0].FromTime.sec = 10;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].FromTime.hundredths = 0;
|
/* NC_Info[0].Recipient_List[0].ValidDays = 0x1F; /* from monday to friday */
|
||||||
// NC_Info[0].Recipient_List[0].ToTime.hour = 23;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].ToTime.min = 48;
|
/* NC_Info[0].Recipient_List[0].FromTime.hour = 6;
|
||||||
// NC_Info[0].Recipient_List[0].ToTime.sec = 59;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].ToTime.hundredths = 0;
|
/* NC_Info[0].Recipient_List[0].FromTime.min = 15;
|
||||||
// NC_Info[0].Recipient_List[0].Recipient.RecipientType = RECIPIENT_TYPE_ADDRESS;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].Recipient._.Address.mac[0] = 0xC0;
|
/* NC_Info[0].Recipient_List[0].FromTime.sec = 10;
|
||||||
// NC_Info[0].Recipient_List[0].Recipient._.Address.mac[1] = 0xA8;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].Recipient._.Address.mac[2] = 0x01;
|
/* NC_Info[0].Recipient_List[0].FromTime.hundredths = 0;
|
||||||
// NC_Info[0].Recipient_List[0].Recipient._.Address.mac[3] = 0xFF;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].Recipient._.Address.mac[4] = 0xBA;
|
/* NC_Info[0].Recipient_List[0].ToTime.hour = 23;
|
||||||
// NC_Info[0].Recipient_List[0].Recipient._.Address.mac[5] = 0xC0;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].Recipient._.Address.mac_len = 6;
|
/* NC_Info[0].Recipient_List[0].ToTime.min = 48;
|
||||||
// NC_Info[0].Recipient_List[0].ProcessIdentifier = 112233;
|
*/
|
||||||
// NC_Info[0].Recipient_List[0].ConfirmedNotify = true;
|
/* NC_Info[0].Recipient_List[0].ToTime.sec = 59;
|
||||||
// NC_Info[0].Recipient_List[0].Transitions =
|
*/
|
||||||
// TRANSITION_TO_OFFNORMAL_MASKED | TRANSITION_TO_NORMAL_MASKED;
|
/* NC_Info[0].Recipient_List[0].ToTime.hundredths = 0;
|
||||||
*/
|
*/
|
||||||
/* NC_Info[0].Recipient_List[0].Recipient.RecipientType = RECIPIENT_TYPE_ADDRESS;
|
/* NC_Info[0].Recipient_List[0].Recipient.RecipientType = RECIPIENT_TYPE_ADDRESS;
|
||||||
*/
|
*/
|
||||||
@@ -422,7 +422,7 @@ bool Notification_Class_Write_Property(
|
|||||||
/* only array properties can have array options */
|
/* only array properties can have array options */
|
||||||
if ((apdu_len >= 0) && (rpdata->object_property != PROP_PRIORITY) &&
|
if ((apdu_len >= 0) && (rpdata->object_property != PROP_PRIORITY) &&
|
||||||
(rpdata->array_index != BACNET_ARRAY_ALL))
|
(rpdata->array_index != BACNET_ARRAY_ALL))
|
||||||
// decode the some of the request
|
{
|
||||||
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
||||||
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
|
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
|
||||||
apdu_len = BACNET_STATUS_ERROR;
|
apdu_len = BACNET_STATUS_ERROR;
|
||||||
@@ -439,7 +439,7 @@ bool Notification_Class_Write_Property(
|
|||||||
NOTIFICATION_CLASS_INFO TmpNotify;
|
NOTIFICATION_CLASS_INFO TmpNotify;
|
||||||
BACNET_APPLICATION_DATA_VALUE value;
|
BACNET_APPLICATION_DATA_VALUE value;
|
||||||
bool status = false;
|
bool status = false;
|
||||||
/// FIXME: wite all array
|
int iOffset = 0;
|
||||||
uint8_t idx = 0;
|
uint8_t idx = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
@@ -693,8 +693,8 @@ bool Notification_Class_Write_Property(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
iOffset += len;
|
iOffset += len;
|
||||||
///src = CurrentNotify->Recipient_List[idx].Recipient._.Address;
|
|
||||||
///address_bind_request(BACNET_MAX_INSTANCE, &max_apdu, &src);
|
/* Increasing element of list */
|
||||||
if (++idx >= NC_MAX_RECIPIENTS) {
|
if (++idx >= NC_MAX_RECIPIENTS) {
|
||||||
wp_data->error_class = ERROR_CLASS_RESOURCES;
|
wp_data->error_class = ERROR_CLASS_RESOURCES;
|
||||||
wp_data->error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
|
wp_data->error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
|
||||||
@@ -810,7 +810,7 @@ void Notification_Class_common_reporting_function(
|
|||||||
|
|
||||||
/* Initiating Device Identifier */
|
/* Initiating Device Identifier */
|
||||||
event_data->initiatingObjectIdentifier.type = OBJECT_DEVICE;
|
event_data->initiatingObjectIdentifier.type = OBJECT_DEVICE;
|
||||||
default: // shouldn't happen
|
event_data->initiatingObjectIdentifier.instance =
|
||||||
Device_Object_Instance_Number();
|
Device_Object_Instance_Number();
|
||||||
|
|
||||||
/* Priority and AckRequired*/
|
/* Priority and AckRequired*/
|
||||||
|
|||||||
@@ -121,4 +121,4 @@ typedef struct Notification_Class_info {
|
|||||||
Notification_Class_Write_Property, Notification_Class_Property_Lists, \
|
Notification_Class_Write_Property, Notification_Class_Property_Lists, \
|
||||||
NULL, NULL, NULL
|
NULL, NULL, NULL
|
||||||
|
|
||||||
#endif // NC_H
|
#endif /* NC_H
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ int wpm_decode_object_id(uint8_t * apdu, uint16_t apdu_len,
|
|||||||
|
|
||||||
if((apdu )&& (apdu_len))
|
if((apdu )&& (apdu_len))
|
||||||
{
|
{
|
||||||
// Context tag 0 - Object ID
|
/* Context tag 0 - Object ID
|
||||||
*/
|
*/
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
if(tag_number == 0)
|
if(tag_number == 0)
|
||||||
@@ -78,7 +78,7 @@ int wpm_decode_object_property(uint8_t * apdu,
|
|||||||
wp_data->array_index = BACNET_ARRAY_ALL;
|
wp_data->array_index = BACNET_ARRAY_ALL;
|
||||||
wp_data->priority = BACNET_NO_PRIORITY;
|
wp_data->priority = BACNET_NO_PRIORITY;
|
||||||
wp_data->application_data_len = 0;
|
wp_data->application_data_len = 0;
|
||||||
// tag 0 - Property Identifier
|
|
||||||
/* tag 0 - Property Identifier
|
/* tag 0 - Property Identifier
|
||||||
*/
|
*/
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
@@ -88,7 +88,7 @@ int wpm_decode_object_property(uint8_t * apdu,
|
|||||||
wp_data->object_property = ulVal;
|
wp_data->object_property = ulVal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// tag 1 - Property Array Index - optional
|
return -1;
|
||||||
|
|
||||||
/* tag 1 - Property Array Index - optional
|
/* tag 1 - Property Array Index - optional
|
||||||
*/
|
*/
|
||||||
@@ -97,7 +97,7 @@ int wpm_decode_object_property(uint8_t * apdu,
|
|||||||
{
|
{
|
||||||
len += decode_unsigned(&apdu[len],len_value, &ulVal);
|
len += decode_unsigned(&apdu[len],len_value, &ulVal);
|
||||||
wp_data->array_index = ulVal;
|
wp_data->array_index = ulVal;
|
||||||
// tag 2 - Property Value
|
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
}
|
}
|
||||||
/* tag 2 - Property Value
|
/* tag 2 - Property Value
|
||||||
@@ -105,20 +105,20 @@ int wpm_decode_object_property(uint8_t * apdu,
|
|||||||
if((tag_number == 2) && (decode_is_opening_tag(&apdu[len-1])))
|
if((tag_number == 2) && (decode_is_opening_tag(&apdu[len-1])))
|
||||||
{
|
{
|
||||||
len--;
|
len--;
|
||||||
// copy application data
|
wp_data->application_data_len = bacapp_data_len(&apdu[len],
|
||||||
apdu_len - len, wp_data->object_property);
|
apdu_len - len, wp_data->object_property);
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
/* copy application data
|
/* copy application data
|
||||||
*/
|
*/
|
||||||
// closing tag 2
|
for(i = 0; i < wp_data->application_data_len; i++)
|
||||||
wp_data->application_data[i] = apdu[len+i];
|
wp_data->application_data[i] = apdu[len+i];
|
||||||
len += wp_data->application_data_len;
|
len += wp_data->application_data_len;
|
||||||
|
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
/* closing tag 2
|
/* closing tag 2
|
||||||
*/
|
*/
|
||||||
// tag 3 - Priority - optional
|
if((tag_number != 2) &&(decode_is_closing_tag(&apdu[len-1])))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user