Updated unit tests for objects and services, and corrected some portability problems. Thanks, Sergei! Didn't fix mstp or load control unit test results.
This commit is contained in:
@@ -484,6 +484,20 @@ bool Analog_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testAnalogOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -21,19 +21,19 @@ SRCS = ao.c \
|
||||
TARGET = analog_output
|
||||
|
||||
all: ${TARGET}
|
||||
|
||||
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
||||
${TARGET}: ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf core ${TARGET} $(OBJS)
|
||||
|
||||
|
||||
@@ -441,6 +441,20 @@ bool Analog_Value_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testAnalog_Value(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -480,6 +480,20 @@ bool Binary_Input_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testBinaryInput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -448,6 +448,20 @@ bool Binary_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testBinaryOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -430,6 +430,20 @@ bool Binary_Value_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testBinary_Value(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -1435,6 +1435,46 @@ void Routing_Device_Init(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WPValidateString(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
int iMaxLen,
|
||||
bool bEmptyAllowed,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
iMaxLen=iMaxLen;
|
||||
bEmptyAllowed=bEmptyAllowed;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int handler_cov_encode_subscriptions(
|
||||
uint8_t * apdu,
|
||||
int max_apdu)
|
||||
{
|
||||
apdu=apdu;
|
||||
max_apdu=max_apdu;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void testDevice(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
CC = gcc
|
||||
SRC_DIR = ../../src
|
||||
TEST_DIR = ../../test
|
||||
INCLUDES = -I../../include -I$(TEST_DIR) -I.
|
||||
PORTS_DIR = ../../ports/linux
|
||||
INCLUDES = -I../../include -I$(TEST_DIR) -I$(PORTS_DIR) -I.
|
||||
DEFINES = -DBIG_ENDIAN=0
|
||||
DEFINES += -DTEST -DBACDL_TEST
|
||||
DEFINES += -DBACAPP_ALL
|
||||
@@ -21,6 +22,8 @@ SRCS = device.c \
|
||||
$(SRC_DIR)/bactext.c \
|
||||
$(SRC_DIR)/indtext.c \
|
||||
$(SRC_DIR)/apdu.c \
|
||||
$(SRC_DIR)/address.c \
|
||||
$(SRC_DIR)/bacaddr.c \
|
||||
$(SRC_DIR)/dcc.c \
|
||||
$(SRC_DIR)/version.c \
|
||||
$(TEST_DIR)/ctest.c
|
||||
@@ -28,19 +31,19 @@ SRCS = device.c \
|
||||
TARGET = device
|
||||
|
||||
all: ${TARGET}
|
||||
|
||||
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
||||
${TARGET}: ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
${CC} -o $@ ${OBJS}
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $*.c -o $@
|
||||
|
||||
|
||||
depend:
|
||||
rm -f .depend
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf core ${TARGET} $(OBJS)
|
||||
|
||||
|
||||
@@ -1089,8 +1089,6 @@ static void Load_Control_WriteProperty_Request_Shed_Percent(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1104,7 +1102,7 @@ static void Load_Control_WriteProperty_Request_Shed_Percent(
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
#endif
|
||||
@@ -1117,8 +1115,6 @@ static void Load_Control_WriteProperty_Request_Shed_Level(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1132,7 +1128,7 @@ static void Load_Control_WriteProperty_Request_Shed_Level(
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1145,8 +1141,6 @@ static void Load_Control_WriteProperty_Request_Shed_Amount(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1160,7 +1154,7 @@ static void Load_Control_WriteProperty_Request_Shed_Amount(
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
#endif
|
||||
@@ -1173,8 +1167,6 @@ static void Load_Control_WriteProperty_Enable(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1189,7 +1181,7 @@ static void Load_Control_WriteProperty_Enable(
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1201,8 +1193,6 @@ static void Load_Control_WriteProperty_Shed_Duration(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1216,7 +1206,7 @@ static void Load_Control_WriteProperty_Shed_Duration(
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1228,8 +1218,6 @@ static void Load_Control_WriteProperty_Duty_Window(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1243,7 +1231,7 @@ static void Load_Control_WriteProperty_Duty_Window(
|
||||
wp_data.application_data_len =
|
||||
bacapp_encode_data(&wp_data.application_data[0], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1255,8 +1243,6 @@ static void Load_Control_WriteProperty_Start_Time_Wildcards(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1277,7 +1263,7 @@ static void Load_Control_WriteProperty_Start_Time_Wildcards(
|
||||
bacapp_encode_data(&wp_data.application_data[len], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
wp_data.application_data_len += len;
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
@@ -1296,8 +1282,6 @@ static void Load_Control_WriteProperty_Start_Time(
|
||||
bool status = false;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
BACNET_WRITE_PROPERTY_DATA wp_data;
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
|
||||
wp_data.object_type = OBJECT_LOAD_CONTROL;
|
||||
wp_data.object_instance = instance;
|
||||
@@ -1318,7 +1302,7 @@ static void Load_Control_WriteProperty_Start_Time(
|
||||
bacapp_encode_data(&wp_data.application_data[len], &value);
|
||||
ct_test(pTest, wp_data.application_data_len > 0);
|
||||
wp_data.application_data_len += len;
|
||||
status = Load_Control_Write_Property(&wp_data, &error_class, &error_code);
|
||||
status = Load_Control_Write_Property(&wp_data);
|
||||
ct_test(pTest, status == true);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
/* Lighting Output Objects - customize for your use */
|
||||
|
||||
/* WARNING! This object is still BACnet DRAFT status!
|
||||
If you need to implement in a real product, you will
|
||||
/* WARNING! This object is still BACnet DRAFT status!
|
||||
If you need to implement in a real product, you will
|
||||
need to modify the new OBJECT type and properties to
|
||||
be in the proprietrary range to be BACnet compliant */
|
||||
|
||||
@@ -606,6 +606,20 @@ bool Lighting_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testLightingOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -361,6 +361,20 @@ bool Life_Safety_Point_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testLifeSafetyPoint(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -525,6 +525,20 @@ bool Multistate_Input_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testMultistateInput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -451,6 +451,20 @@ bool Multistate_Output_Write_Property(
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
bool WPValidateArgType(
|
||||
BACNET_APPLICATION_DATA_VALUE * pValue,
|
||||
uint8_t ucExpectedTag,
|
||||
BACNET_ERROR_CLASS * pErrorClass,
|
||||
BACNET_ERROR_CODE * pErrorCode)
|
||||
{
|
||||
pValue=pValue;
|
||||
ucExpectedTag=ucExpectedTag;
|
||||
pErrorClass=pErrorClass;
|
||||
pErrorCode=pErrorCode;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void testMultistateOutput(
|
||||
Test * pTest)
|
||||
{
|
||||
|
||||
@@ -2271,13 +2271,13 @@ void testBACDCodeObject(
|
||||
uint8_t encoded_array[4] = {
|
||||
0
|
||||
};
|
||||
BACNET_OBJECT_TYPE type = OBJECT_BINARY_INPUT;
|
||||
BACNET_OBJECT_TYPE decoded_type = OBJECT_ANALOG_OUTPUT;
|
||||
uint16_t type = OBJECT_BINARY_INPUT;
|
||||
uint16_t decoded_type = OBJECT_ANALOG_OUTPUT;
|
||||
uint32_t instance = 123;
|
||||
uint32_t decoded_instance = 0;
|
||||
|
||||
encode_bacnet_object_id(&encoded_array[0], type, instance);
|
||||
decode_object_id(&encoded_array[0], (uint16_t *) & decoded_type,
|
||||
decode_object_id(&encoded_array[0], &decoded_type,
|
||||
&decoded_instance);
|
||||
ct_test(pTest, decoded_type == type);
|
||||
ct_test(pTest, decoded_instance == instance);
|
||||
@@ -2287,7 +2287,7 @@ void testBACDCodeObject(
|
||||
for (type = 0; type < 1024; type++) {
|
||||
for (instance = 0; instance <= BACNET_MAX_INSTANCE; instance += 1024) {
|
||||
encode_bacnet_object_id(&encoded_array[0], type, instance);
|
||||
decode_object_id(&encoded_array[0], (uint16_t *) & decoded_type,
|
||||
decode_object_id(&encoded_array[0], &decoded_type,
|
||||
&decoded_instance);
|
||||
ct_test(pTest, decoded_type == type);
|
||||
ct_test(pTest, decoded_instance == instance);
|
||||
|
||||
@@ -329,8 +329,8 @@ void testDevIdPropRef(
|
||||
void testDevIdRef(
|
||||
Test * pTest)
|
||||
{
|
||||
BACNET_DEVICE_OBJECT_REFERENCE inData;
|
||||
BACNET_DEVICE_OBJECT_REFERENCE outData;
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE inData;
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE outData;
|
||||
uint8_t buffer[MAX_APDU];
|
||||
int inLen;
|
||||
int outLen;
|
||||
|
||||
@@ -389,24 +389,22 @@ int ptransfer_decode_apdu(
|
||||
int uptransfer_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_PRIVATE_TRANSFER_DATA * private_data)
|
||||
{
|
||||
int len = 0;
|
||||
unsigned offset = 0;
|
||||
|
||||
if (!apdu)
|
||||
if (!apdu) {
|
||||
return -1;
|
||||
}
|
||||
/* optional checking - most likely was already done prior to this call */
|
||||
if (apdu[0] != PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST)
|
||||
if (apdu[0] != PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST) {
|
||||
return -1;
|
||||
/* apdu[1] = encode_max_segs_max_apdu(0, MAX_APDU); */
|
||||
/* invoke id - filled in by net layer */
|
||||
*invoke_id = apdu[2];
|
||||
if (apdu[3] != SERVICE_UNCONFIRMED_PRIVATE_TRANSFER)
|
||||
}
|
||||
if (apdu[1] != SERVICE_UNCONFIRMED_PRIVATE_TRANSFER) {
|
||||
return -1;
|
||||
offset = 4;
|
||||
|
||||
}
|
||||
offset = 2;
|
||||
if (apdu_len > offset) {
|
||||
len =
|
||||
ptransfer_decode_service_request(&apdu[offset], apdu_len - offset,
|
||||
@@ -484,7 +482,7 @@ void test_Private_Transfer_Ack(
|
||||
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
||||
uint8_t test_value[480] = { 0 };
|
||||
int private_data_len = 0;
|
||||
uint8_t private_data_chunk[32] = { "I Love You, Patricia!" };
|
||||
char private_data_chunk[32] = { "I Love You, Patricia!" };
|
||||
BACNET_APPLICATION_DATA_VALUE data_value;
|
||||
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
||||
|
||||
@@ -535,7 +533,7 @@ void test_Private_Transfer_Error(
|
||||
BACNET_PRIVATE_TRANSFER_DATA test_data;
|
||||
uint8_t test_value[480] = { 0 };
|
||||
int private_data_len = 0;
|
||||
uint8_t private_data_chunk[32] = { "I Love You, Patricia!" };
|
||||
char private_data_chunk[32] = { "I Love You, Patricia!" };
|
||||
BACNET_APPLICATION_DATA_VALUE data_value;
|
||||
BACNET_APPLICATION_DATA_VALUE test_data_value;
|
||||
|
||||
@@ -582,7 +580,7 @@ void test_Private_Transfer_Request(
|
||||
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!" };
|
||||
char 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;
|
||||
@@ -623,10 +621,9 @@ void test_Unconfirmed_Private_Transfer_Request(
|
||||
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!" };
|
||||
char 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;
|
||||
@@ -642,11 +639,11 @@ void test_Unconfirmed_Private_Transfer_Request(
|
||||
private_data.serviceParameters = &test_value[0];
|
||||
private_data.serviceParametersLen = private_data_len;
|
||||
|
||||
len = uptransfer_encode_apdu(&apdu[0], invoke_id, &private_data);
|
||||
len = uptransfer_encode_apdu(&apdu[0], &private_data);
|
||||
ct_test(pTest, len != 0);
|
||||
apdu_len = len;
|
||||
len =
|
||||
ptransfer_decode_apdu(&apdu[0], apdu_len, &test_invoke_id, &test_data);
|
||||
uptransfer_decode_apdu(&apdu[0], apdu_len, &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);
|
||||
|
||||
+13
-16
@@ -1,9 +1,10 @@
|
||||
LOGFILE = test.log
|
||||
|
||||
all: abort address arf awf bacapp bacdcode bacerror bacint \
|
||||
bacstr cov crc datetime dcc fifo getevent filename iam ihave \
|
||||
indtext keylist key lso npdu rd reject ringbuf rp \
|
||||
rpm sbuf timesync whohas whois wp event
|
||||
all: abort address arf awf bacapp bacdcode bacerror bacint bacstr \
|
||||
cov crc datetime dcc event filename fifo getevent iam ihave \
|
||||
indtext keylist key memcopy npdu ptransfer \
|
||||
rd reject ringbuf rp rpm sbuf timesync \
|
||||
whohas whois wp objects
|
||||
|
||||
clean:
|
||||
rm ${LOGFILE}
|
||||
@@ -121,16 +122,6 @@ key: logfile test/key.mak
|
||||
( ./test/key >> ${LOGFILE} )
|
||||
make -C test -f key.mak clean
|
||||
|
||||
lso: logfile test/lso.mak
|
||||
make -C test -f lso.mak clean all
|
||||
( ./test/lso >> ${LOGFILE} )
|
||||
make -C test -f lso.mak clean
|
||||
|
||||
mstp: logfile test/mstp.mak
|
||||
make -C test -f mstp.mak clean all
|
||||
( ./test/mstp >> ${LOGFILE} )
|
||||
make -C test -f mstp.mak clean
|
||||
|
||||
memcopy: logfile test/memcopy.mak
|
||||
make -C test -f memcopy.mak clean all
|
||||
( ./test/memcopy >> ${LOGFILE} )
|
||||
@@ -196,7 +187,8 @@ wp: logfile test/wp.mak
|
||||
( ./test/wp >> ${LOGFILE} )
|
||||
make -C test -f wp.mak clean
|
||||
|
||||
# Objects
|
||||
objects: ai ao av bi bo bv device lc lo lso lsp mso
|
||||
|
||||
ai: logfile demo/object/ai.mak
|
||||
make -C demo/object -f ai.mak clean all
|
||||
( ./demo/object/analog_input >> ${LOGFILE} )
|
||||
@@ -218,7 +210,7 @@ bi: logfile demo/object/bi.mak
|
||||
|
||||
bo: logfile demo/object/bo.mak
|
||||
make -C demo/object -f bo.mak clean all
|
||||
( ./demo/object/binar_output >> ${LOGFILE} )
|
||||
( ./demo/object/binary_output >> ${LOGFILE} )
|
||||
make -C demo/object -f bo.mak clean
|
||||
|
||||
bv: logfile demo/object/bv.mak
|
||||
@@ -241,6 +233,11 @@ lo: logfile demo/object/lo.mak
|
||||
( ./demo/object/lighting_output >> ${LOGFILE} )
|
||||
make -C demo/object -f lo.mak clean
|
||||
|
||||
lso: logfile test/lso.mak
|
||||
make -C test -f lso.mak clean all
|
||||
( ./test/lso >> ${LOGFILE} )
|
||||
make -C test -f lso.mak clean
|
||||
|
||||
lsp: logfile demo/object/lsp.mak
|
||||
make -C demo/object -f lsp.mak clean all
|
||||
( ./demo/object/life_safety_point >> ${LOGFILE} )
|
||||
|
||||
Reference in New Issue
Block a user