Indented and cleaned up build. Added Multi-state Output to unit test script.
This commit is contained in:
+10
-10
@@ -558,13 +558,13 @@ typedef enum {
|
||||
EVENT_EXTENDED = 9,
|
||||
EVENT_BUFFER_READY = 10,
|
||||
EVENT_UNSIGNED_RANGE = 11
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* It is expected that these enumerated values will correspond to */
|
||||
/* the use of the complex-event-type CHOICE [6] of the */
|
||||
/* BACnetNotificationParameters production. */
|
||||
/* The last enumeration used in this version is 11. */
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* It is expected that these enumerated values will correspond to */
|
||||
/* the use of the complex-event-type CHOICE [6] of the */
|
||||
/* BACnetNotificationParameters production. */
|
||||
/* The last enumeration used in this version is 11. */
|
||||
} BACNET_EVENT_TYPE;
|
||||
|
||||
typedef enum {
|
||||
@@ -649,9 +649,9 @@ typedef enum {
|
||||
SILENCED_STATE_AUDIBLE_SILENCED = 1,
|
||||
SILENCED_STATE_VISIBLE_SILENCED = 2,
|
||||
SILENCED_STATE_ALL_SILENCED = 3
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
} BACNET_SILENCED_STATE;
|
||||
|
||||
typedef enum {
|
||||
|
||||
+22
-23
@@ -54,7 +54,7 @@ static int notify_encode_adpu(uint8_t * apdu, BACNET_COV_DATA * data)
|
||||
int len = 0; /* length of each encoding */
|
||||
int apdu_len = 0; /* total length of the apdu, return value */
|
||||
BACNET_PROPERTY_VALUE *value = NULL; /* value in list */
|
||||
|
||||
|
||||
if (apdu) {
|
||||
/* tag 0 - subscriberProcessIdentifier */
|
||||
len = encode_context_unsigned(&apdu[apdu_len],
|
||||
@@ -275,9 +275,7 @@ int cov_notify_decode_service_request(uint8_t * apdu,
|
||||
}
|
||||
|
||||
int ccov_notify_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_COV_DATA * data)
|
||||
unsigned apdu_len, uint8_t * invoke_id, BACNET_COV_DATA * data)
|
||||
{
|
||||
int len = 0;
|
||||
unsigned offset = 0;
|
||||
@@ -295,8 +293,9 @@ int ccov_notify_decode_apdu(uint8_t * apdu,
|
||||
|
||||
/* optional limits - must be used as a pair */
|
||||
if (apdu_len > offset) {
|
||||
len = cov_notify_decode_service_request(
|
||||
&apdu[offset], apdu_len - offset, data);
|
||||
len =
|
||||
cov_notify_decode_service_request(&apdu[offset],
|
||||
apdu_len - offset, data);
|
||||
}
|
||||
|
||||
return len;
|
||||
@@ -318,8 +317,9 @@ int ucov_notify_decode_apdu(uint8_t * apdu,
|
||||
/* optional limits - must be used as a pair */
|
||||
offset = 2;
|
||||
if (apdu_len > offset) {
|
||||
len = cov_notify_decode_service_request(
|
||||
&apdu[offset], apdu_len - offset, data);
|
||||
len =
|
||||
cov_notify_decode_service_request(&apdu[offset],
|
||||
apdu_len - offset, data);
|
||||
}
|
||||
|
||||
return len;
|
||||
@@ -336,7 +336,7 @@ int ucov_notify_send(uint8_t * buffer, BACNET_COV_DATA * data)
|
||||
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&buffer[0], &dest, NULL,
|
||||
false /* true for confirmed messages */,
|
||||
false /* true for confirmed messages */ ,
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
/* encode the APDU portion of the packet */
|
||||
@@ -355,18 +355,18 @@ int ucov_notify_send(uint8_t * buffer, BACNET_COV_DATA * data)
|
||||
#include "bacapp.h"
|
||||
|
||||
/* dummy function stubs */
|
||||
int npdu_encode_apdu(uint8_t * npdu, BACNET_ADDRESS * dest, BACNET_ADDRESS * src, bool data_expecting_reply, /* true for confirmed messages */
|
||||
BACNET_MESSAGE_PRIORITY priority)
|
||||
int npdu_encode_apdu(uint8_t * npdu, BACNET_ADDRESS * dest, BACNET_ADDRESS * src, bool data_expecting_reply, /* true for confirmed messages */
|
||||
BACNET_MESSAGE_PRIORITY priority)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* dummy function stubs */
|
||||
int datalink_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len) /* number of bytes of data */
|
||||
{
|
||||
return 0;
|
||||
int datalink_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len)
|
||||
{ /* number of bytes of data */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* dummy function stubs */
|
||||
@@ -377,12 +377,11 @@ void datalink_get_broadcast_address(BACNET_ADDRESS * dest)
|
||||
/* dummy function stubs */
|
||||
uint16_t Device_Max_APDU_Length_Accepted(void)
|
||||
{
|
||||
return MAX_APDU;
|
||||
return MAX_APDU;
|
||||
}
|
||||
|
||||
void testCOVNotifyData(Test * pTest,
|
||||
BACNET_COV_DATA * data,
|
||||
BACNET_COV_DATA * test_data)
|
||||
BACNET_COV_DATA * data, BACNET_COV_DATA * test_data)
|
||||
{
|
||||
ct_test(pTest,
|
||||
test_data->subscriberProcessIdentifier ==
|
||||
@@ -396,8 +395,7 @@ void testCOVNotifyData(Test * pTest,
|
||||
ct_test(pTest,
|
||||
test_data->monitoredObjectIdentifier.instance ==
|
||||
data->monitoredObjectIdentifier.instance);
|
||||
ct_test(pTest,
|
||||
test_data->timeRemaining == data->timeRemaining);
|
||||
ct_test(pTest, test_data->timeRemaining == data->timeRemaining);
|
||||
/* FIXME: test the listOfValues in some clever manner */
|
||||
}
|
||||
|
||||
@@ -418,7 +416,8 @@ void testUCOVNotifyData(Test * pTest, BACNET_COV_DATA * data)
|
||||
testCOVNotifyData(pTest, data, &test_data);
|
||||
}
|
||||
|
||||
void testCCOVNotifyData(Test * pTest, uint8_t invoke_id, BACNET_COV_DATA * data)
|
||||
void testCCOVNotifyData(Test * pTest, uint8_t invoke_id,
|
||||
BACNET_COV_DATA * data)
|
||||
{
|
||||
uint8_t apdu[480] = { 0 };
|
||||
int len = 0;
|
||||
|
||||
+1
-3
@@ -72,9 +72,7 @@ extern "C" {
|
||||
uint8_t invoke_id, BACNET_COV_DATA * data);
|
||||
|
||||
int ccov_notify_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_COV_DATA * data);
|
||||
unsigned apdu_len, uint8_t * invoke_id, BACNET_COV_DATA * data);
|
||||
|
||||
/* common for both confirmed and unconfirmed */
|
||||
int cov_notify_decode_service_request(uint8_t * apdu,
|
||||
|
||||
@@ -101,7 +101,8 @@ void handler_read_property(uint8_t * service_request,
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
fprintf(stderr, "Sending Read Property Ack for Device!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Read Property Ack for Device!\n");
|
||||
send = true;
|
||||
} else
|
||||
error = true;
|
||||
@@ -248,7 +249,8 @@ void handler_read_property(uint8_t * service_request,
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
fprintf(stderr, "Sending Read Property Ack for LSP!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Read Property Ack for LSP!\n");
|
||||
send = true;
|
||||
} else
|
||||
error = true;
|
||||
@@ -269,7 +271,8 @@ void handler_read_property(uint8_t * service_request,
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
fprintf(stderr, "Sending Read Property Ack for MSO!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Read Property Ack for MSO!\n");
|
||||
send = true;
|
||||
} else
|
||||
error = true;
|
||||
@@ -291,7 +294,8 @@ void handler_read_property(uint8_t * service_request,
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
fprintf(stderr, "Sending Read Property Ack for File!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Read Property Ack for File!\n");
|
||||
send = true;
|
||||
} else
|
||||
error = true;
|
||||
|
||||
@@ -96,14 +96,15 @@ void handler_write_property(uint8_t * service_request,
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for Device!\n");
|
||||
"Sending Write Property Simple Ack for Device!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY, error_class,
|
||||
error_code);
|
||||
fprintf(stderr, "Sending Write Property Error for Device!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Error for Device!\n");
|
||||
}
|
||||
break;
|
||||
case OBJECT_ANALOG_INPUT:
|
||||
@@ -123,7 +124,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr, "Sending Write Property Simple Ack for BO!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for BO!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
@@ -140,7 +142,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr, "Sending Write Property Simple Ack for BV!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for BV!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
@@ -157,7 +160,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr, "Sending Write Property Simple Ack for AO!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for AO!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
@@ -174,7 +178,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr, "Sending Write Property Simple Ack for AV!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for AV!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
@@ -191,7 +196,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr, "Sending Write Property Simple Ack for LSP!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for LSP!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
@@ -208,7 +214,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr, "Sending Write Property Simple Ack for MSO!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for MSO!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
@@ -226,7 +233,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||
fprintf(stderr, "Sending Write Property Simple Ack for File!\n");
|
||||
fprintf(stderr,
|
||||
"Sending Write Property Simple Ack for File!\n");
|
||||
} else {
|
||||
pdu_len +=
|
||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
|
||||
@@ -46,8 +46,7 @@
|
||||
/* Here is our Priority Array. They are supposed to be Real, but */
|
||||
/* we don't have that kind of memory, so we will use a single byte */
|
||||
/* and load a Real for returning the value when asked. */
|
||||
static uint8_t
|
||||
Analog_Value_Level[MAX_ANALOG_VALUES][BACNET_MAX_PRIORITY];
|
||||
static uint8_t Analog_Value_Level[MAX_ANALOG_VALUES][BACNET_MAX_PRIORITY];
|
||||
/* Writable out-of-service allows others to play with our Present Value */
|
||||
/* without changing the physical output */
|
||||
static bool Analog_Value_Out_Of_Service[MAX_ANALOG_VALUES];
|
||||
@@ -178,8 +177,7 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_tagged_enumerated(&apdu[0], OBJECT_ANALOG_VALUE);
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], OBJECT_ANALOG_VALUE);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
real_value = Analog_Value_Present_Value(object_instance);
|
||||
@@ -212,11 +210,11 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
/* if no index was specified, then try to encode the entire list */
|
||||
/* into one packet. */
|
||||
else if (array_index == BACNET_ARRAY_ALL) {
|
||||
object_index =
|
||||
Analog_Value_Instance_To_Index(object_instance);
|
||||
object_index = Analog_Value_Instance_To_Index(object_instance);
|
||||
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
|
||||
/* FIXME: check if we have room before adding it to APDU */
|
||||
if (Analog_Value_Level[object_index][i] == ANALOG_LEVEL_NULL)
|
||||
if (Analog_Value_Level[object_index][i] ==
|
||||
ANALOG_LEVEL_NULL)
|
||||
len = encode_tagged_null(&apdu[apdu_len]);
|
||||
else {
|
||||
real_value = Analog_Value_Level[object_index][i];
|
||||
@@ -233,8 +231,7 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
object_index =
|
||||
Analog_Value_Instance_To_Index(object_instance);
|
||||
object_index = Analog_Value_Instance_To_Index(object_instance);
|
||||
if (array_index <= BACNET_MAX_PRIORITY) {
|
||||
if (Analog_Value_Level[object_index][array_index] ==
|
||||
ANALOG_LEVEL_NULL)
|
||||
@@ -412,5 +409,5 @@ int main(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST_ANALOG_VALUE*/
|
||||
#endif /* TEST_ANALOG_VALUE */
|
||||
#endif /* TEST */
|
||||
|
||||
@@ -190,12 +190,12 @@ int bacfile_encode_property_apdu(uint8_t * apdu,
|
||||
break;
|
||||
case PROP_ARCHIVE:
|
||||
/* 12.13.8 Archive
|
||||
This property, of type BOOLEAN, indicates whether the File
|
||||
object has been saved for historical or backup purposes. This
|
||||
property shall be logical TRUE only if no changes have been
|
||||
made to the file data by internal processes or through File
|
||||
Access Services since the last time the object was archived.
|
||||
*/
|
||||
This property, of type BOOLEAN, indicates whether the File
|
||||
object has been saved for historical or backup purposes. This
|
||||
property shall be logical TRUE only if no changes have been
|
||||
made to the file data by internal processes or through File
|
||||
Access Services since the last time the object was archived.
|
||||
*/
|
||||
/* FIXME: get the actual value: note it may be inverse... */
|
||||
apdu_len = encode_tagged_boolean(&apdu[0], true);
|
||||
break;
|
||||
@@ -231,20 +231,17 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
switch (wp_data->object_property) {
|
||||
case PROP_ARCHIVE:
|
||||
/* 12.13.8 Archive
|
||||
This property, of type BOOLEAN, indicates whether the File
|
||||
object has been saved for historical or backup purposes. This
|
||||
property shall be logical TRUE only if no changes have been
|
||||
made to the file data by internal processes or through File
|
||||
Access Services since the last time the object was archived. */
|
||||
This property, of type BOOLEAN, indicates whether the File
|
||||
object has been saved for historical or backup purposes. This
|
||||
property shall be logical TRUE only if no changes have been
|
||||
made to the file data by internal processes or through File
|
||||
Access Services since the last time the object was archived. */
|
||||
if (wp_data->value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
|
||||
if (wp_data->value.type.Boolean)
|
||||
{
|
||||
/* FIXME: do something to wp_data->object_instance */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: do something to wp_data->object_instance */
|
||||
}
|
||||
if (wp_data->value.type.Boolean) {
|
||||
/* FIXME: do something to wp_data->object_instance */
|
||||
} else {
|
||||
/* FIXME: do something to wp_data->object_instance */
|
||||
}
|
||||
} else {
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
|
||||
@@ -252,11 +249,11 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
break;
|
||||
case PROP_FILE_SIZE:
|
||||
/* If the file size can be changed by writing to the file,
|
||||
and File_Access_Method is STREAM_ACCESS, then this property
|
||||
shall be writable. */
|
||||
and File_Access_Method is STREAM_ACCESS, then this property
|
||||
shall be writable. */
|
||||
if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
||||
/* FIXME: do something with wp_data->value.type.Unsigned
|
||||
to wp_data->object_instance */
|
||||
/* FIXME: do something with wp_data->value.type.Unsigned
|
||||
to wp_data->object_instance */
|
||||
} else {
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
*error_code = ERROR_CODE_INVALID_DATA_TYPE;
|
||||
|
||||
@@ -70,8 +70,8 @@ extern "C" {
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
|
||||
/* handling for write property service */
|
||||
bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -170,8 +170,7 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_tagged_enumerated(&apdu[0], OBJECT_BINARY_VALUE);
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], OBJECT_BINARY_VALUE);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
present_value = Binary_Value_Present_Value(object_instance);
|
||||
@@ -206,8 +205,7 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
/* if no index was specified, then try to encode the entire list */
|
||||
/* into one packet. */
|
||||
else if (array_index == BACNET_ARRAY_ALL) {
|
||||
object_index =
|
||||
Binary_Value_Instance_To_Index(object_instance);
|
||||
object_index = Binary_Value_Instance_To_Index(object_instance);
|
||||
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
|
||||
/* FIXME: check if we have room before adding it to APDU */
|
||||
if (Binary_Value_Level[object_index][i] == BINARY_NULL)
|
||||
@@ -229,8 +227,7 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
object_index =
|
||||
Binary_Value_Instance_To_Index(object_instance);
|
||||
object_index = Binary_Value_Instance_To_Index(object_instance);
|
||||
if (array_index <= BACNET_MAX_PRIORITY) {
|
||||
if (Binary_Value_Level[object_index][array_index] ==
|
||||
BINARY_NULL)
|
||||
|
||||
@@ -657,7 +657,8 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
if (Life_Safety_Point_Count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_LIFE_SAFETY_POINT, true);
|
||||
if (Multistate_Output_Count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_MULTI_STATE_OUTPUT, true);
|
||||
bitstring_set_bit(&bit_string, OBJECT_MULTI_STATE_OUTPUT,
|
||||
true);
|
||||
#if BACFILE
|
||||
if (bacfile_count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_FILE, true);
|
||||
|
||||
@@ -109,8 +109,7 @@ unsigned Multistate_Output_Instance_To_Index(uint32_t object_instance)
|
||||
return index;
|
||||
}
|
||||
|
||||
static uint32_t Multistate_Output_Present_Value(uint32_t
|
||||
object_instance)
|
||||
static uint32_t Multistate_Output_Present_Value(uint32_t object_instance)
|
||||
{
|
||||
uint32_t value = MULTISTATE_RELINQUISH_DEFAULT;
|
||||
unsigned index = 0;
|
||||
@@ -162,7 +161,8 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
Multistate_Output_Init();
|
||||
switch (property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_MULTI_STATE_OUTPUT,
|
||||
apdu_len =
|
||||
encode_tagged_object_id(&apdu[0], OBJECT_MULTI_STATE_OUTPUT,
|
||||
object_instance);
|
||||
break;
|
||||
/* note: Name and Description don't have to be the same.
|
||||
@@ -195,7 +195,8 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
|
||||
break;
|
||||
case PROP_OUT_OF_SERVICE:
|
||||
object_index = Multistate_Output_Instance_To_Index(object_instance);
|
||||
object_index =
|
||||
Multistate_Output_Instance_To_Index(object_instance);
|
||||
state = Multistate_Output_Out_Of_Service[object_index];
|
||||
apdu_len = encode_tagged_boolean(&apdu[0], state);
|
||||
break;
|
||||
@@ -211,10 +212,12 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
Multistate_Output_Instance_To_Index(object_instance);
|
||||
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
|
||||
/* FIXME: check if we have room before adding it to APDU */
|
||||
if (Multistate_Output_Level[object_index][i] == MULTISTATE_NULL)
|
||||
if (Multistate_Output_Level[object_index][i] ==
|
||||
MULTISTATE_NULL)
|
||||
len = encode_tagged_null(&apdu[apdu_len]);
|
||||
else {
|
||||
present_value = Multistate_Output_Level[object_index][i];
|
||||
present_value =
|
||||
Multistate_Output_Level[object_index][i];
|
||||
len =
|
||||
encode_tagged_unsigned(&apdu[apdu_len],
|
||||
present_value);
|
||||
@@ -295,7 +298,8 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
object. */
|
||||
if (priority && (priority <= BACNET_MAX_PRIORITY) &&
|
||||
(priority != 6 /* reserved */ ) &&
|
||||
(wp_data->value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) {
|
||||
(wp_data->value.type.Unsigned_Int <=
|
||||
MULTISTATE_NUMBER_OF_STATES)) {
|
||||
level = wp_data->value.type.Unsigned_Int;
|
||||
object_index =
|
||||
Multistate_Output_Instance_To_Index(wp_data->
|
||||
@@ -321,7 +325,8 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
} else if (wp_data->value.tag == BACNET_APPLICATION_TAG_NULL) {
|
||||
level = MULTISTATE_NULL;
|
||||
object_index =
|
||||
Multistate_Output_Instance_To_Index(wp_data->object_instance);
|
||||
Multistate_Output_Instance_To_Index(wp_data->
|
||||
object_instance);
|
||||
priority = wp_data->priority;
|
||||
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
|
||||
priority--;
|
||||
@@ -345,7 +350,8 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
case PROP_OUT_OF_SERVICE:
|
||||
if (wp_data->value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
|
||||
object_index =
|
||||
Multistate_Output_Instance_To_Index(wp_data->object_instance);
|
||||
Multistate_Output_Instance_To_Index(wp_data->
|
||||
object_instance);
|
||||
Multistate_Output_Out_Of_Service[object_index] =
|
||||
wp_data->value.type.Boolean;
|
||||
status = true;
|
||||
|
||||
@@ -46,8 +46,9 @@ extern "C" {
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *
|
||||
wp_data, BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
|
||||
@@ -143,8 +143,7 @@ int main(int argc, char *argv[])
|
||||
"%s 1 2 3 4 5 85 4 100.0\r\n"
|
||||
"where 1=pid, 2=device-id, 3=AV, 4=object-id, 5=time,\r\n"
|
||||
"85=Present-Value, 4=REAL, 100.0=value\r\n",
|
||||
filename_remove_path(argv[0]),
|
||||
filename_remove_path(argv[0]));
|
||||
filename_remove_path(argv[0]), filename_remove_path(argv[0]));
|
||||
return 0;
|
||||
}
|
||||
/* decode the command line parameters */
|
||||
@@ -163,7 +162,8 @@ int main(int argc, char *argv[])
|
||||
cov_data.listOfValues.priority = BACNET_NO_PRIORITY;
|
||||
/* optional index */
|
||||
if (argc > 10)
|
||||
cov_data.listOfValues.propertyArrayIndex = strtol(argv[10], NULL, 0);
|
||||
cov_data.listOfValues.propertyArrayIndex =
|
||||
strtol(argv[10], NULL, 0);
|
||||
else
|
||||
cov_data.listOfValues.propertyArrayIndex = BACNET_ARRAY_ALL;
|
||||
|
||||
@@ -174,17 +174,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (cov_data.monitoredObjectIdentifier.type > MAX_BACNET_OBJECT_TYPE) {
|
||||
fprintf(stderr, "object-type=%u - it must be less than %u\r\n",
|
||||
cov_data.monitoredObjectIdentifier.type, MAX_BACNET_OBJECT_TYPE + 1);
|
||||
cov_data.monitoredObjectIdentifier.type,
|
||||
MAX_BACNET_OBJECT_TYPE + 1);
|
||||
return 1;
|
||||
}
|
||||
if (cov_data.monitoredObjectIdentifier.instance > BACNET_MAX_INSTANCE) {
|
||||
fprintf(stderr, "object-instance=%u - it must be less than %u\r\n",
|
||||
cov_data.monitoredObjectIdentifier.instance, BACNET_MAX_INSTANCE + 1);
|
||||
cov_data.monitoredObjectIdentifier.instance,
|
||||
BACNET_MAX_INSTANCE + 1);
|
||||
return 1;
|
||||
}
|
||||
if (cov_data.listOfValues.propertyIdentifier > MAX_BACNET_PROPERTY_ID) {
|
||||
fprintf(stderr, "object-type=%u - it must be less than %u\r\n",
|
||||
cov_data.listOfValues.propertyIdentifier, MAX_BACNET_PROPERTY_ID + 1);
|
||||
cov_data.listOfValues.propertyIdentifier,
|
||||
MAX_BACNET_PROPERTY_ID + 1);
|
||||
return 1;
|
||||
}
|
||||
if (tag >= MAX_BACNET_APPLICATION_TAG) {
|
||||
@@ -212,7 +215,7 @@ int main(int argc, char *argv[])
|
||||
/* only one value in our value list */
|
||||
cov_data.listOfValues.next = NULL;
|
||||
|
||||
ucov_notify_send(&Handler_Transmit_Buffer[0],&cov_data);
|
||||
ucov_notify_send(&Handler_Transmit_Buffer[0], &cov_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -114,6 +114,11 @@ make -f demo/object/lsp.mak
|
||||
./lsp >> test.log
|
||||
make -f demo/object/lsp.mak clean
|
||||
|
||||
make -f demo/object/mso.mak clean
|
||||
make -f demo/object/mso.mak
|
||||
./multistate_output >> test.log
|
||||
make -f demo/object/mso.mak clean
|
||||
|
||||
make -f mstp.mak clean
|
||||
make -f mstp.mak
|
||||
./mstp >> test.log
|
||||
|
||||
Reference in New Issue
Block a user