Feature/color objects color command (#302)
* added BACnetColorCommand and BACnetxyColor encoding and unit testing * Added Color object and unit testing. * Added Color Temperature object and Unit test * Fix BVLC unit test warning. * add port Makefile for extra types * added RGB to and from CIE xy utility in sys folder, and add unit tests. * added cmake-win32 target * Change RP and RPM to use known property decoder. Add color object RP and RPM decoding and printing Fix RPM print for new reserved range above 4194303 Change default protocol-revision to 24 for Color object * Integrate Color and Color Temperature objects into demo apps Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -313,7 +313,7 @@ static union {
|
||||
* @param service_choice Service, see SERVICE_CONFIRMED_X enumeration.
|
||||
* @return true if the service uses a Complex Error function
|
||||
*/
|
||||
bool apdu_complex_error(BACNET_CONFIRMED_SERVICE service_choice)
|
||||
bool apdu_complex_error(uint8_t service_choice)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
@@ -547,8 +547,8 @@ void apdu_handler(BACNET_ADDRESS *src,
|
||||
uint8_t *service_request = NULL;
|
||||
uint16_t service_request_len = 0;
|
||||
int len = 0; /* counts where we are in PDU */
|
||||
uint32_t error_code = 0;
|
||||
uint32_t error_class = 0;
|
||||
BACNET_ERROR_CODE error_code = ERROR_CODE_SUCCESS;
|
||||
BACNET_ERROR_CLASS error_class = ERROR_CLASS_SERVICES;
|
||||
uint8_t reason = 0;
|
||||
bool server = false;
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ extern "C" {
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool apdu_complex_error(
|
||||
BACNET_CONFIRMED_SERVICE service_choice);
|
||||
uint8_t service_choice);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void apdu_set_error_handler(
|
||||
|
||||
@@ -64,8 +64,9 @@ void rp_ack_print_data(BACNET_READ_PROPERTY_DATA *data)
|
||||
/* FIXME: what if application_data_len is bigger than 255? */
|
||||
/* value? need to loop until all of the len is gone... */
|
||||
for (;;) {
|
||||
len = bacapp_decode_application_data(
|
||||
application_data, (unsigned)application_data_len, &value);
|
||||
len = bacapp_decode_known_property(
|
||||
application_data, (unsigned)application_data_len, &value,
|
||||
data->object_type, data->object_property);
|
||||
if (first_value && (len < application_data_len)) {
|
||||
first_value = false;
|
||||
#if PRINT_ENABLED
|
||||
|
||||
@@ -115,17 +115,20 @@ int rpm_ack_decode_service_request(
|
||||
value = calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
||||
rpm_property->value = value;
|
||||
while (value && (apdu_len > 0)) {
|
||||
if (IS_CONTEXT_SPECIFIC(*apdu)) {
|
||||
len = bacapp_decode_context_data(apdu, apdu_len, value,
|
||||
rpm_property->propertyIdentifier);
|
||||
} else {
|
||||
len = bacapp_decode_application_data(
|
||||
apdu, apdu_len, value);
|
||||
}
|
||||
len = bacapp_decode_known_property(
|
||||
apdu, (unsigned)apdu_len, value,
|
||||
rpm_object->object_type,
|
||||
rpm_property->propertyIdentifier);
|
||||
/* If len == 0 then it's an empty structure, which is OK. */
|
||||
if (len < 0) {
|
||||
/* problem decoding */
|
||||
/* calling function will free the memory */
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "RPM Ack: unable to decode! %s:%s\n",
|
||||
bactext_object_type_name(rpm_object->object_type),
|
||||
bactext_property_name(
|
||||
rpm_property->propertyIdentifier));
|
||||
#endif
|
||||
/* note: caller will free the memory */
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
decoded_len += len;
|
||||
@@ -220,11 +223,17 @@ void rpm_ack_print_data(BACNET_READ_ACCESS_DATA *rpm_data)
|
||||
listOfProperties = rpm_data->listOfProperties;
|
||||
while (listOfProperties) {
|
||||
#if PRINT_ENABLED
|
||||
if (listOfProperties->propertyIdentifier < 512) {
|
||||
if ((listOfProperties->propertyIdentifier < 512) ||
|
||||
(listOfProperties->propertyIdentifier > 4194303)) {
|
||||
/* Enumerated values 0-511 and 4194304+ are reserved
|
||||
for definition by ASHRAE.*/
|
||||
fprintf(stdout, " %s: ",
|
||||
bactext_property_name(
|
||||
listOfProperties->propertyIdentifier));
|
||||
} else {
|
||||
/* Enumerated values 512-4194303 may be used
|
||||
by others subject to the procedures and
|
||||
constraints described in Clause 23. */
|
||||
fprintf(stdout, " proprietary %u: ",
|
||||
(unsigned)listOfProperties->propertyIdentifier);
|
||||
}
|
||||
@@ -357,7 +366,7 @@ void handler_read_property_multiple_ack(uint8_t *service_request,
|
||||
rpm_data = rpm_data_free(rpm_data);
|
||||
}
|
||||
} else {
|
||||
#if 1
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "RPM Ack Malformed! Freeing memory...\n");
|
||||
#endif
|
||||
while (rpm_data) {
|
||||
|
||||
Reference in New Issue
Block a user