void test_Private_Transfer_Request( Test * pTest) { uint8_t apdu[480] = { 0 }; uint8_t test_value[480] = { 0 }; int len = 0; int apdu_len = 0; uint8_t invoke_id = 128; uint8_t test_invoke_id = 0; int private_data_len = 0; char private_data_chunk[33] = { "00112233445566778899AABBCCDDEEFF" }; BACNET_APPLICATION_DATA_VALUE data_value = { 0 }; BACNET_APPLICATION_DATA_VALUE test_data_value = { 0 }; BACNET_PRIVATE_TRANSFER_DATA private_data = { 0 }; BACNET_PRIVATE_TRANSFER_DATA test_data = { 0 }; bool status = false; private_data.vendorID = BACNET_VENDOR_ID; private_data.serviceNumber = 1; status = bacapp_parse_application_data(BACNET_APPLICATION_TAG_OCTET_STRING, &private_data_chunk[0], &data_value); ct_test(pTest, status == true); private_data_len = bacapp_encode_application_data(&test_value[0], &data_value); private_data.serviceParameters = &test_value[0]; private_data.serviceParametersLen = private_data_len; len = ptransfer_encode_apdu(&apdu[0], invoke_id, &private_data); ct_test(pTest, len != 0); apdu_len = len; len = ptransfer_decode_apdu(&apdu[0], apdu_len, &test_invoke_id, &test_data); ct_test(pTest, len != -1); ct_test(pTest, test_data.vendorID == private_data.vendorID); ct_test(pTest, test_data.serviceNumber == private_data.serviceNumber); ct_test(pTest, test_data.serviceParametersLen == private_data.serviceParametersLen); len = bacapp_decode_application_data(test_data.serviceParameters, test_data.serviceParametersLen, &test_data_value); ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true); return; }
void test_Unconfirmed_Private_Transfer_Request( Test * pTest) { uint8_t apdu[480] = { 0 }; uint8_t test_value[480] = { 0 }; int len = 0; int apdu_len = 0; uint8_t invoke_id = 128; uint8_t test_invoke_id = 0; int private_data_len = 0; uint8_t private_data_chunk[32] = { "I Love You, Patricia!" }; BACNET_APPLICATION_DATA_VALUE data_value; BACNET_APPLICATION_DATA_VALUE test_data_value; BACNET_PRIVATE_TRANSFER_DATA private_data; BACNET_PRIVATE_TRANSFER_DATA test_data; private_data.vendorID = BACNET_VENDOR_ID; private_data.serviceNumber = 1; bacapp_parse_application_data(BACNET_APPLICATION_TAG_OCTET_STRING, &private_data_chunk[0], &data_value); private_data_len = bacapp_encode_application_data(&test_value[0], &data_value); private_data.serviceParameters = &test_value[0]; private_data.serviceParametersLen = private_data_len; len = uptransfer_encode_apdu(&apdu[0], invoke_id, &private_data); ct_test(pTest, len != 0); apdu_len = len; len = ptransfer_decode_apdu(&apdu[0], apdu_len, &test_invoke_id, &test_data); ct_test(pTest, len != -1); ct_test(pTest, test_data.vendorID == private_data.vendorID); ct_test(pTest, test_data.serviceNumber == private_data.serviceNumber); ct_test(pTest, test_data.serviceParametersLen == private_data.serviceParametersLen); len = bacapp_decode_application_data(test_data.serviceParameters, test_data.serviceParametersLen, &test_data_value); ct_test(pTest, bacapp_same_value(&data_value, &test_data_value) == true); return; }