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:
Steve Karg
2022-07-13 09:54:36 -05:00
committed by GitHub
parent 085de3c385
commit 38d213b47c
80 changed files with 5369 additions and 347 deletions
+24 -11
View File
@@ -2948,7 +2948,7 @@ int decode_context_date(uint8_t *apdu, uint8_t tag_number, BACNET_DATE *bdate)
/**
* Encode a simple ACK and returns the number of apdu bytes consumed.
*
* @param apdu Transmit buffer
* @param apdu - buffer to hold encoded data, or NULL for length
* @param invoke_id ID invoked
* @param service_choice Service being acked
*
@@ -2956,9 +2956,11 @@ int decode_context_date(uint8_t *apdu, uint8_t tag_number, BACNET_DATE *bdate)
*/
int encode_simple_ack(uint8_t *apdu, uint8_t invoke_id, uint8_t service_choice)
{
apdu[0] = PDU_TYPE_SIMPLE_ACK;
apdu[1] = invoke_id;
apdu[2] = service_choice;
if (apdu) {
apdu[0] = PDU_TYPE_SIMPLE_ACK;
apdu[1] = invoke_id;
apdu[2] = service_choice;
}
return 3;
}
@@ -2966,7 +2968,7 @@ int encode_simple_ack(uint8_t *apdu, uint8_t invoke_id, uint8_t service_choice)
/**
* Encode a BACnetAddress and returns the number of apdu bytes consumed.
*
* @param apdu Transmit buffer
* @param apdu - buffer to hold encoded data, or NULL for length
* @param destination Pointer to the destination address to be encoded.
*
* @return number of apdu bytes created
@@ -2979,20 +2981,23 @@ int encode_bacnet_address(uint8_t *apdu, BACNET_ADDRESS *destination)
if (destination) {
/* network number */
apdu_len +=
encode_application_unsigned(&apdu[apdu_len], destination->net);
encode_application_unsigned(apdu, destination->net);
/* encode mac address as an octet-string */
if (destination->len != 0) {
octetstring_init(&mac_addr, destination->adr, destination->len);
} else {
octetstring_init(&mac_addr, destination->mac, destination->mac_len);
}
apdu_len += encode_application_octet_string(&apdu[apdu_len], &mac_addr);
if (apdu) {
apdu += apdu_len;
}
apdu_len += encode_application_octet_string(apdu, &mac_addr);
}
return apdu_len;
}
/**
* Dencode a BACnetAddress and returns the number of apdu bytes consumed.
* Decode a BACnetAddress and returns the number of apdu bytes consumed.
*
* @param apdu Receive buffer
* @param destination Pointer to the destination address structure to be filled
@@ -3045,9 +3050,17 @@ int encode_context_bacnet_address(
uint8_t *apdu, uint8_t tag_number, BACNET_ADDRESS *destination)
{
int apdu_len = 0;
apdu_len += encode_opening_tag(&apdu[apdu_len], tag_number);
apdu_len += encode_bacnet_address(&apdu[apdu_len], destination);
apdu_len += encode_closing_tag(&apdu[apdu_len], tag_number);
apdu_len += encode_opening_tag(apdu, tag_number);
if (apdu) {
apdu += apdu_len;
}
apdu_len += encode_bacnet_address(apdu, destination);
if (apdu) {
apdu += apdu_len;
}
apdu_len += encode_closing_tag(apdu, tag_number);
return apdu_len;
}