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