Indented.
This commit is contained in:
@@ -426,8 +426,8 @@ static bool cov_subscribe(
|
|||||||
|
|
||||||
switch (cov_data->monitoredObjectIdentifier.type) {
|
switch (cov_data->monitoredObjectIdentifier.type) {
|
||||||
case OBJECT_BINARY_INPUT:
|
case OBJECT_BINARY_INPUT:
|
||||||
if (Binary_Input_Valid_Instance(
|
if (Binary_Input_Valid_Instance(cov_data->
|
||||||
cov_data->monitoredObjectIdentifier.instance)) {
|
monitoredObjectIdentifier.instance)) {
|
||||||
status =
|
status =
|
||||||
cov_list_subscribe(src, cov_data, error_class, error_code);
|
cov_list_subscribe(src, cov_data, error_class, error_code);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -244,8 +244,7 @@ int RPM_Encode_Property(
|
|||||||
rpm_ack_encode_apdu_object_property_error(&Temp_Buf[0],
|
rpm_ack_encode_apdu_object_property_error(&Temp_Buf[0],
|
||||||
error_class, error_code);
|
error_class, error_code);
|
||||||
len =
|
len =
|
||||||
memcopy(&apdu[0], &Temp_Buf[0], offset + apdu_len, len,
|
memcopy(&apdu[0], &Temp_Buf[0], offset + apdu_len, len, max_apdu);
|
||||||
max_apdu);
|
|
||||||
if (!len) {
|
if (!len) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -344,8 +343,8 @@ void handler_read_property_multiple(
|
|||||||
rpm_ack_encode_apdu_object_begin(&Temp_Buf[0], object_type,
|
rpm_ack_encode_apdu_object_begin(&Temp_Buf[0], object_type,
|
||||||
object_instance);
|
object_instance);
|
||||||
copy_len =
|
copy_len =
|
||||||
memcopy(&Handler_Transmit_Buffer[npdu_len], &Temp_Buf[0],
|
memcopy(&Handler_Transmit_Buffer[npdu_len], &Temp_Buf[0], apdu_len,
|
||||||
apdu_len, len, sizeof(Handler_Transmit_Buffer));
|
len, sizeof(Handler_Transmit_Buffer));
|
||||||
if (!copy_len) {
|
if (!copy_len) {
|
||||||
apdu_len =
|
apdu_len =
|
||||||
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
|
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
|
||||||
|
|||||||
@@ -60,9 +60,8 @@ static int rpm_ack_decode_service_request(
|
|||||||
rpm_object = read_access_data;
|
rpm_object = read_access_data;
|
||||||
old_rpm_object = rpm_object;
|
old_rpm_object = rpm_object;
|
||||||
while (rpm_object && apdu_len) {
|
while (rpm_object && apdu_len) {
|
||||||
len = rpm_ack_decode_object_id(
|
len =
|
||||||
apdu, apdu_len,
|
rpm_ack_decode_object_id(apdu, apdu_len, &rpm_object->object_type,
|
||||||
&rpm_object->object_type,
|
|
||||||
&rpm_object->object_instance);
|
&rpm_object->object_instance);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
old_rpm_object->next = NULL;
|
old_rpm_object->next = NULL;
|
||||||
@@ -76,9 +75,8 @@ static int rpm_ack_decode_service_request(
|
|||||||
rpm_object->listOfProperties = rpm_property;
|
rpm_object->listOfProperties = rpm_property;
|
||||||
old_rpm_property = rpm_property;
|
old_rpm_property = rpm_property;
|
||||||
while (rpm_property && apdu_len) {
|
while (rpm_property && apdu_len) {
|
||||||
len = rpm_ack_decode_object_property(
|
len =
|
||||||
apdu,
|
rpm_ack_decode_object_property(apdu, apdu_len,
|
||||||
apdu_len,
|
|
||||||
&rpm_property->propertyIdentifier,
|
&rpm_property->propertyIdentifier,
|
||||||
&rpm_property->propertyArrayIndex);
|
&rpm_property->propertyArrayIndex);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
@@ -99,10 +97,8 @@ static int rpm_ack_decode_service_request(
|
|||||||
rpm_property->value = value;
|
rpm_property->value = value;
|
||||||
old_value = value;
|
old_value = value;
|
||||||
while (value && (apdu_len > 0)) {
|
while (value && (apdu_len > 0)) {
|
||||||
len = bacapp_decode_application_data(
|
len =
|
||||||
apdu,
|
bacapp_decode_application_data(apdu, apdu_len, value);
|
||||||
apdu_len,
|
|
||||||
value);
|
|
||||||
decoded_len += len;
|
decoded_len += len;
|
||||||
apdu_len -= len;
|
apdu_len -= len;
|
||||||
apdu += len;
|
apdu += len;
|
||||||
@@ -113,7 +109,8 @@ static int rpm_ack_decode_service_request(
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
old_value = value;
|
old_value = value;
|
||||||
value = calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
value =
|
||||||
|
calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
||||||
old_value->next = value;
|
old_value->next = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,8 +171,7 @@ static void PrintReadPropertyMultipleData(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
while (value) {
|
while (value) {
|
||||||
bacapp_print_value(stdout,
|
bacapp_print_value(stdout, value,
|
||||||
value,
|
|
||||||
listOfProperties->propertyIdentifier);
|
listOfProperties->propertyIdentifier);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
if (value->next) {
|
if (value->next) {
|
||||||
@@ -217,7 +213,8 @@ void handler_read_property_multiple_ack(
|
|||||||
|
|
||||||
rpm_data = calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
rpm_data = calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||||
if (rpm_data) {
|
if (rpm_data) {
|
||||||
len = rpm_ack_decode_service_request(service_request, service_len,
|
len =
|
||||||
|
rpm_ack_decode_service_request(service_request, service_len,
|
||||||
rpm_data);
|
rpm_data);
|
||||||
}
|
}
|
||||||
#if 1
|
#if 1
|
||||||
|
|||||||
@@ -57,25 +57,21 @@ void handler_ucov_notification(
|
|||||||
fprintf(stderr, "UCOV: Received Notification!\n");
|
fprintf(stderr, "UCOV: Received Notification!\n");
|
||||||
#endif
|
#endif
|
||||||
/* decode the service request only */
|
/* decode the service request only */
|
||||||
len = cov_notify_decode_service_request(
|
len =
|
||||||
service_request, service_len, &cov_data);
|
cov_notify_decode_service_request(service_request, service_len,
|
||||||
|
&cov_data);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
fprintf(stderr, "UCOV: PID=%u ",
|
fprintf(stderr, "UCOV: PID=%u ", cov_data.subscriberProcessIdentifier);
|
||||||
cov_data.subscriberProcessIdentifier);
|
fprintf(stderr, "instance=%u ", cov_data.initiatingDeviceIdentifier);
|
||||||
fprintf(stderr, "instance=%u ",
|
|
||||||
cov_data.initiatingDeviceIdentifier);
|
|
||||||
fprintf(stderr, "%s %u ",
|
fprintf(stderr, "%s %u ",
|
||||||
bactext_object_type_name(
|
bactext_object_type_name(cov_data.monitoredObjectIdentifier.type),
|
||||||
cov_data.monitoredObjectIdentifier.type),
|
|
||||||
cov_data.monitoredObjectIdentifier.instance);
|
cov_data.monitoredObjectIdentifier.instance);
|
||||||
fprintf(stderr, "time remaining=%u seconds ",
|
fprintf(stderr, "time remaining=%u seconds ", cov_data.timeRemaining);
|
||||||
cov_data.timeRemaining);
|
|
||||||
fprintf(stderr, "%s ",
|
fprintf(stderr, "%s ",
|
||||||
bactext_property_name(property_value.propertyIdentifier));
|
bactext_property_name(property_value.propertyIdentifier));
|
||||||
if (property_value.propertyArrayIndex != BACNET_ARRAY_ALL) {
|
if (property_value.propertyArrayIndex != BACNET_ARRAY_ALL) {
|
||||||
fprintf(stderr, "%u ",
|
fprintf(stderr, "%u ", property_value.propertyArrayIndex);
|
||||||
property_value.propertyArrayIndex);
|
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ void Send_I_Am(
|
|||||||
|
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
if (bytes_sent <= 0)
|
if (bytes_sent <= 0)
|
||||||
fprintf(stderr, "Failed to Send I-Am Reply (%s)!\n",
|
fprintf(stderr, "Failed to Send I-Am Reply (%s)!\n", strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ void Send_Who_Is_Router_To_Network(
|
|||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
|
|
||||||
npdu_encode_npdu_network(&npdu_data,
|
npdu_encode_npdu_network(&npdu_data,
|
||||||
NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK,
|
NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, false,
|
||||||
false,
|
|
||||||
MESSAGE_PRIORITY_NORMAL);
|
MESSAGE_PRIORITY_NORMAL);
|
||||||
/* fixme: should dnet/dlen/dadr be set in NPDU? */
|
/* fixme: should dnet/dlen/dadr be set in NPDU? */
|
||||||
pdu_len =
|
pdu_len =
|
||||||
@@ -112,8 +111,7 @@ void Send_I_Am_Router_To_Network(
|
|||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
|
|
||||||
npdu_encode_npdu_network(&npdu_data,
|
npdu_encode_npdu_network(&npdu_data,
|
||||||
NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK,
|
NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK, false,
|
||||||
false,
|
|
||||||
MESSAGE_PRIORITY_NORMAL);
|
MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
|
||||||
@@ -157,9 +155,7 @@ void Send_Initialize_Routing_Table(
|
|||||||
BACNET_ROUTER_PORT *router_port;
|
BACNET_ROUTER_PORT *router_port;
|
||||||
unsigned i = 0; /* counter */
|
unsigned i = 0; /* counter */
|
||||||
|
|
||||||
npdu_encode_npdu_network(&npdu_data,
|
npdu_encode_npdu_network(&npdu_data, NETWORK_MESSAGE_INIT_RT_TABLE, true,
|
||||||
NETWORK_MESSAGE_INIT_RT_TABLE,
|
|
||||||
true,
|
|
||||||
MESSAGE_PRIORITY_NORMAL);
|
MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
|
||||||
@@ -208,10 +204,8 @@ void Send_Initialize_Routing_Table_Ack(
|
|||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
|
|
||||||
npdu_encode_npdu_network(&npdu_data,
|
npdu_encode_npdu_network(&npdu_data, NETWORK_MESSAGE_INIT_RT_TABLE_ACK,
|
||||||
NETWORK_MESSAGE_INIT_RT_TABLE_ACK,
|
false, MESSAGE_PRIORITY_NORMAL);
|
||||||
false,
|
|
||||||
MESSAGE_PRIORITY_NORMAL);
|
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
|
||||||
/* encode the optional DNET list portion of the packet */
|
/* encode the optional DNET list portion of the packet */
|
||||||
|
|||||||
@@ -72,14 +72,10 @@ uint8_t Send_Read_Property_Multiple_Request(
|
|||||||
/* 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, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len = npdu_encode_pdu(&pdu[0], &dest, &my_address, &npdu_data);
|
||||||
npdu_encode_pdu(&pdu[0], &dest, &my_address,
|
|
||||||
&npdu_data);
|
|
||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
len = rpm_encode_apdu(
|
len =
|
||||||
&pdu[pdu_len],
|
rpm_encode_apdu(&pdu[pdu_len], max_pdu - pdu_len, invoke_id,
|
||||||
max_pdu - pdu_len,
|
|
||||||
invoke_id,
|
|
||||||
read_access_data);
|
read_access_data);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -94,8 +90,7 @@ uint8_t Send_Read_Property_Multiple_Request(
|
|||||||
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
|
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
|
||||||
&npdu_data, &pdu[0], (uint16_t) pdu_len);
|
&npdu_data, &pdu[0], (uint16_t) pdu_len);
|
||||||
bytes_sent =
|
bytes_sent =
|
||||||
datalink_send_pdu(&dest, &npdu_data,
|
datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
|
||||||
&pdu[0], pdu_len);
|
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
if (bytes_sent <= 0)
|
if (bytes_sent <= 0)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|||||||
@@ -325,7 +325,8 @@ static void address_parse(BACNET_ADDRESS * dst,
|
|||||||
dst->mac_len = 6;
|
dst->mac_len = 6;
|
||||||
for (index = 0; index < 4; index++) {
|
for (index = 0; index < 4; index++) {
|
||||||
dst->mac[index] = mac[index];
|
dst->mac[index] = mac[index];
|
||||||
} encode_unsigned16(&dst->mac[4],
|
}
|
||||||
|
encode_unsigned16(&dst->mac[4],
|
||||||
port);
|
port);
|
||||||
} else {
|
} else {
|
||||||
count =
|
count =
|
||||||
@@ -364,22 +365,14 @@ int main(int argc, char *argv[]) {
|
|||||||
filename_remove_path(argv[0]));
|
filename_remove_path(argv[0]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((
|
if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) {
|
||||||
argc > 1) && (
|
|
||||||
strcmp(argv[1],
|
|
||||||
"--help") == 0)) {
|
|
||||||
printf("Send BACnet Initialize-Routing-Table message to a network\r\n"
|
printf("Send BACnet Initialize-Routing-Table message to a network\r\n"
|
||||||
"and wait for responses. Displays their network information.\r\n"
|
"and wait for responses. Displays their network information.\r\n"
|
||||||
"\r\n"
|
"\r\n" "address:\r\n"
|
||||||
"address:\r\n"
|
|
||||||
"MAC address in xx:xx:xx:xx:xx:xx format or IP x.x.x.x:port\r\n"
|
"MAC address in xx:xx:xx:xx:xx:xx format or IP x.x.x.x:port\r\n"
|
||||||
"DNET ID Len Info:\r\n"
|
"DNET ID Len Info:\r\n" "Port-info data:\r\n" " DNET:\r\n"
|
||||||
"Port-info data:\r\n"
|
" Destination network number 0-65534\r\n" " ID:\r\n"
|
||||||
" DNET:\r\n"
|
" Port Identifier number 0-255\r\n" " Info:\r\n"
|
||||||
" Destination network number 0-65534\r\n"
|
|
||||||
" ID:\r\n"
|
|
||||||
" Port Identifier number 0-255\r\n"
|
|
||||||
" Info:\r\n"
|
|
||||||
" Octet string of data, up to 255 octets\r\n"
|
" Octet string of data, up to 255 octets\r\n"
|
||||||
"To query the complete routing table, do not include any port-info.\r\n"
|
"To query the complete routing table, do not include any port-info.\r\n"
|
||||||
"To query using Initialize-Routing-Table message to 192.168.0.18:\r\n"
|
"To query using Initialize-Routing-Table message to 192.168.0.18:\r\n"
|
||||||
|
|||||||
@@ -216,8 +216,7 @@ static void Init_DataLink(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup(void)
|
void cleanup(void) {
|
||||||
{
|
|
||||||
BACNET_READ_ACCESS_DATA *rpm_object;
|
BACNET_READ_ACCESS_DATA *rpm_object;
|
||||||
BACNET_READ_ACCESS_DATA *old_rpm_object;
|
BACNET_READ_ACCESS_DATA *old_rpm_object;
|
||||||
BACNET_PROPERTY_REFERENCE *rpm_property;
|
BACNET_PROPERTY_REFERENCE *rpm_property;
|
||||||
@@ -231,8 +230,7 @@ void cleanup(void)
|
|||||||
old_rpm_property = rpm_property;
|
old_rpm_property = rpm_property;
|
||||||
rpm_property = rpm_property->next;
|
rpm_property = rpm_property->next;
|
||||||
free(old_rpm_property);
|
free(old_rpm_property);
|
||||||
}
|
} old_rpm_object = rpm_object;
|
||||||
old_rpm_object = rpm_object;
|
|
||||||
rpm_object = rpm_object->next;
|
rpm_object = rpm_object->next;
|
||||||
free(old_rpm_object);
|
free(old_rpm_object);
|
||||||
}
|
}
|
||||||
@@ -251,14 +249,16 @@ int main(int argc, char *argv[]) {
|
|||||||
time_t timeout_seconds = 0;
|
time_t timeout_seconds = 0;
|
||||||
uint8_t invoke_id = 0;
|
uint8_t invoke_id = 0;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
uint8_t buffer[MAX_PDU] = {0};
|
uint8_t buffer[MAX_PDU] = {
|
||||||
|
0};
|
||||||
BACNET_READ_ACCESS_DATA *rpm_object;
|
BACNET_READ_ACCESS_DATA *rpm_object;
|
||||||
BACNET_PROPERTY_REFERENCE *rpm_property;
|
BACNET_PROPERTY_REFERENCE *rpm_property;
|
||||||
|
|
||||||
|
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
printf("Usage: %s device-instance object-type object-instance "
|
printf("Usage: %s device-instance object-type object-instance "
|
||||||
"property index [object-type ...]\r\n", filename_remove_path(argv[0]));
|
"property index [object-type ...]\r\n",
|
||||||
|
filename_remove_path(argv[0]));
|
||||||
if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) {
|
if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) {
|
||||||
printf("device-instance:\r\n"
|
printf("device-instance:\r\n"
|
||||||
"BACnet Device Object Instance number that you are\r\n"
|
"BACnet Device Object Instance number that you are\r\n"
|
||||||
@@ -285,8 +285,7 @@ int main(int argc, char *argv[]) {
|
|||||||
"If the property is an array, individual elements can\r\n"
|
"If the property is an array, individual elements can\r\n"
|
||||||
"be read. If this parameter is missing and the property\r\n"
|
"be read. If this parameter is missing and the property\r\n"
|
||||||
"is an array, the entire array will be read.\r\n"
|
"is an array, the entire array will be read.\r\n"
|
||||||
"\r\nExample:\r\n"
|
"\r\nExample:\r\n" "If you want read the ALL property in\r\n"
|
||||||
"If you want read the ALL property in\r\n"
|
|
||||||
"Device object 123, you would use the following command:\r\n"
|
"Device object 123, you would use the following command:\r\n"
|
||||||
"%s 123 8 123 8 -1\r\n"
|
"%s 123 8 123 8 -1\r\n"
|
||||||
"If you want read the OPTIONAL property in\r\n"
|
"If you want read the OPTIONAL property in\r\n"
|
||||||
@@ -294,10 +293,8 @@ int main(int argc, char *argv[]) {
|
|||||||
"%s 123 8 123 80 -1\r\n"
|
"%s 123 8 123 80 -1\r\n"
|
||||||
"If you want read the REQUIRED property in\r\n"
|
"If you want read the REQUIRED property in\r\n"
|
||||||
"Device object 123, you would use the following command:\r\n"
|
"Device object 123, you would use the following command:\r\n"
|
||||||
"%s 123 8 123 105 -1\r\n",
|
"%s 123 8 123 105 -1\r\n", filename_remove_path(argv[0]),
|
||||||
filename_remove_path(argv[0]),
|
filename_remove_path(argv[0]), filename_remove_path(argv[0]));
|
||||||
filename_remove_path(argv[0]),
|
|
||||||
filename_remove_path(argv[0]));
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -315,8 +312,7 @@ int main(int argc, char *argv[]) {
|
|||||||
arg_sets = 0;
|
arg_sets = 0;
|
||||||
while (rpm_object) {
|
while (rpm_object) {
|
||||||
tag_value_arg = 2 + (arg_sets * 4);
|
tag_value_arg = 2 + (arg_sets * 4);
|
||||||
rpm_object->object_type =
|
rpm_object->object_type = strtol(argv[tag_value_arg], NULL, 0);
|
||||||
strtol(argv[tag_value_arg], NULL, 0);
|
|
||||||
tag_value_arg++;
|
tag_value_arg++;
|
||||||
args_remaining--;
|
args_remaining--;
|
||||||
if (args_remaining <= 0) {
|
if (args_remaining <= 0) {
|
||||||
@@ -328,8 +324,7 @@ int main(int argc, char *argv[]) {
|
|||||||
rpm_object->object_type, MAX_BACNET_OBJECT_TYPE + 1);
|
rpm_object->object_type, MAX_BACNET_OBJECT_TYPE + 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
rpm_object->object_instance =
|
rpm_object->object_instance = strtol(argv[tag_value_arg], NULL, 0);
|
||||||
strtol(argv[tag_value_arg], NULL, 0);
|
|
||||||
tag_value_arg++;
|
tag_value_arg++;
|
||||||
args_remaining--;
|
args_remaining--;
|
||||||
if (args_remaining <= 0) {
|
if (args_remaining <= 0) {
|
||||||
@@ -350,12 +345,14 @@ int main(int argc, char *argv[]) {
|
|||||||
tag_value_arg++;
|
tag_value_arg++;
|
||||||
args_remaining--;
|
args_remaining--;
|
||||||
if (args_remaining <= 0) {
|
if (args_remaining <= 0) {
|
||||||
fprintf(stderr, "Error: not enough object property quads.\r\n");
|
fprintf(stderr,
|
||||||
|
"Error: not enough object property quads.\r\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (rpm_property->propertyIdentifier > MAX_BACNET_PROPERTY_ID) {
|
if (rpm_property->propertyIdentifier > MAX_BACNET_PROPERTY_ID) {
|
||||||
fprintf(stderr, "property=%u - it must be less than %u\r\n",
|
fprintf(stderr, "property=%u - it must be less than %u\r\n",
|
||||||
rpm_property->propertyIdentifier, MAX_BACNET_PROPERTY_ID + 1);
|
rpm_property->propertyIdentifier,
|
||||||
|
MAX_BACNET_PROPERTY_ID + 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
rpm_property->propertyArrayIndex =
|
rpm_property->propertyArrayIndex =
|
||||||
@@ -413,10 +410,9 @@ int main(int argc, char *argv[]) {
|
|||||||
&Target_Address);
|
&Target_Address);
|
||||||
if (found) {
|
if (found) {
|
||||||
if (invoke_id == 0) {
|
if (invoke_id == 0) {
|
||||||
invoke_id = Send_Read_Property_Multiple_Request(
|
invoke_id =
|
||||||
&buffer[0],
|
Send_Read_Property_Multiple_Request(&buffer[0],
|
||||||
sizeof(buffer),
|
sizeof(buffer), Target_Device_Object_Instance,
|
||||||
Target_Device_Object_Instance,
|
|
||||||
Read_Access_Data);
|
Read_Access_Data);
|
||||||
} else if (tsm_invoke_id_free(invoke_id))
|
} else if (tsm_invoke_id_free(invoke_id))
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -212,8 +212,8 @@ int main(int argc, char *argv[]) {
|
|||||||
filename_remove_path(argv[0]), filename_remove_path(argv[0]));
|
filename_remove_path(argv[0]), filename_remove_path(argv[0]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* decode the command line parameters */
|
/* decode the command line parameters */ cov_data.
|
||||||
cov_data.subscriberProcessIdentifier = strtol(argv[1], NULL, 0);
|
subscriberProcessIdentifier = strtol(argv[1], NULL, 0);
|
||||||
cov_data.initiatingDeviceIdentifier = strtol(argv[2], NULL, 0);
|
cov_data.initiatingDeviceIdentifier = strtol(argv[2], NULL, 0);
|
||||||
cov_data.monitoredObjectIdentifier.type = strtol(argv[3], NULL, 0);
|
cov_data.monitoredObjectIdentifier.type = strtol(argv[3], NULL, 0);
|
||||||
cov_data.monitoredObjectIdentifier.instance = strtol(argv[4], NULL, 0);
|
cov_data.monitoredObjectIdentifier.instance = strtol(argv[4], NULL, 0);
|
||||||
|
|||||||
@@ -69,7 +69,4 @@ int bacapp_decode_context_device_obj_property_ref(
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#endif //_BAC_DEV_PROP_REF_H_
|
#endif //_BAC_DEV_PROP_REF_H_
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,4 @@ int bacapp_encode_property_state(
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#endif // _BAC_PROP_STATES_H_
|
#endif // _BAC_PROP_STATES_H_
|
||||||
|
|||||||
@@ -50,14 +50,11 @@ void debug_printf(
|
|||||||
#else
|
#else
|
||||||
static void debug_printf(
|
static void debug_printf(
|
||||||
const char *format,
|
const char *format,
|
||||||
...)
|
...) {
|
||||||
{
|
|
||||||
format = format;
|
format = format;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -73,6 +73,4 @@ int bacapp_decode_context_timestamp(
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define DLL_EXPORT __declspec(dllimport)
|
#define DLL_EXPORT __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void DLL_EXPORT SomeFunction(const LPCSTR sometext);
|
void DLL_EXPORT SomeFunction(
|
||||||
|
const LPCSTR sometext);
|
||||||
|
|
||||||
#endif // __MAIN_H__
|
#endif // __MAIN_H__
|
||||||
|
|||||||
@@ -328,4 +328,3 @@ int Device_Encode_Property_APDU(
|
|||||||
|
|
||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ static struct mstp_flag_t {
|
|||||||
} MSTP_Flag;
|
} MSTP_Flag;
|
||||||
|
|
||||||
/* data passed to receive handler */
|
/* data passed to receive handler */
|
||||||
struct mstp_packet_info_t
|
struct mstp_packet_info_t {
|
||||||
{
|
|
||||||
/* A Boolean flag set to TRUE by the Receive State Machine */
|
/* A Boolean flag set to TRUE by the Receive State Machine */
|
||||||
/* if a valid frame is received. */
|
/* if a valid frame is received. */
|
||||||
unsigned valid_frame:1;
|
unsigned valid_frame:1;
|
||||||
@@ -286,7 +285,9 @@ static void MSTP_Send_Frame(
|
|||||||
#if 0
|
#if 0
|
||||||
/* return true if the packet is good. */
|
/* return true if the packet is good. */
|
||||||
/* note: buffer should include the CRC as the last byte */
|
/* note: buffer should include the CRC as the last byte */
|
||||||
static bool crc_header_good(uint8_t *buffer, uint8_t len)
|
static bool crc_header_good(
|
||||||
|
uint8_t * buffer,
|
||||||
|
uint8_t len)
|
||||||
{
|
{
|
||||||
uint8_t i; /* loop counter */
|
uint8_t i; /* loop counter */
|
||||||
uint8_t crc8 = 0xFF; /* loop counter */
|
uint8_t crc8 = 0xFF; /* loop counter */
|
||||||
@@ -299,7 +300,8 @@ static bool crc_header_good(uint8_t *buffer, uint8_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void mstp_receive_handler(void)
|
static void mstp_receive_handler(
|
||||||
|
void)
|
||||||
{
|
{
|
||||||
uint8_t data_register = 0; /* data from UART */
|
uint8_t data_register = 0; /* data from UART */
|
||||||
|
|
||||||
@@ -327,13 +329,15 @@ static void mstp_receive_handler(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DataLength == 0) {
|
if (DataLength == 0) {
|
||||||
MSTP_Receive_Packet.header[MSTP_Receive_Packet.index] = data_register;
|
MSTP_Receive_Packet.header[MSTP_Receive_Packet.index] =
|
||||||
|
data_register;
|
||||||
if (MSTP_Receive_Packet.index == 5) {
|
if (MSTP_Receive_Packet.index == 5) {
|
||||||
if (crc_header_good(MSTP_Receive_Packet.header, 6)) {
|
if (crc_header_good(MSTP_Receive_Packet.header, 6)) {
|
||||||
FrameType = MSTP_Receive_Packet.header[0];
|
FrameType = MSTP_Receive_Packet.header[0];
|
||||||
DestinationAddress = MSTP_Receive_Packet.header[1];
|
DestinationAddress = MSTP_Receive_Packet.header[1];
|
||||||
SourceAddress = MSTP_Receive_Packet.header[2];
|
SourceAddress = MSTP_Receive_Packet.header[2];
|
||||||
DataLength = (MSTP_Receive_Packet.header[3] * 256) +
|
DataLength =
|
||||||
|
(MSTP_Receive_Packet.header[3] * 256) +
|
||||||
MSTP_Receive_Packet.header[4];
|
MSTP_Receive_Packet.header[4];
|
||||||
if (DataLength == 0) {
|
if (DataLength == 0) {
|
||||||
MSTP_Receive_Packet.valid_frame = true;
|
MSTP_Receive_Packet.valid_frame = true;
|
||||||
@@ -347,7 +351,8 @@ static void mstp_receive_handler(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MSTP_Receive_Packet.buffer[MSTP_Receive_Packet.index] = data_register;
|
MSTP_Receive_Packet.buffer[MSTP_Receive_Packet.index] =
|
||||||
|
data_register;
|
||||||
if (packet_info->index == packet_info->len) {
|
if (packet_info->index == packet_info->len) {
|
||||||
/* PDU length ended */
|
/* PDU length ended */
|
||||||
packet_info->ready = true;
|
packet_info->ready = true;
|
||||||
@@ -361,7 +366,8 @@ static void mstp_receive_handler(void)
|
|||||||
MSTP_Receive_Packet.index++;
|
MSTP_Receive_Packet.index++;
|
||||||
if (packet_info->ready) {
|
if (packet_info->ready) {
|
||||||
/* validate the CRC */
|
/* validate the CRC */
|
||||||
if (!lrc_packet_good(packet_info->buffer,packet_info->len+1)) {
|
if (!lrc_packet_good(packet_info->buffer,
|
||||||
|
packet_info->len + 1)) {
|
||||||
packet_info->ready = false;
|
packet_info->ready = false;
|
||||||
}
|
}
|
||||||
/* pull off the CRC */
|
/* pull off the CRC */
|
||||||
@@ -616,9 +622,8 @@ static void MSTP_Slave_Node_FSM(
|
|||||||
MSTP_Flag.ReceivePacketPending = true;
|
MSTP_Flag.ReceivePacketPending = true;
|
||||||
break;
|
break;
|
||||||
case FRAME_TYPE_TEST_REQUEST:
|
case FRAME_TYPE_TEST_REQUEST:
|
||||||
MSTP_Send_Frame(FRAME_TYPE_TEST_RESPONSE,
|
MSTP_Send_Frame(FRAME_TYPE_TEST_RESPONSE, SourceAddress,
|
||||||
SourceAddress, This_Station, &InputBuffer[0],
|
This_Station, &InputBuffer[0], DataLength);
|
||||||
DataLength);
|
|
||||||
break;
|
break;
|
||||||
case FRAME_TYPE_TEST_RESPONSE:
|
case FRAME_TYPE_TEST_RESPONSE:
|
||||||
default:
|
default:
|
||||||
@@ -634,8 +639,8 @@ static void MSTP_Slave_Node_FSM(
|
|||||||
/* and enter the IDLE state to wait for the next frame. */
|
/* and enter the IDLE state to wait for the next frame. */
|
||||||
/* Note: optimized such that we are never a client */
|
/* Note: optimized such that we are never a client */
|
||||||
MSTP_Send_Frame(FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY,
|
MSTP_Send_Frame(FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY,
|
||||||
TransmitPacketDest, This_Station,
|
TransmitPacketDest, This_Station, (uint8_t *) & TransmitPacket[0],
|
||||||
(uint8_t *) & TransmitPacket[0], TransmitPacketLen);
|
TransmitPacketLen);
|
||||||
MSTP_Flag.TransmitPacketPending = false;
|
MSTP_Flag.TransmitPacketPending = false;
|
||||||
MSTP_Flag.ReceivePacketPending = false;
|
MSTP_Flag.ReceivePacketPending = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ bool timer_silence_elapsed(
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_silence_reset(void)
|
void timer_silence_reset(
|
||||||
|
void)
|
||||||
{
|
{
|
||||||
uint8_t sreg;
|
uint8_t sreg;
|
||||||
|
|
||||||
|
|||||||
@@ -294,14 +294,13 @@ static void Init_DataLink(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(
|
int main(int argc, char *argv[]) {
|
||||||
int argc,
|
BACNET_ADDRESS src = {
|
||||||
char *argv[])
|
0}; /* address where message came from */
|
||||||
{
|
|
||||||
BACNET_ADDRESS src = { 0 }; /* address where message came from */
|
|
||||||
uint16_t pdu_len = 0;
|
uint16_t pdu_len = 0;
|
||||||
unsigned timeout = 100; /* milliseconds */
|
unsigned timeout = 100; /* milliseconds */
|
||||||
BACNET_ADDRESS my_address, broadcast_address;
|
BACNET_ADDRESS my_address,
|
||||||
|
broadcast_address;
|
||||||
|
|
||||||
(void) argc;
|
(void) argc;
|
||||||
(void) argv;
|
(void) argv;
|
||||||
|
|||||||
+57
-79
@@ -523,15 +523,11 @@ int decode_context_boolean2(
|
|||||||
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
||||||
if (apdu[len]) {
|
if (apdu[len]) {
|
||||||
*boolean_value = true;
|
*boolean_value = true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*boolean_value = false;
|
*boolean_value = false;
|
||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -642,12 +638,10 @@ int decode_context_bitstring(
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
len +=
|
||||||
&len_value);
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
len += decode_bitstring(&apdu[len], len_value, bit_string);
|
len += decode_bitstring(&apdu[len], len_value, bit_string);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -671,7 +665,8 @@ int encode_bitstring(
|
|||||||
} else {
|
} else {
|
||||||
used_bytes = bitstring_bytes_used(bit_string);
|
used_bytes = bitstring_bytes_used(bit_string);
|
||||||
remaining_used_bits =
|
remaining_used_bits =
|
||||||
(uint8_t)(bitstring_bits_used(bit_string) - ((used_bytes - 1) * 8));
|
(uint8_t) (bitstring_bits_used(bit_string) - ((used_bytes -
|
||||||
|
1) * 8));
|
||||||
/* number of unused bits in the subsequent final octet */
|
/* number of unused bits in the subsequent final octet */
|
||||||
apdu[len++] = (uint8_t) (8 - remaining_used_bits);
|
apdu[len++] = (uint8_t) (8 - remaining_used_bits);
|
||||||
for (i = 0; i < used_bytes; i++) {
|
for (i = 0; i < used_bytes; i++) {
|
||||||
@@ -728,7 +723,8 @@ int decode_object_id(
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
len = decode_unsigned32(apdu, &value);
|
len = decode_unsigned32(apdu, &value);
|
||||||
*object_type = (uint16_t)(((value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
|
*object_type =
|
||||||
|
(uint16_t) (((value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
|
||||||
*instance = (value & BACNET_MAX_INSTANCE);
|
*instance = (value & BACNET_MAX_INSTANCE);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
@@ -744,9 +740,7 @@ int decode_context_object_id(
|
|||||||
|
|
||||||
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
||||||
len += decode_object_id(&apdu[len], object_type, instance);
|
len += decode_object_id(&apdu[len], object_type, instance);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -912,19 +906,16 @@ int decode_context_octet_string(
|
|||||||
bool status = false;
|
bool status = false;
|
||||||
uint32_t len_value = 0;
|
uint32_t len_value = 0;
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[len], tag_number))
|
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
||||||
{
|
len +=
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
&len_value);
|
|
||||||
|
|
||||||
status = octetstring_init(octet_string, &apdu[len], len_value);
|
status = octetstring_init(octet_string, &apdu[len], len_value);
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
len += len_value;
|
len += len_value;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1022,20 +1013,17 @@ int decode_context_character_string(
|
|||||||
bool status = false;
|
bool status = false;
|
||||||
uint32_t len_value = 0;
|
uint32_t len_value = 0;
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[len], tag_number))
|
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
||||||
{
|
len +=
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
&len_value);
|
|
||||||
|
|
||||||
status =
|
status =
|
||||||
characterstring_init(char_string, apdu[len], (char *) &apdu[len+1],
|
characterstring_init(char_string, apdu[len],
|
||||||
len_value - 1);
|
(char *) &apdu[len + 1], len_value - 1);
|
||||||
if (status) {
|
if (status) {
|
||||||
len += len_value;
|
len += len_value;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,12 +1073,10 @@ int decode_context_unsigned(
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
len +=
|
||||||
&len_value);
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
len += decode_unsigned(&apdu[len], len_value, value);
|
len += decode_unsigned(&apdu[len], len_value, value);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -1186,12 +1172,10 @@ int decode_context_enumerated(
|
|||||||
uint32_t len_value;
|
uint32_t len_value;
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[len], tag_value)) {
|
if (decode_is_context_tag(&apdu[len], tag_value)) {
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
len +=
|
||||||
&len_value);
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
len += decode_enumerated(&apdu[len], len_value, value);
|
len += decode_enumerated(&apdu[len], len_value, value);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -1285,12 +1269,10 @@ int decode_context_signed(
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
len +=
|
||||||
&len_value);
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
len += decode_signed(&apdu[len], len_value, value);
|
len += decode_signed(&apdu[len], len_value, value);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -1504,13 +1486,10 @@ int decode_application_time(
|
|||||||
uint8_t tag_number;
|
uint8_t tag_number;
|
||||||
decode_tag_number(&apdu[len], &tag_number);
|
decode_tag_number(&apdu[len], &tag_number);
|
||||||
|
|
||||||
if ( tag_number == BACNET_APPLICATION_TAG_TIME )
|
if (tag_number == BACNET_APPLICATION_TAG_TIME) {
|
||||||
{
|
|
||||||
len++;
|
len++;
|
||||||
len += decode_bacnet_time(&apdu[len], btime);
|
len += decode_bacnet_time(&apdu[len], btime);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -1526,9 +1505,7 @@ int decode_context_bacnet_time(
|
|||||||
|
|
||||||
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
||||||
len += decode_bacnet_time(&apdu[len], btime);
|
len += decode_bacnet_time(&apdu[len], btime);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -1551,14 +1528,10 @@ int encode_bacnet_date(
|
|||||||
/* allow 2 digit years */
|
/* allow 2 digit years */
|
||||||
if (bdate->year >= 1900) {
|
if (bdate->year >= 1900) {
|
||||||
apdu[0] = (uint8_t) (bdate->year - 1900);
|
apdu[0] = (uint8_t) (bdate->year - 1900);
|
||||||
}
|
} else if (bdate->year < 0x100) {
|
||||||
else if ( bdate->year < 0x100 )
|
|
||||||
{
|
|
||||||
apdu[0] = (uint8_t) bdate->year;
|
apdu[0] = (uint8_t) bdate->year;
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
** Don't try and guess what the user meant here. Just fail
|
** Don't try and guess what the user meant here. Just fail
|
||||||
*/
|
*/
|
||||||
@@ -1633,13 +1606,10 @@ int decode_application_date(
|
|||||||
uint8_t tag_number;
|
uint8_t tag_number;
|
||||||
decode_tag_number(&apdu[len], &tag_number);
|
decode_tag_number(&apdu[len], &tag_number);
|
||||||
|
|
||||||
if ( tag_number == BACNET_APPLICATION_TAG_DATE )
|
if (tag_number == BACNET_APPLICATION_TAG_DATE) {
|
||||||
{
|
|
||||||
len++;
|
len++;
|
||||||
len += decode_date(&apdu[len], bdate);
|
len += decode_date(&apdu[len], bdate);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -1654,9 +1624,7 @@ int decode_context_date(
|
|||||||
|
|
||||||
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
if (decode_is_context_tag_with_length(&apdu[len], tag_number, &len)) {
|
||||||
len += decode_date(&apdu[len], bdate);
|
len += decode_date(&apdu[len], bdate);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -2293,7 +2261,8 @@ void testBACDCodeBitString(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void testUnsignedContextDecodes(Test * pTest)
|
void testUnsignedContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2347,7 +2316,8 @@ void testUnsignedContextDecodes(Test * pTest)
|
|||||||
ct_test(pTest, in == out);
|
ct_test(pTest, in == out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testSignedContextDecodes(Test * pTest)
|
void testSignedContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2401,7 +2371,8 @@ void testSignedContextDecodes(Test * pTest)
|
|||||||
ct_test(pTest, in == out);
|
ct_test(pTest, in == out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testEnumeratedContextDecodes(Test * pTest)
|
void testEnumeratedContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2455,7 +2426,8 @@ void testEnumeratedContextDecodes(Test * pTest)
|
|||||||
ct_test(pTest, in == out);
|
ct_test(pTest, in == out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFloatContextDecodes(Test * pTest)
|
void testFloatContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2485,7 +2457,8 @@ void testFloatContextDecodes(Test * pTest)
|
|||||||
ct_test(pTest, in == out);
|
ct_test(pTest, in == out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testObjectIDContextDecodes(Test * pTest)
|
void testObjectIDContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2513,7 +2486,8 @@ void testObjectIDContextDecodes(Test * pTest)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void testCharacterStringContextDecodes(Test * pTest)
|
void testCharacterStringContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2536,7 +2510,8 @@ void testCharacterStringContextDecodes(Test * pTest)
|
|||||||
ct_test(pTest, strcmp(in.value, out.value) == 0);
|
ct_test(pTest, strcmp(in.value, out.value) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testBitStringContextDecodes(Test * pTest)
|
void testBitStringContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2565,7 +2540,8 @@ void testBitStringContextDecodes(Test * pTest)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void testOctetStringContextDecodes(Test * pTest)
|
void testOctetStringContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2589,7 +2565,8 @@ void testOctetStringContextDecodes(Test * pTest)
|
|||||||
ct_test(pTest, octetstring_value_same(&in, &out));
|
ct_test(pTest, octetstring_value_same(&in, &out));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testTimeContextDecodes(Test * pTest)
|
void testTimeContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
@@ -2616,7 +2593,8 @@ void testTimeContextDecodes(Test * pTest)
|
|||||||
ct_test(pTest, in.sec == out.sec);
|
ct_test(pTest, in.sec == out.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testDateContextDecodes(Test * pTest)
|
void testDateContextDecodes(
|
||||||
|
Test * pTest)
|
||||||
{
|
{
|
||||||
uint8_t apdu[MAX_APDU];
|
uint8_t apdu[MAX_APDU];
|
||||||
int inLen;
|
int inLen;
|
||||||
|
|||||||
@@ -67,24 +67,23 @@ int bacapp_encode_device_obj_property_ref(
|
|||||||
int len;
|
int len;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
|
|
||||||
len = encode_context_object_id(&apdu[apdu_len], 0,
|
len =
|
||||||
value->objectIdentifier.type,
|
encode_context_object_id(&apdu[apdu_len], 0,
|
||||||
value->objectIdentifier.instance);
|
value->objectIdentifier.type, value->objectIdentifier.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len = encode_context_enumerated(&apdu[apdu_len], 1,
|
len =
|
||||||
|
encode_context_enumerated(&apdu[apdu_len], 1,
|
||||||
value->propertyIdentifier);
|
value->propertyIdentifier);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
if ( value->arrayIndex > 0 )
|
if (value->arrayIndex > 0) {
|
||||||
{
|
len = encode_context_unsigned(&apdu[apdu_len], 2, value->arrayIndex);
|
||||||
len = encode_context_unsigned(&apdu[apdu_len], 2,
|
|
||||||
value->arrayIndex);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
len = encode_context_object_id(&apdu[apdu_len], 3,
|
len =
|
||||||
value->deviceIndentifier.type,
|
encode_context_object_id(&apdu[apdu_len], 3,
|
||||||
value->deviceIndentifier.instance);
|
value->deviceIndentifier.type, value->deviceIndentifier.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
return apdu_len;
|
return apdu_len;
|
||||||
@@ -97,47 +96,41 @@ int bacapp_decode_device_obj_property_ref(
|
|||||||
int len;
|
int len;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
|
|
||||||
if ( -1 == ( len = decode_context_object_id(&apdu[apdu_len], 0,
|
if (-1 == (len =
|
||||||
|
decode_context_object_id(&apdu[apdu_len], 0,
|
||||||
&value->objectIdentifier.type,
|
&value->objectIdentifier.type,
|
||||||
&value->objectIdentifier.instance)) )
|
&value->objectIdentifier.instance))) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
if ( -1 == ( len = decode_context_enumerated(&apdu[apdu_len], 1,
|
if (-1 == (len =
|
||||||
&value->propertyIdentifier)))
|
decode_context_enumerated(&apdu[apdu_len], 1,
|
||||||
{
|
&value->propertyIdentifier))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
if ( decode_is_context_tag(&apdu[apdu_len], 2 ))
|
if (decode_is_context_tag(&apdu[apdu_len], 2)) {
|
||||||
{
|
if (-1 == (len =
|
||||||
if ( -1 == ( len = decode_context_unsigned(&apdu[apdu_len], 2,
|
decode_context_unsigned(&apdu[apdu_len], 2,
|
||||||
&value->arrayIndex)))
|
&value->arrayIndex))) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
value->arrayIndex = 0;
|
value->arrayIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( decode_is_context_tag(&apdu[apdu_len], 3 ))
|
if (decode_is_context_tag(&apdu[apdu_len], 3)) {
|
||||||
{
|
if (-1 == (len =
|
||||||
if ( -1 == ( len = decode_context_object_id(&apdu[apdu_len], 3,
|
decode_context_object_id(&apdu[apdu_len], 3,
|
||||||
&value->deviceIndentifier.type,
|
&value->deviceIndentifier.type,
|
||||||
&value->deviceIndentifier.instance)) )
|
&value->deviceIndentifier.instance))) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
value->deviceIndentifier.instance = 0;
|
value->deviceIndentifier.instance = 0;
|
||||||
value->deviceIndentifier.type = 0;
|
value->deviceIndentifier.type = 0;
|
||||||
}
|
}
|
||||||
@@ -155,27 +148,20 @@ int bacapp_decode_context_device_obj_property_ref(
|
|||||||
|
|
||||||
if (decode_is_opening_tag_number(&apdu[len], tag_number)) {
|
if (decode_is_opening_tag_number(&apdu[len], tag_number)) {
|
||||||
len++;
|
len++;
|
||||||
section_length = bacapp_decode_device_obj_property_ref(
|
section_length =
|
||||||
&apdu[len], value);
|
bacapp_decode_device_obj_property_ref(&apdu[len], value);
|
||||||
|
|
||||||
if ( section_length == -1 )
|
if (section_length == -1) {
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len += section_length;
|
len += section_length;
|
||||||
if (decode_is_closing_tag_number(&apdu[len], tag_number)) {
|
if (decode_is_closing_tag_number(&apdu[len], tag_number)) {
|
||||||
len++;
|
len++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -208,16 +194,22 @@ void testDevIdPropRef(
|
|||||||
|
|
||||||
ct_test(pTest, outLen == inLen);
|
ct_test(pTest, outLen == inLen);
|
||||||
|
|
||||||
ct_test(pTest, inData.objectIdentifier.instance == outData.objectIdentifier.instance);
|
ct_test(pTest,
|
||||||
ct_test(pTest, inData.objectIdentifier.type == outData.objectIdentifier.type);
|
inData.objectIdentifier.instance == outData.objectIdentifier.instance);
|
||||||
|
ct_test(pTest,
|
||||||
|
inData.objectIdentifier.type == outData.objectIdentifier.type);
|
||||||
|
|
||||||
ct_test(pTest, inData.propertyIdentifier == outData.propertyIdentifier);
|
ct_test(pTest, inData.propertyIdentifier == outData.propertyIdentifier);
|
||||||
|
|
||||||
ct_test(pTest, inData.arrayIndex == outData.arrayIndex);
|
ct_test(pTest, inData.arrayIndex == outData.arrayIndex);
|
||||||
|
|
||||||
ct_test(pTest, inData.deviceIndentifier.instance == outData.deviceIndentifier.instance);
|
ct_test(pTest,
|
||||||
ct_test(pTest, inData.deviceIndentifier.type == outData.deviceIndentifier.type);
|
inData.deviceIndentifier.instance ==
|
||||||
|
outData.deviceIndentifier.instance);
|
||||||
|
ct_test(pTest,
|
||||||
|
inData.deviceIndentifier.type == outData.deviceIndentifier.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST_DEV_ID_PROP_REF
|
#ifdef TEST_DEV_ID_PROP_REF
|
||||||
|
|
||||||
int main(
|
int main(
|
||||||
|
|||||||
@@ -53,105 +53,116 @@ int bacapp_decode_property_state(
|
|||||||
decode_tag_number_and_value(&apdu[len], (uint8_t *) & value->tag,
|
decode_tag_number_and_value(&apdu[len], (uint8_t *) & value->tag,
|
||||||
&len_value_type);
|
&len_value_type);
|
||||||
|
|
||||||
if ( -1 == section_length )
|
if (-1 == section_length) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
len += section_length;
|
len += section_length;
|
||||||
switch(value->tag)
|
switch (value->tag) {
|
||||||
{
|
|
||||||
case BOOLEAN_VALUE:
|
case BOOLEAN_VALUE:
|
||||||
value->state.booleanValue = decode_boolean(len_value_type);
|
value->state.booleanValue = decode_boolean(len_value_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BINARY_VALUE:
|
case BINARY_VALUE:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.binaryValue)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.binaryValue))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_TYPE:
|
case EVENT_TYPE:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.eventType)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.eventType))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POLARITY:
|
case POLARITY:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.polarity)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.polarity))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROGRAM_CHANGE:
|
case PROGRAM_CHANGE:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.programChange)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.programChange))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROGRAM_STATE:
|
case PROGRAM_STATE:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.programState)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.programState))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REASON_FOR_HALT:
|
case REASON_FOR_HALT:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.programError)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.programError))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RELIABILITY:
|
case RELIABILITY:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.reliability)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.reliability))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE:
|
case STATE:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.state)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.state))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYSTEM_STATUS:
|
case SYSTEM_STATUS:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.systemStatus)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.systemStatus))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNITS:
|
case UNITS:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.units)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.units))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNSIGNED_VALUE:
|
case UNSIGNED_VALUE:
|
||||||
if ( -1 == ( section_length = decode_unsigned(&apdu[len], len_value_type, &value->state.unsignedValue)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_unsigned(&apdu[len], len_value_type,
|
||||||
|
&value->state.unsignedValue))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIFE_SAFETY_MODE:
|
case LIFE_SAFETY_MODE:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.lifeSafetyMode)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.lifeSafetyMode))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIFE_SAFETY_STATE:
|
case LIFE_SAFETY_STATE:
|
||||||
if ( -1 == ( section_length = decode_enumerated(&apdu[len], len_value_type, &value->state.lifeSafetyState)))
|
if (-1 == (section_length =
|
||||||
{
|
decode_enumerated(&apdu[len], len_value_type,
|
||||||
|
&value->state.lifeSafetyState))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -174,27 +185,19 @@ int bacapp_decode_context_property_state(
|
|||||||
|
|
||||||
if (decode_is_opening_tag_number(&apdu[len], tag_number)) {
|
if (decode_is_opening_tag_number(&apdu[len], tag_number)) {
|
||||||
len++;
|
len++;
|
||||||
section_length = bacapp_decode_property_state(
|
section_length = bacapp_decode_property_state(&apdu[len], value);
|
||||||
&apdu[len], value);
|
|
||||||
|
|
||||||
if ( section_length == -1 )
|
if (section_length == -1) {
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len += section_length;
|
len += section_length;
|
||||||
if (decode_is_closing_tag_number(&apdu[len], tag_number)) {
|
if (decode_is_closing_tag_number(&apdu[len], tag_number)) {
|
||||||
len++;
|
len++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
@@ -206,62 +209,88 @@ int bacapp_encode_property_state(
|
|||||||
{
|
{
|
||||||
int len = 0; /* length of each encoding */
|
int len = 0; /* length of each encoding */
|
||||||
if (value && apdu) {
|
if (value && apdu) {
|
||||||
switch(value->tag)
|
switch (value->tag) {
|
||||||
{
|
|
||||||
case BOOLEAN_VALUE:
|
case BOOLEAN_VALUE:
|
||||||
len = encode_context_boolean(&apdu[0], 0, value->state.booleanValue);
|
len =
|
||||||
|
encode_context_boolean(&apdu[0], 0,
|
||||||
|
value->state.booleanValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BINARY_VALUE:
|
case BINARY_VALUE:
|
||||||
len = encode_context_enumerated(&apdu[0], 1, value->state.binaryValue);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 1,
|
||||||
|
value->state.binaryValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_TYPE:
|
case EVENT_TYPE:
|
||||||
len = encode_context_enumerated(&apdu[0], 2, value->state.eventType);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 2,
|
||||||
|
value->state.eventType);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POLARITY:
|
case POLARITY:
|
||||||
len = encode_context_enumerated(&apdu[0], 3, value->state.polarity);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 3,
|
||||||
|
value->state.polarity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROGRAM_CHANGE:
|
case PROGRAM_CHANGE:
|
||||||
len = encode_context_enumerated(&apdu[0], 4, value->state.programChange);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 4,
|
||||||
|
value->state.programChange);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROGRAM_STATE:
|
case PROGRAM_STATE:
|
||||||
len = encode_context_enumerated(&apdu[0], 5, value->state.programState);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 5,
|
||||||
|
value->state.programState);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REASON_FOR_HALT:
|
case REASON_FOR_HALT:
|
||||||
len = encode_context_enumerated(&apdu[0], 6, value->state.programError);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 6,
|
||||||
|
value->state.programError);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RELIABILITY:
|
case RELIABILITY:
|
||||||
len = encode_context_enumerated(&apdu[0], 7, value->state.reliability);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 7,
|
||||||
|
value->state.reliability);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE:
|
case STATE:
|
||||||
len = encode_context_enumerated(&apdu[0], 8, value->state.state);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 8, value->state.state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYSTEM_STATUS:
|
case SYSTEM_STATUS:
|
||||||
len = encode_context_enumerated(&apdu[0], 9, value->state.systemStatus);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 9,
|
||||||
|
value->state.systemStatus);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNITS:
|
case UNITS:
|
||||||
len = encode_context_enumerated(&apdu[0], 10, value->state.units);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 10,
|
||||||
|
value->state.units);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNSIGNED_VALUE:
|
case UNSIGNED_VALUE:
|
||||||
len = encode_context_unsigned(&apdu[0], 11, value->state.unsignedValue);
|
len =
|
||||||
|
encode_context_unsigned(&apdu[0], 11,
|
||||||
|
value->state.unsignedValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIFE_SAFETY_MODE:
|
case LIFE_SAFETY_MODE:
|
||||||
len = encode_context_enumerated(&apdu[0], 12, value->state.lifeSafetyMode);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 12,
|
||||||
|
value->state.lifeSafetyMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIFE_SAFETY_STATE:
|
case LIFE_SAFETY_STATE:
|
||||||
len = encode_context_enumerated(&apdu[0], 13, value->state.lifeSafetyState);
|
len =
|
||||||
|
encode_context_enumerated(&apdu[0], 13,
|
||||||
|
value->state.lifeSafetyState);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -85,16 +85,15 @@ int decode_context_real(
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
if (decode_is_context_tag(&apdu[len], tag_number)) {
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
len +=
|
||||||
&len_value);
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
|
||||||
len += decode_real(&apdu[len], real_value);
|
len += decode_real(&apdu[len], real_value);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len = -1;
|
len = -1;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from clause 20.2.6 Encoding of a Real Number Value */
|
/* from clause 20.2.6 Encoding of a Real Number Value */
|
||||||
/* returns the number of apdu bytes consumed */
|
/* returns the number of apdu bytes consumed */
|
||||||
int encode_bacnet_real(
|
int encode_bacnet_real(
|
||||||
|
|||||||
+10
-20
@@ -439,8 +439,7 @@ int bacapp_encode_context_datetime(
|
|||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
|
|
||||||
|
|
||||||
if ( apdu && value )
|
if (apdu && value) {
|
||||||
{
|
|
||||||
len = encode_opening_tag(&apdu[apdu_len], tag_number);
|
len = encode_opening_tag(&apdu[apdu_len], tag_number);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
@@ -463,14 +462,14 @@ int bacapp_decode_datetime(
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
int section_len;
|
int section_len;
|
||||||
|
|
||||||
if ( -1 == ( section_len = decode_application_date(&apdu[len], &value->date) ) )
|
if (-1 == (section_len =
|
||||||
{
|
decode_application_date(&apdu[len], &value->date))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_len;
|
len += section_len;
|
||||||
|
|
||||||
if ( -1 == ( section_len = decode_application_time(&apdu[len], &value->time) ) )
|
if (-1 == (section_len =
|
||||||
{
|
decode_application_time(&apdu[len], &value->time))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,27 +488,19 @@ int bacapp_decode_context_datetime(
|
|||||||
|
|
||||||
if (decode_is_opening_tag_number(&apdu[apdu_len], tag_number)) {
|
if (decode_is_opening_tag_number(&apdu[apdu_len], tag_number)) {
|
||||||
apdu_len++;
|
apdu_len++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( -1 == (len = bacapp_decode_datetime(&apdu[apdu_len], value)))
|
if (-1 == (len = bacapp_decode_datetime(&apdu[apdu_len], value))) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decode_is_closing_tag_number(&apdu[apdu_len], tag_number))
|
if (decode_is_closing_tag_number(&apdu[apdu_len], tag_number)) {
|
||||||
{
|
|
||||||
apdu_len++;
|
apdu_len++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return apdu_len;
|
return apdu_len;
|
||||||
@@ -909,4 +900,3 @@ int main(
|
|||||||
|
|
||||||
#endif /* TEST_DATE_TIME */
|
#endif /* TEST_DATE_TIME */
|
||||||
#endif /* TEST */
|
#endif /* TEST */
|
||||||
|
|
||||||
|
|||||||
+516
-369
File diff suppressed because it is too large
Load Diff
@@ -40,8 +40,8 @@ size_t memcopy(
|
|||||||
void *src,
|
void *src,
|
||||||
size_t offset, /* where in dest to put the data */
|
size_t offset, /* where in dest to put the data */
|
||||||
size_t len, /* amount of data to copy */
|
size_t len, /* amount of data to copy */
|
||||||
size_t max) /* total size of destination */
|
size_t max)
|
||||||
{
|
{ /* total size of destination */
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t copy_len = 0;
|
size_t copy_len = 0;
|
||||||
char *s1, *s2;
|
char *s1, *s2;
|
||||||
@@ -73,15 +73,14 @@ void test_memcopy(
|
|||||||
char big_buffer[480] = "";
|
char big_buffer[480] = "";
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
len = memcopy(&buffer[0], &data1[0], 0,
|
len = memcopy(&buffer[0], &data1[0], 0, sizeof(data1), sizeof(buffer));
|
||||||
sizeof(data1), sizeof(buffer));
|
|
||||||
ct_test(pTest, len == sizeof(data1));
|
ct_test(pTest, len == sizeof(data1));
|
||||||
ct_test(pTest, memcmp(&buffer[0], &data1[0], len) == 0);
|
ct_test(pTest, memcmp(&buffer[0], &data1[0], len) == 0);
|
||||||
len = memcopy(&buffer[0], &data2[0], len,
|
len = memcopy(&buffer[0], &data2[0], len, sizeof(data2), sizeof(buffer));
|
||||||
sizeof(data2), sizeof(buffer));
|
|
||||||
ct_test(pTest, len == sizeof(data2));
|
ct_test(pTest, len == sizeof(data2));
|
||||||
len = memcopy(&buffer[0], &big_buffer[0], 1,
|
len =
|
||||||
sizeof(big_buffer), sizeof(buffer));
|
memcopy(&buffer[0], &big_buffer[0], 1, sizeof(big_buffer),
|
||||||
|
sizeof(buffer));
|
||||||
ct_test(pTest, len == 0);
|
ct_test(pTest, len == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ int rpm_encode_apdu(
|
|||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
rpm_object = read_access_data;
|
rpm_object = read_access_data;
|
||||||
while (rpm_object) {
|
while (rpm_object) {
|
||||||
len = encode_context_object_id(&apdu_temp[0], 0,
|
len =
|
||||||
rpm_object->object_type,
|
encode_context_object_id(&apdu_temp[0], 0, rpm_object->object_type,
|
||||||
rpm_object->object_instance);
|
rpm_object->object_instance);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
@@ -144,7 +144,8 @@ int rpm_encode_apdu(
|
|||||||
rpm_property = rpm_object->listOfProperties;
|
rpm_property = rpm_object->listOfProperties;
|
||||||
while (rpm_property) {
|
while (rpm_property) {
|
||||||
/* stuff as many properties into it as APDU length will allow */
|
/* stuff as many properties into it as APDU length will allow */
|
||||||
len = encode_context_enumerated(&apdu_temp[0], 0,
|
len =
|
||||||
|
encode_context_enumerated(&apdu_temp[0], 0,
|
||||||
rpm_property->propertyIdentifier);
|
rpm_property->propertyIdentifier);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
@@ -153,9 +154,11 @@ int rpm_encode_apdu(
|
|||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* optional array index */
|
/* optional array index */
|
||||||
if (rpm_property->propertyArrayIndex != BACNET_ARRAY_ALL) {
|
if (rpm_property->propertyArrayIndex != BACNET_ARRAY_ALL) {
|
||||||
len = encode_context_unsigned(&apdu_temp[0], 1,
|
len =
|
||||||
|
encode_context_unsigned(&apdu_temp[0], 1,
|
||||||
rpm_property->propertyArrayIndex);
|
rpm_property->propertyArrayIndex);
|
||||||
len = memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
len =
|
||||||
|
memcopy(&apdu[0], &apdu_temp[0], apdu_len, len, max_apdu);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,8 @@
|
|||||||
void sbuf_init(
|
void sbuf_init(
|
||||||
STATIC_BUFFER * b, /* static buffer structure */
|
STATIC_BUFFER * b, /* static buffer structure */
|
||||||
char *data, /* data block */
|
char *data, /* data block */
|
||||||
unsigned size) /* actual size, in bytes, of the data block or array of data */
|
unsigned size)
|
||||||
{
|
{ /* actual size, in bytes, of the data block or array of data */
|
||||||
if (b) {
|
if (b) {
|
||||||
b->data = data;
|
b->data = data;
|
||||||
b->size = size;
|
b->size = size;
|
||||||
|
|||||||
@@ -47,18 +47,23 @@ int bacapp_encode_context_timestamp(
|
|||||||
len = encode_opening_tag(&apdu[apdu_len], tag_number);
|
len = encode_opening_tag(&apdu[apdu_len], tag_number);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
switch(value->tag)
|
switch (value->tag) {
|
||||||
{
|
|
||||||
case TIME_STAMP_TIME:
|
case TIME_STAMP_TIME:
|
||||||
len = encode_context_time(&apdu[apdu_len], 0, &value->value.time);
|
len =
|
||||||
|
encode_context_time(&apdu[apdu_len], 0,
|
||||||
|
&value->value.time);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIME_STAMP_SEQUENCE:
|
case TIME_STAMP_SEQUENCE:
|
||||||
len = encode_context_unsigned(&apdu[apdu_len], 1, value->value.sequenceNum);
|
len =
|
||||||
|
encode_context_unsigned(&apdu[apdu_len], 1,
|
||||||
|
value->value.sequenceNum);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIME_STAMP_DATETIME:
|
case TIME_STAMP_DATETIME:
|
||||||
len = bacapp_encode_context_datetime(&apdu[apdu_len], 2, &value->value.dateTime);
|
len =
|
||||||
|
bacapp_encode_context_datetime(&apdu[apdu_len], 2,
|
||||||
|
&value->value.dateTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -92,49 +97,42 @@ int bacapp_decode_context_timestamp(
|
|||||||
decode_tag_number_and_value(&apdu[len], &value->tag,
|
decode_tag_number_and_value(&apdu[len], &value->tag,
|
||||||
&len_value_type);
|
&len_value_type);
|
||||||
|
|
||||||
if ( -1 == section_len )
|
if (-1 == section_len) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
switch( value->tag )
|
switch (value->tag) {
|
||||||
{
|
|
||||||
case TIME_STAMP_TIME:
|
case TIME_STAMP_TIME:
|
||||||
if ( (section_len = decode_context_bacnet_time(&apdu[len], TIME_STAMP_TIME, &value->value.time)) == -1 )
|
if ((section_len =
|
||||||
{
|
decode_context_bacnet_time(&apdu[len], TIME_STAMP_TIME,
|
||||||
|
&value->value.time)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len += section_len;
|
len += section_len;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIME_STAMP_SEQUENCE:
|
case TIME_STAMP_SEQUENCE:
|
||||||
if ( (section_len = decode_context_unsigned(&apdu[len], TIME_STAMP_SEQUENCE, &sequenceNum)) == -1 )
|
if ((section_len =
|
||||||
{
|
decode_context_unsigned(&apdu[len],
|
||||||
|
TIME_STAMP_SEQUENCE, &sequenceNum)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else {
|
||||||
else
|
if (sequenceNum <= 0xffff) {
|
||||||
{
|
|
||||||
if ( sequenceNum <= 0xffff )
|
|
||||||
{
|
|
||||||
len += section_len;
|
len += section_len;
|
||||||
value->value.sequenceNum = (uint16_t) sequenceNum;
|
value->value.sequenceNum = (uint16_t) sequenceNum;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TIME_STAMP_DATETIME:
|
case TIME_STAMP_DATETIME:
|
||||||
if ( (section_len = bacapp_decode_context_datetime(&apdu[len], TIME_STAMP_DATETIME, &value->value.dateTime)) == -1 )
|
if ((section_len =
|
||||||
{
|
bacapp_decode_context_datetime(&apdu[len],
|
||||||
|
TIME_STAMP_DATETIME,
|
||||||
|
&value->value.dateTime)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
len += section_len;
|
len += section_len;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -144,9 +142,7 @@ int bacapp_decode_context_timestamp(
|
|||||||
}
|
}
|
||||||
if (decode_is_closing_tag_number(&apdu[len], tag_number)) {
|
if (decode_is_closing_tag_number(&apdu[len], tag_number)) {
|
||||||
len++;
|
len++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,7 +176,9 @@ void testTimestampSequence(
|
|||||||
|
|
||||||
ct_test(pTest, inLen == outLen);
|
ct_test(pTest, inLen == outLen);
|
||||||
ct_test(pTest, testTimestampIn.tag == testTimestampOut.tag);
|
ct_test(pTest, testTimestampIn.tag == testTimestampOut.tag);
|
||||||
ct_test(pTest, testTimestampIn.value.sequenceNum == testTimestampOut.value.sequenceNum);
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.sequenceNum ==
|
||||||
|
testTimestampOut.value.sequenceNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testTimestampTime(
|
void testTimestampTime(
|
||||||
@@ -206,10 +204,15 @@ void testTimestampTime(
|
|||||||
|
|
||||||
ct_test(pTest, inLen == outLen);
|
ct_test(pTest, inLen == outLen);
|
||||||
ct_test(pTest, testTimestampIn.tag == testTimestampOut.tag);
|
ct_test(pTest, testTimestampIn.tag == testTimestampOut.tag);
|
||||||
ct_test(pTest, testTimestampIn.value.time.hour == testTimestampOut.value.time.hour);
|
ct_test(pTest,
|
||||||
ct_test(pTest, testTimestampIn.value.time.min == testTimestampOut.value.time.min);
|
testTimestampIn.value.time.hour == testTimestampOut.value.time.hour);
|
||||||
ct_test(pTest, testTimestampIn.value.time.sec == testTimestampOut.value.time.sec);
|
ct_test(pTest,
|
||||||
ct_test(pTest, testTimestampIn.value.time.hundredths == testTimestampOut.value.time.hundredths);
|
testTimestampIn.value.time.min == testTimestampOut.value.time.min);
|
||||||
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.time.sec == testTimestampOut.value.time.sec);
|
||||||
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.time.hundredths ==
|
||||||
|
testTimestampOut.value.time.hundredths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testTimestampTimeDate(
|
void testTimestampTimeDate(
|
||||||
@@ -239,15 +242,31 @@ void testTimestampTimeDate(
|
|||||||
|
|
||||||
ct_test(pTest, inLen == outLen);
|
ct_test(pTest, inLen == outLen);
|
||||||
ct_test(pTest, testTimestampIn.tag == testTimestampOut.tag);
|
ct_test(pTest, testTimestampIn.tag == testTimestampOut.tag);
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.time.hour == testTimestampOut.value.dateTime.time.hour);
|
ct_test(pTest,
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.time.min == testTimestampOut.value.dateTime.time.min);
|
testTimestampIn.value.dateTime.time.hour ==
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.time.sec == testTimestampOut.value.dateTime.time.sec);
|
testTimestampOut.value.dateTime.time.hour);
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.time.hundredths == testTimestampOut.value.dateTime.time.hundredths);
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.dateTime.time.min ==
|
||||||
|
testTimestampOut.value.dateTime.time.min);
|
||||||
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.dateTime.time.sec ==
|
||||||
|
testTimestampOut.value.dateTime.time.sec);
|
||||||
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.dateTime.time.hundredths ==
|
||||||
|
testTimestampOut.value.dateTime.time.hundredths);
|
||||||
|
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.date.year == testTimestampOut.value.dateTime.date.year);
|
ct_test(pTest,
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.date.month == testTimestampOut.value.dateTime.date.month);
|
testTimestampIn.value.dateTime.date.year ==
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.date.wday == testTimestampOut.value.dateTime.date.wday);
|
testTimestampOut.value.dateTime.date.year);
|
||||||
ct_test(pTest, testTimestampIn.value.dateTime.date.day == testTimestampOut.value.dateTime.date.day);
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.dateTime.date.month ==
|
||||||
|
testTimestampOut.value.dateTime.date.month);
|
||||||
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.dateTime.date.wday ==
|
||||||
|
testTimestampOut.value.dateTime.date.wday);
|
||||||
|
ct_test(pTest,
|
||||||
|
testTimestampIn.value.dateTime.date.day ==
|
||||||
|
testTimestampOut.value.dateTime.date.day);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,4 +299,3 @@ int main(
|
|||||||
|
|
||||||
#endif // TEST_TIME_STAMP
|
#endif // TEST_TIME_STAMP
|
||||||
#endif // TEST
|
#endif // TEST
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user