Run clang-format and enable CI check for it (#755)
* pre-commit: Update and enable clang-format check There is newer version from clang-format so use that. We do not yet want 18 as that is little bit too new. * Format some thing by hand which clang-format "breaks" Clang-format will format some things little bit off in some cases. Format some things by hand so we get cleaner end result. * Run clang-format with ``` pre-commit run --all-files clang-format ``` We have already in previously checked places where clang-format does not make good format and ignored those (hopefully most of the things). --------- Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
+4
-1
@@ -214,7 +214,10 @@ int abort_encode_apdu(
|
||||
* @return Total length of the apdu, typically 2 on success, zero otherwise.
|
||||
*/
|
||||
int abort_decode_service_request(
|
||||
const uint8_t *apdu, unsigned apdu_len, uint8_t *invoke_id, uint8_t *abort_reason)
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t *invoke_id,
|
||||
uint8_t *abort_reason)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
|
||||
+15
-21
@@ -18,29 +18,23 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_ABORT_REASON abort_convert_error_code(
|
||||
BACNET_ERROR_CODE error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
bool abort_valid_error_code(
|
||||
BACNET_ERROR_CODE error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_ERROR_CODE abort_convert_to_error_code(
|
||||
BACNET_ABORT_REASON abort_code);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_ABORT_REASON abort_convert_error_code(BACNET_ERROR_CODE error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
bool abort_valid_error_code(BACNET_ERROR_CODE error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_ERROR_CODE abort_convert_to_error_code(BACNET_ABORT_REASON abort_code);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int abort_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
uint8_t abort_reason,
|
||||
bool server);
|
||||
BACNET_STACK_EXPORT
|
||||
int abort_encode_apdu(
|
||||
uint8_t *apdu, uint8_t invoke_id, uint8_t abort_reason, bool server);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int abort_decode_service_request(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
uint8_t * abort_reason);
|
||||
BACNET_STACK_EXPORT
|
||||
int abort_decode_service_request(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t *invoke_id,
|
||||
uint8_t *abort_reason);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+10
-19
@@ -36,29 +36,20 @@ typedef struct {
|
||||
bool enable;
|
||||
} BACNET_ACCESS_RULE;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_access_rule(
|
||||
uint8_t * apdu,
|
||||
const BACNET_ACCESS_RULE * rule);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_access_rule(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_ACCESS_RULE * rule);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_access_rule(
|
||||
const uint8_t * apdu,
|
||||
BACNET_ACCESS_RULE * rule);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_access_rule(
|
||||
const uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_ACCESS_RULE * rule);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_access_rule(uint8_t *apdu, const BACNET_ACCESS_RULE *rule);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_access_rule(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_ACCESS_RULE *rule);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_access_rule(const uint8_t *apdu, BACNET_ACCESS_RULE *rule);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_access_rule(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_ACCESS_RULE *rule);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ int alarm_ack_encode_apdu(
|
||||
* @param data Pointer to the service data used for encoding values
|
||||
* @return number of bytes encoded
|
||||
*/
|
||||
int alarm_ack_encode_service_request(uint8_t *apdu, const BACNET_ALARM_ACK_DATA *data)
|
||||
int alarm_ack_encode_service_request(
|
||||
uint8_t *apdu, const BACNET_ALARM_ACK_DATA *data)
|
||||
{
|
||||
int len = 0; /* length of each encoding */
|
||||
int apdu_len = 0; /* total length of the apdu, return value */
|
||||
@@ -67,7 +68,8 @@ int alarm_ack_encode_service_request(uint8_t *apdu, const BACNET_ALARM_ACK_DATA
|
||||
if (apdu) {
|
||||
apdu += len;
|
||||
}
|
||||
len = encode_context_object_id(apdu, 1, data->eventObjectIdentifier.type,
|
||||
len = encode_context_object_id(
|
||||
apdu, 1, data->eventObjectIdentifier.type,
|
||||
data->eventObjectIdentifier.instance);
|
||||
apdu_len += len;
|
||||
if (apdu) {
|
||||
@@ -102,9 +104,7 @@ int alarm_ack_encode_service_request(uint8_t *apdu, const BACNET_ALARM_ACK_DATA
|
||||
* @return number of bytes encoded, or zero if unable to encode or too large
|
||||
*/
|
||||
size_t bacnet_acknowledge_alarm_info_request_encode(
|
||||
uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
const BACNET_ALARM_ACK_DATA *data)
|
||||
uint8_t *apdu, size_t apdu_size, const BACNET_ALARM_ACK_DATA *data)
|
||||
{
|
||||
size_t apdu_len = 0; /* total length of the apdu, return value */
|
||||
|
||||
@@ -116,7 +116,6 @@ size_t bacnet_acknowledge_alarm_info_request_encode(
|
||||
}
|
||||
|
||||
return apdu_len;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+14
-23
@@ -29,37 +29,28 @@ typedef struct BACnetAcknowledgeAlarmInfo {
|
||||
/* return +1 if alarm was acknowledged
|
||||
return -1 if any error occurred
|
||||
return -2 abort */
|
||||
typedef int (
|
||||
*alarm_ack_function) (
|
||||
BACNET_ALARM_ACK_DATA * alarmack_data,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
typedef int (*alarm_ack_function)(
|
||||
BACNET_ALARM_ACK_DATA *alarmack_data, BACNET_ERROR_CODE *error_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int alarm_ack_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
const BACNET_ALARM_ACK_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int alarm_ack_encode_apdu(
|
||||
uint8_t *apdu, uint8_t invoke_id, const BACNET_ALARM_ACK_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int alarm_ack_encode_service_request(
|
||||
uint8_t * apdu,
|
||||
const BACNET_ALARM_ACK_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int alarm_ack_encode_service_request(
|
||||
uint8_t *apdu, const BACNET_ALARM_ACK_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
size_t bacnet_acknowledge_alarm_info_request_encode(
|
||||
uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
const BACNET_ALARM_ACK_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t bacnet_acknowledge_alarm_info_request_encode(
|
||||
uint8_t *apdu, size_t apdu_size, const BACNET_ALARM_ACK_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int alarm_ack_decode_service_request(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_ALARM_ACK_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int alarm_ack_decode_service_request(
|
||||
const uint8_t *apdu, unsigned apdu_len, BACNET_ALARM_ACK_DATA *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+6
-3
@@ -33,7 +33,8 @@
|
||||
* @param data Pointer to the service data used for encoding values
|
||||
* @return number of bytes encoded
|
||||
*/
|
||||
int arf_service_encode_apdu(uint8_t *apdu, const BACNET_ATOMIC_READ_FILE_DATA *data)
|
||||
int arf_service_encode_apdu(
|
||||
uint8_t *apdu, const BACNET_ATOMIC_READ_FILE_DATA *data)
|
||||
{
|
||||
int apdu_len = 0; /* total length of the apdu, return value */
|
||||
int len = 0;
|
||||
@@ -269,7 +270,8 @@ int arf_decode_service_request(
|
||||
* or NULL for length
|
||||
* @return number of bytes decoded, or BACNET_STATUS_ERROR on error
|
||||
*/
|
||||
int arf_decode_apdu(const uint8_t *apdu,
|
||||
int arf_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA *data)
|
||||
@@ -560,7 +562,8 @@ int arf_ack_decode_service_request(
|
||||
* or NULL for length
|
||||
* @return number of bytes decoded, or BACNET_STATUS_ERROR on error
|
||||
*/
|
||||
int arf_ack_decode_apdu(const uint8_t *apdu,
|
||||
int arf_ack_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA *data)
|
||||
|
||||
+33
-45
@@ -45,61 +45,49 @@ extern "C" {
|
||||
|
||||
/* Atomic Read File */
|
||||
/* encode service */
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
const BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_service_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t atomicreadfile_service_request_encode(
|
||||
uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_encode_apdu(
|
||||
uint8_t *apdu, uint8_t invoke_id, const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_service_encode_apdu(
|
||||
uint8_t *apdu, const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t atomicreadfile_service_request_encode(
|
||||
uint8_t *apdu, size_t apdu_size, const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
|
||||
/* decode the service request only */
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_decode_service_request(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_decode_service_request(
|
||||
const uint8_t *apdu, unsigned apdu_len, BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_decode_apdu(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
|
||||
/* Atomic Read File Ack */
|
||||
|
||||
/* encode service */
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
const BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_service_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_encode_apdu(
|
||||
uint8_t *apdu, uint8_t invoke_id, const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_service_encode_apdu(
|
||||
uint8_t *apdu, const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
|
||||
/* decode the service request only */
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_decode_service_request(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_decode_service_request(
|
||||
const uint8_t *apdu, unsigned apdu_len, BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_decode_apdu(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int arf_ack_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,24 +25,18 @@ typedef struct BACnetAssignedAccessRights {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_assigned_access_rights(
|
||||
uint8_t * apdu,
|
||||
const BACNET_ASSIGNED_ACCESS_RIGHTS * aar);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_assigned_access_rights(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag,
|
||||
const BACNET_ASSIGNED_ACCESS_RIGHTS * aar);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_assigned_access_rights(
|
||||
const uint8_t * apdu,
|
||||
BACNET_ASSIGNED_ACCESS_RIGHTS * aar);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_assigned_access_rights(
|
||||
const uint8_t * apdu,
|
||||
uint8_t tag,
|
||||
BACNET_ASSIGNED_ACCESS_RIGHTS * aar);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_assigned_access_rights(
|
||||
uint8_t *apdu, const BACNET_ASSIGNED_ACCESS_RIGHTS *aar);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_assigned_access_rights(
|
||||
uint8_t *apdu, uint8_t tag, const BACNET_ASSIGNED_ACCESS_RIGHTS *aar);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_assigned_access_rights(
|
||||
const uint8_t *apdu, BACNET_ASSIGNED_ACCESS_RIGHTS *aar);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_assigned_access_rights(
|
||||
const uint8_t *apdu, uint8_t tag, BACNET_ASSIGNED_ACCESS_RIGHTS *aar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,24 +25,18 @@ typedef struct BACnetAuthenticationFactor {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_authentication_factor(
|
||||
uint8_t * apdu,
|
||||
const BACNET_AUTHENTICATION_FACTOR * af);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_authentication_factor(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag,
|
||||
const BACNET_AUTHENTICATION_FACTOR * af);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_authentication_factor(
|
||||
const uint8_t * apdu,
|
||||
BACNET_AUTHENTICATION_FACTOR * af);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_authentication_factor(
|
||||
const uint8_t * apdu,
|
||||
uint8_t tag,
|
||||
BACNET_AUTHENTICATION_FACTOR * af);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_authentication_factor(
|
||||
uint8_t *apdu, const BACNET_AUTHENTICATION_FACTOR *af);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_authentication_factor(
|
||||
uint8_t *apdu, uint8_t tag, const BACNET_AUTHENTICATION_FACTOR *af);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_authentication_factor(
|
||||
const uint8_t *apdu, BACNET_AUTHENTICATION_FACTOR *af);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_authentication_factor(
|
||||
const uint8_t *apdu, uint8_t tag, BACNET_AUTHENTICATION_FACTOR *af);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -22,24 +22,22 @@ typedef struct BACnetAuthenticationFactorFormat {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_authentication_factor_format(
|
||||
uint8_t * apdu,
|
||||
const BACNET_AUTHENTICATION_FACTOR_FORMAT * aff);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_authentication_factor_format(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_AUTHENTICATION_FACTOR_FORMAT * aff);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_authentication_factor_format(
|
||||
const uint8_t * apdu,
|
||||
BACNET_AUTHENTICATION_FACTOR_FORMAT * aff);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_authentication_factor_format(
|
||||
const uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_AUTHENTICATION_FACTOR_FORMAT * aff);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_authentication_factor_format(
|
||||
uint8_t *apdu, const BACNET_AUTHENTICATION_FACTOR_FORMAT *aff);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_authentication_factor_format(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_AUTHENTICATION_FACTOR_FORMAT *aff);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_authentication_factor_format(
|
||||
const uint8_t *apdu, BACNET_AUTHENTICATION_FACTOR_FORMAT *aff);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_authentication_factor_format(
|
||||
const uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_AUTHENTICATION_FACTOR_FORMAT *aff);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+13
-6
@@ -4,7 +4,7 @@
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2005
|
||||
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
|
||||
*/
|
||||
*/
|
||||
#include <stdint.h>
|
||||
/* BACnet Stack defines - first */
|
||||
#include "bacnet/bacdef.h"
|
||||
@@ -34,7 +34,8 @@
|
||||
* @param data Pointer to the service data used for encoding values
|
||||
* @return number of bytes encoded
|
||||
*/
|
||||
int awf_service_encode_apdu(uint8_t *apdu, const BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
int awf_service_encode_apdu(
|
||||
uint8_t *apdu, const BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
{
|
||||
int apdu_len = 0; /* total length of the apdu, return value */
|
||||
int len = 0;
|
||||
@@ -180,7 +181,9 @@ int awf_encode_apdu(
|
||||
* @return number of bytes decoded or BACNET_STATUS_ERROR on error.
|
||||
*/
|
||||
int awf_decode_service_request(
|
||||
const uint8_t *apdu, unsigned apdu_size, BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
{
|
||||
/* return value */
|
||||
int apdu_len = 0;
|
||||
@@ -299,7 +302,8 @@ int awf_decode_service_request(
|
||||
* or NULL for length
|
||||
* @return number of bytes decoded, or BACNET_STATUS_ERROR on error
|
||||
*/
|
||||
int awf_decode_apdu(const uint8_t *apdu,
|
||||
int awf_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
@@ -410,7 +414,9 @@ int awf_ack_encode_apdu(
|
||||
* @return number of bytes encoded or BACNET_STATUS_ERROR on error.
|
||||
*/
|
||||
int awf_ack_decode_service_request(
|
||||
const uint8_t *apdu, unsigned apdu_size, BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
{
|
||||
int len = 0, apdu_len = 0;
|
||||
int32_t signed_integer;
|
||||
@@ -463,7 +469,8 @@ int awf_ack_decode_service_request(
|
||||
* or NULL for length
|
||||
* @return number of bytes decoded, or BACNET_STATUS_ERROR on error
|
||||
*/
|
||||
int awf_ack_decode_apdu(const uint8_t *apdu,
|
||||
int awf_ack_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
|
||||
+41
-45
@@ -39,55 +39,51 @@ typedef struct BACnet_Atomic_Write_File_Data {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_service_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int atomicwritefile_service_request_encode(
|
||||
uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_service_encode_apdu(
|
||||
uint8_t *apdu, const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int atomicwritefile_service_request_encode(
|
||||
uint8_t *apdu, size_t apdu_size, const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
uint8_t invoke_id,
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_decode_service_request(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_decode_apdu(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_decode_service_request(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_service_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_service_encode_apdu(
|
||||
uint8_t *apdu, const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
uint8_t invoke_id,
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_decode_service_request(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_decode_apdu(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_decode_service_request(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
int awf_ack_decode_apdu(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -85,7 +85,9 @@ int bacnet_action_property_value_encode(
|
||||
* @return number of bytes encoded
|
||||
*/
|
||||
int bacnet_action_property_value_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, BACNET_ACTION_PROPERTY_VALUE *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_ACTION_PROPERTY_VALUE *value)
|
||||
{
|
||||
int len = 0;
|
||||
int apdu_len = 0;
|
||||
|
||||
@@ -95,7 +95,8 @@ bool bacnet_address_same(const BACNET_ADDRESS *dest, const BACNET_ADDRESS *src)
|
||||
* @param adr - #BACNET_MAC_ADDRESS behind the remote network
|
||||
* @return true if configured
|
||||
*/
|
||||
bool bacnet_address_init(BACNET_ADDRESS *dest,
|
||||
bool bacnet_address_init(
|
||||
BACNET_ADDRESS *dest,
|
||||
const BACNET_MAC_ADDRESS *mac,
|
||||
uint16_t dnet,
|
||||
const BACNET_MAC_ADDRESS *adr)
|
||||
@@ -222,8 +223,9 @@ bool bacnet_address_mac_from_ascii(BACNET_MAC_ADDRESS *mac, const char *arg)
|
||||
mac->len = 6;
|
||||
status = true;
|
||||
} else {
|
||||
c = sscanf(arg, "%2x:%2x:%2x:%2x:%2x:%2x", &a[0], &a[1], &a[2], &a[3],
|
||||
&a[4], &a[5]);
|
||||
c = sscanf(
|
||||
arg, "%2x:%2x:%2x:%2x:%2x:%2x", &a[0], &a[1], &a[2], &a[3], &a[4],
|
||||
&a[5]);
|
||||
|
||||
if (c > 0) {
|
||||
for (i = 0; i < c; i++) {
|
||||
@@ -306,7 +308,8 @@ int bacnet_address_decode(
|
||||
* @param value - parameter to store the value after decoding
|
||||
* @return length of the APDU buffer decoded, or BACNET_STATUS_ERROR
|
||||
*/
|
||||
int bacnet_address_context_decode(const uint8_t *apdu,
|
||||
int bacnet_address_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
BACNET_ADDRESS *value)
|
||||
|
||||
@@ -21,10 +21,10 @@ extern "C" {
|
||||
BACNET_STACK_EXPORT
|
||||
void bacnet_address_copy(BACNET_ADDRESS *dest, const BACNET_ADDRESS *src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_address_same(
|
||||
const BACNET_ADDRESS *dest, const BACNET_ADDRESS *src);
|
||||
bool bacnet_address_same(const BACNET_ADDRESS *dest, const BACNET_ADDRESS *src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_address_init(BACNET_ADDRESS *dest,
|
||||
bool bacnet_address_init(
|
||||
BACNET_ADDRESS *dest,
|
||||
const BACNET_MAC_ADDRESS *mac,
|
||||
uint16_t dnet,
|
||||
const BACNET_MAC_ADDRESS *adr);
|
||||
@@ -42,7 +42,8 @@ BACNET_STACK_EXPORT
|
||||
int bacnet_address_decode(
|
||||
const uint8_t *apdu, uint32_t adpu_size, BACNET_ADDRESS *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_address_context_decode(const uint8_t *apdu,
|
||||
int bacnet_address_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t adpu_size,
|
||||
uint8_t tag_number,
|
||||
BACNET_ADDRESS *value);
|
||||
|
||||
+39
-38
@@ -119,7 +119,8 @@ bacnet_scale_decode(const uint8_t *apdu, size_t apdu_size, BACNET_SCALE *value)
|
||||
#endif
|
||||
|
||||
#if defined(BACAPP_SCALE)
|
||||
static bool bacnet_scale_same(const BACNET_SCALE *value1, const BACNET_SCALE *value2)
|
||||
static bool
|
||||
bacnet_scale_same(const BACNET_SCALE *value1, const BACNET_SCALE *value2)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
@@ -158,7 +159,8 @@ static bool bacnet_scale_same(const BACNET_SCALE *value1, const BACNET_SCALE *va
|
||||
* @param value - value to encode
|
||||
* @return number of bytes encoded
|
||||
*/
|
||||
static int bacnet_shed_level_encode(uint8_t *apdu, const BACNET_SHED_LEVEL *value)
|
||||
static int
|
||||
bacnet_shed_level_encode(uint8_t *apdu, const BACNET_SHED_LEVEL *value)
|
||||
{
|
||||
int apdu_len = 0;
|
||||
|
||||
@@ -167,16 +169,13 @@ static int bacnet_shed_level_encode(uint8_t *apdu, const BACNET_SHED_LEVEL *valu
|
||||
}
|
||||
switch (value->type) {
|
||||
case BACNET_SHED_TYPE_PERCENT:
|
||||
apdu_len = encode_context_unsigned(apdu, 0,
|
||||
value->value.percent);
|
||||
apdu_len = encode_context_unsigned(apdu, 0, value->value.percent);
|
||||
break;
|
||||
case BACNET_SHED_TYPE_AMOUNT:
|
||||
apdu_len = encode_context_real(apdu, 2,
|
||||
value->value.amount);
|
||||
apdu_len = encode_context_real(apdu, 2, value->value.amount);
|
||||
break;
|
||||
case BACNET_SHED_TYPE_LEVEL:
|
||||
apdu_len = encode_context_unsigned(apdu, 1,
|
||||
value->value.level);
|
||||
apdu_len = encode_context_unsigned(apdu, 1, value->value.level);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -201,8 +200,8 @@ static int bacnet_shed_level_encode(uint8_t *apdu, const BACNET_SHED_LEVEL *valu
|
||||
* @param value - value to encode
|
||||
* @return number of bytes decoded, or BACNET_STATUS_ERROR on error
|
||||
*/
|
||||
static int
|
||||
bacnet_shed_level_decode(const uint8_t *apdu, size_t apdu_size, BACNET_SHED_LEVEL *value)
|
||||
static int bacnet_shed_level_decode(
|
||||
const uint8_t *apdu, size_t apdu_size, BACNET_SHED_LEVEL *value)
|
||||
{
|
||||
int apdu_len = 0;
|
||||
BACNET_TAG tag = { 0 };
|
||||
@@ -253,8 +252,8 @@ bacnet_shed_level_decode(const uint8_t *apdu, size_t apdu_size, BACNET_SHED_LEVE
|
||||
#endif
|
||||
|
||||
#if defined(BACAPP_SHED_LEVEL)
|
||||
static bool
|
||||
bacnet_shed_level_same(const BACNET_SHED_LEVEL *value1, const BACNET_SHED_LEVEL *value2)
|
||||
static bool bacnet_shed_level_same(
|
||||
const BACNET_SHED_LEVEL *value1, const BACNET_SHED_LEVEL *value2)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
@@ -500,8 +499,8 @@ int bacapp_encode_application_data(
|
||||
#if defined(BACAPP_SHED_LEVEL)
|
||||
case BACNET_APPLICATION_TAG_SHED_LEVEL:
|
||||
/* BACnetShedLevel */
|
||||
apdu_len = bacnet_shed_level_encode(apdu,
|
||||
&value->type.Shed_Level);
|
||||
apdu_len =
|
||||
bacnet_shed_level_encode(apdu, &value->type.Shed_Level);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -665,7 +664,9 @@ int bacapp_decode_data(
|
||||
* BACNET_STATUS_ERROR
|
||||
*/
|
||||
int bacapp_decode_application_data(
|
||||
const uint8_t *apdu, uint32_t apdu_size, BACNET_APPLICATION_DATA_VALUE *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
int len = 0;
|
||||
int apdu_len = 0;
|
||||
@@ -788,14 +789,14 @@ int bacapp_decode_application_data_len(const uint8_t *apdu, unsigned apdu_size)
|
||||
int len = 0;
|
||||
int tag_len = 0;
|
||||
int decode_len = 0;
|
||||
BACNET_TAG tag = {0};
|
||||
BACNET_TAG tag = { 0 };
|
||||
|
||||
if (!bacnet_is_context_specific(apdu, apdu_size)) {
|
||||
tag_len = bacnet_tag_decode(apdu, apdu_size, &tag);
|
||||
if (tag_len > 0) {
|
||||
len += tag_len;
|
||||
decode_len = bacnet_application_data_length(tag.number,
|
||||
tag.len_value_type);
|
||||
decode_len =
|
||||
bacnet_application_data_length(tag.number, tag.len_value_type);
|
||||
len += decode_len;
|
||||
}
|
||||
}
|
||||
@@ -1074,7 +1075,7 @@ static int decode_priority_array_value(
|
||||
BACNET_APPLICATION_TAG tag = MAX_BACNET_APPLICATION_TAG;
|
||||
|
||||
if (bacnet_is_opening_tag_number(apdu, apdu_size, 0, &len)) {
|
||||
/* constructed-value [0] ABSTRACT-SYNTAX.&Type */
|
||||
/* constructed-value [0] ABSTRACT-SYNTAX.&Type */
|
||||
apdu_len += len;
|
||||
/* adjust application tag for complex types */
|
||||
if (object_type == OBJECT_COLOR) {
|
||||
@@ -1100,7 +1101,7 @@ static int decode_priority_array_value(
|
||||
}
|
||||
apdu_len += len;
|
||||
} else if (bacnet_is_opening_tag_number(apdu, apdu_size, 1, &len)) {
|
||||
/* datetime [1] BACnetDateTime */
|
||||
/* datetime [1] BACnetDateTime */
|
||||
apdu_len += len;
|
||||
/* adjust application tag for complex types */
|
||||
tag = BACNET_APPLICATION_TAG_DATETIME;
|
||||
@@ -1626,8 +1627,8 @@ int bacapp_decode_known_property(
|
||||
/* special case to reduce complexity - mostly encoded as application
|
||||
tagged values, but sometimes encoded as abstract syntax or complex
|
||||
data values */
|
||||
apdu_len = decode_priority_array_value(
|
||||
apdu, apdu_size, value, object_type);
|
||||
apdu_len =
|
||||
decode_priority_array_value(apdu, apdu_size, value, object_type);
|
||||
} else {
|
||||
/* Complex or primitive value?
|
||||
Lookup the complex values using their object type and property */
|
||||
@@ -1675,7 +1676,8 @@ int bacapp_decode_context_data_len(
|
||||
* @param value Pointer to the application value structure
|
||||
* @return Length of the encoded data in bytes
|
||||
*/
|
||||
int bacapp_encode_data(uint8_t *apdu, const BACNET_APPLICATION_DATA_VALUE *value)
|
||||
int bacapp_encode_data(
|
||||
uint8_t *apdu, const BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
int apdu_len = 0; /* total length of the apdu, return value */
|
||||
|
||||
@@ -2149,8 +2151,8 @@ static int bacapp_snprintf_enumerated(
|
||||
* The omission of day of week implies that the day is unspecified:
|
||||
* (24-January-1998);
|
||||
*/
|
||||
static int bacapp_snprintf_date(
|
||||
char *str, size_t str_len, const BACNET_DATE *bdate)
|
||||
static int
|
||||
bacapp_snprintf_date(char *str, size_t str_len, const BACNET_DATE *bdate)
|
||||
{
|
||||
int ret_val = 0;
|
||||
int slen = 0;
|
||||
@@ -2189,8 +2191,8 @@ static int bacapp_snprintf_date(
|
||||
* in the format hh:mm:ss.xx: 2:05:44.00, 16:54:59.99.
|
||||
* Any "wild card" field is shown by an asterisk (X'2A'): 16:54:*.*;
|
||||
*/
|
||||
static int bacapp_snprintf_time(
|
||||
char *str, size_t str_len, const BACNET_TIME *btime)
|
||||
static int
|
||||
bacapp_snprintf_time(char *str, size_t str_len, const BACNET_TIME *btime)
|
||||
{
|
||||
int ret_val = 0;
|
||||
int slen = 0;
|
||||
@@ -2260,7 +2262,7 @@ static int bacapp_snprintf_object_id(
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (BACAPP_DATETIME)
|
||||
#if defined(BACAPP_DATETIME)
|
||||
/**
|
||||
* @brief Print a value to a string for EPICS
|
||||
* @param str - destination string, or NULL for length only
|
||||
@@ -2605,8 +2607,8 @@ static int bacapp_snprintf_host_n_port(
|
||||
ret_val += bacapp_snprintf_shift(slen, &str, &str_len);
|
||||
if (value->host_ip_address) {
|
||||
const uint8_t *octet_str;
|
||||
octet_str = octetstring_value(
|
||||
(BACNET_OCTET_STRING *)&value->host.ip_address);
|
||||
octet_str =
|
||||
octetstring_value((BACNET_OCTET_STRING *)&value->host.ip_address);
|
||||
slen = bacapp_snprintf(
|
||||
str, str_len, "%u.%u.%u.%u:%u", (unsigned)octet_str[0],
|
||||
(unsigned)octet_str[1], (unsigned)octet_str[2],
|
||||
@@ -3363,8 +3365,9 @@ static char *rtrim(char *str, const char *trimmedchars)
|
||||
end = str + strlen(str) - 1;
|
||||
while (strchr(trimmedchars, *end)) {
|
||||
*end = 0;
|
||||
if (end == str)
|
||||
if (end == str) {
|
||||
break;
|
||||
}
|
||||
end--;
|
||||
}
|
||||
return str;
|
||||
@@ -3598,8 +3601,8 @@ static bool bacnet_scale_from_ascii(BACNET_SCALE *value, const char *argv)
|
||||
* @param argv [in] The string to parse
|
||||
* @return True on success, else False
|
||||
*/
|
||||
static bool bacnet_shed_level_from_ascii(
|
||||
BACNET_SHED_LEVEL *value, const char *argv)
|
||||
static bool
|
||||
bacnet_shed_level_from_ascii(BACNET_SHED_LEVEL *value, const char *argv)
|
||||
{
|
||||
bool status = false;
|
||||
int count;
|
||||
@@ -3629,7 +3632,6 @@ static bool bacnet_shed_level_from_ascii(
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!status) {
|
||||
count = sscanf(argv, "%u", &level);
|
||||
@@ -3877,14 +3879,13 @@ bool bacapp_parse_application_data(
|
||||
#endif
|
||||
#if defined(BACAPP_SCALE)
|
||||
case BACNET_APPLICATION_TAG_SCALE:
|
||||
status = bacnet_scale_from_ascii(
|
||||
&value->type.Scale, argv);
|
||||
status = bacnet_scale_from_ascii(&value->type.Scale, argv);
|
||||
break;
|
||||
#endif
|
||||
#if defined(BACAPP_SHED_LEVEL)
|
||||
case BACNET_APPLICATION_TAG_SHED_LEVEL:
|
||||
status = bacnet_shed_level_from_ascii(
|
||||
&value->type.Shed_Level, argv);
|
||||
status =
|
||||
bacnet_shed_level_from_ascii(&value->type.Shed_Level, argv);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
||||
+171
-195
@@ -59,102 +59,102 @@ typedef struct {
|
||||
|
||||
struct BACnet_Application_Data_Value;
|
||||
typedef struct BACnet_Application_Data_Value {
|
||||
bool context_specific; /* true if context specific data */
|
||||
uint8_t context_tag; /* only used for context specific data */
|
||||
uint8_t tag; /* application tag data type */
|
||||
bool context_specific; /* true if context specific data */
|
||||
uint8_t context_tag; /* only used for context specific data */
|
||||
uint8_t tag; /* application tag data type */
|
||||
union {
|
||||
/* NULL - not needed as it is encoded in the tag alone */
|
||||
#if defined (BACAPP_BOOLEAN)
|
||||
#if defined(BACAPP_BOOLEAN)
|
||||
bool Boolean;
|
||||
#endif
|
||||
#if defined (BACAPP_UNSIGNED)
|
||||
#if defined(BACAPP_UNSIGNED)
|
||||
BACNET_UNSIGNED_INTEGER Unsigned_Int;
|
||||
#endif
|
||||
#if defined (BACAPP_SIGNED)
|
||||
#if defined(BACAPP_SIGNED)
|
||||
int32_t Signed_Int;
|
||||
#endif
|
||||
#if defined (BACAPP_REAL)
|
||||
#if defined(BACAPP_REAL)
|
||||
float Real;
|
||||
#endif
|
||||
#if defined (BACAPP_DOUBLE)
|
||||
#if defined(BACAPP_DOUBLE)
|
||||
double Double;
|
||||
#endif
|
||||
#if defined (BACAPP_OCTET_STRING)
|
||||
#if defined(BACAPP_OCTET_STRING)
|
||||
BACNET_OCTET_STRING Octet_String;
|
||||
#endif
|
||||
#if defined (BACAPP_CHARACTER_STRING)
|
||||
#if defined(BACAPP_CHARACTER_STRING)
|
||||
BACNET_CHARACTER_STRING Character_String;
|
||||
#endif
|
||||
#if defined (BACAPP_BIT_STRING)
|
||||
#if defined(BACAPP_BIT_STRING)
|
||||
BACNET_BIT_STRING Bit_String;
|
||||
#endif
|
||||
#if defined (BACAPP_ENUMERATED)
|
||||
#if defined(BACAPP_ENUMERATED)
|
||||
uint32_t Enumerated;
|
||||
#endif
|
||||
#if defined (BACAPP_DATE)
|
||||
#if defined(BACAPP_DATE)
|
||||
BACNET_DATE Date;
|
||||
#endif
|
||||
#if defined (BACAPP_TIME)
|
||||
#if defined(BACAPP_TIME)
|
||||
BACNET_TIME Time;
|
||||
#endif
|
||||
#if defined (BACAPP_OBJECT_ID)
|
||||
#if defined(BACAPP_OBJECT_ID)
|
||||
BACNET_OBJECT_ID Object_Id;
|
||||
#endif
|
||||
#if defined (BACAPP_TIMESTAMP)
|
||||
#if defined(BACAPP_TIMESTAMP)
|
||||
BACNET_TIMESTAMP Time_Stamp;
|
||||
#endif
|
||||
#if defined (BACAPP_DATETIME)
|
||||
#if defined(BACAPP_DATETIME)
|
||||
BACNET_DATE_TIME Date_Time;
|
||||
#endif
|
||||
#if defined (BACAPP_DATERANGE)
|
||||
#if defined(BACAPP_DATERANGE)
|
||||
BACNET_DATE_RANGE Date_Range;
|
||||
#endif
|
||||
#if defined (BACAPP_LIGHTING_COMMAND)
|
||||
#if defined(BACAPP_LIGHTING_COMMAND)
|
||||
BACNET_LIGHTING_COMMAND Lighting_Command;
|
||||
#endif
|
||||
#if defined (BACAPP_XY_COLOR)
|
||||
#if defined(BACAPP_XY_COLOR)
|
||||
BACNET_XY_COLOR XY_Color;
|
||||
#endif
|
||||
#if defined (BACAPP_COLOR_COMMAND)
|
||||
#if defined(BACAPP_COLOR_COMMAND)
|
||||
BACNET_COLOR_COMMAND Color_Command;
|
||||
#endif
|
||||
#if defined (BACAPP_WEEKLY_SCHEDULE)
|
||||
#if defined(BACAPP_WEEKLY_SCHEDULE)
|
||||
BACNET_WEEKLY_SCHEDULE Weekly_Schedule;
|
||||
#endif
|
||||
#if defined (BACAPP_HOST_N_PORT)
|
||||
#if defined(BACAPP_HOST_N_PORT)
|
||||
BACNET_HOST_N_PORT Host_Address;
|
||||
#endif
|
||||
#if defined (BACAPP_DEVICE_OBJECT_PROPERTY_REFERENCE)
|
||||
#if defined(BACAPP_DEVICE_OBJECT_PROPERTY_REFERENCE)
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE
|
||||
Device_Object_Property_Reference;
|
||||
Device_Object_Property_Reference;
|
||||
#endif
|
||||
#if defined (BACAPP_DEVICE_OBJECT_REFERENCE)
|
||||
#if defined(BACAPP_DEVICE_OBJECT_REFERENCE)
|
||||
BACNET_DEVICE_OBJECT_REFERENCE
|
||||
Device_Object_Reference;
|
||||
Device_Object_Reference;
|
||||
#endif
|
||||
#if defined (BACAPP_OBJECT_PROPERTY_REFERENCE)
|
||||
#if defined(BACAPP_OBJECT_PROPERTY_REFERENCE)
|
||||
BACNET_OBJECT_PROPERTY_REFERENCE
|
||||
Object_Property_Reference;
|
||||
Object_Property_Reference;
|
||||
#endif
|
||||
#if defined (BACAPP_DESTINATION)
|
||||
#if defined(BACAPP_DESTINATION)
|
||||
BACNET_DESTINATION Destination;
|
||||
#endif
|
||||
#if defined (BACAPP_CALENDAR_ENTRY)
|
||||
#if defined(BACAPP_CALENDAR_ENTRY)
|
||||
BACNET_CALENDAR_ENTRY Calendar_Entry;
|
||||
#endif
|
||||
#if defined (BACAPP_SPECIAL_EVENT)
|
||||
#if defined(BACAPP_SPECIAL_EVENT)
|
||||
BACNET_SPECIAL_EVENT Special_Event;
|
||||
#endif
|
||||
#if defined (BACAPP_BDT_ENTRY)
|
||||
#if defined(BACAPP_BDT_ENTRY)
|
||||
BACNET_BDT_ENTRY BDT_Entry;
|
||||
#endif
|
||||
#if defined (BACAPP_FDT_ENTRY)
|
||||
#if defined(BACAPP_FDT_ENTRY)
|
||||
BACNET_FDT_ENTRY FDT_Entry;
|
||||
#endif
|
||||
#if defined (BACAPP_ACTION_COMMAND)
|
||||
#if defined(BACAPP_ACTION_COMMAND)
|
||||
BACNET_ACTION_LIST Action_Command;
|
||||
#endif
|
||||
#if defined (BACAPP_SCALE)
|
||||
#if defined(BACAPP_SCALE)
|
||||
BACNET_SCALE Scale;
|
||||
#endif
|
||||
#if defined(BACAPP_SHED_LEVEL)
|
||||
@@ -208,186 +208,162 @@ typedef struct BACnet_Object_Property_Value {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bacapp_value_list_init(
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
size_t count);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacapp_property_value_list_init(
|
||||
BACNET_PROPERTY_VALUE *value,
|
||||
size_t count);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacapp_value_list_init(BACNET_APPLICATION_DATA_VALUE *value, size_t count);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacapp_property_value_list_init(
|
||||
BACNET_PROPERTY_VALUE *value, size_t count);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bacapp_property_value_list_link(
|
||||
BACNET_PROPERTY_VALUE *value_list,
|
||||
size_t count);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacapp_property_value_list_link(
|
||||
BACNET_PROPERTY_VALUE *value_list, size_t count);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_property_value_encode(
|
||||
uint8_t *apdu,
|
||||
const BACNET_PROPERTY_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_property_value_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_PROPERTY_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_property_value_encode(
|
||||
uint8_t *apdu, const BACNET_PROPERTY_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_property_value_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, BACNET_PROPERTY_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_data(
|
||||
uint8_t * apdu,
|
||||
const BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_known_property(
|
||||
uint8_t *apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_data_decode(
|
||||
const uint8_t * apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_data_type,
|
||||
uint32_t len_value_type,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_data_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_data(
|
||||
const uint8_t * apdu,
|
||||
uint8_t tag_data_type,
|
||||
uint32_t len_value_type,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_data(
|
||||
uint8_t *apdu, const BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_known_property(
|
||||
uint8_t *apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_data_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_data_type,
|
||||
uint32_t len_value_type,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_data_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_data(
|
||||
const uint8_t *apdu,
|
||||
uint8_t tag_data_type,
|
||||
uint32_t len_value_type,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_application_data(
|
||||
const uint8_t * apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_application_data(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_decode_application_data_safe(
|
||||
const uint8_t * apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_decode_application_data_safe(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_application_data(
|
||||
uint8_t * apdu,
|
||||
const BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_application_data(
|
||||
uint8_t *apdu, const BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_data(
|
||||
const uint8_t * apdu,
|
||||
unsigned max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_data(
|
||||
const uint8_t *apdu,
|
||||
unsigned max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_encode_known_property() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_data(
|
||||
uint8_t * apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_encode_known_property() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_data(
|
||||
uint8_t *apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_data_value(
|
||||
uint8_t * apdu,
|
||||
uint8_t context_tag_number,
|
||||
const BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_data_value(
|
||||
uint8_t *apdu,
|
||||
uint8_t context_tag_number,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_known_property_tag() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_APPLICATION_TAG bacapp_context_tag_type(
|
||||
BACNET_PROPERTY_ID property,
|
||||
uint8_t tag_number);
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_encode_known_property() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_generic_property(
|
||||
const uint8_t * apdu,
|
||||
int max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_PROPERTY_ID prop);
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_known_property_tag() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_APPLICATION_TAG
|
||||
bacapp_context_tag_type(BACNET_PROPERTY_ID property, uint8_t tag_number);
|
||||
BACNET_STACK_DEPRECATED("Use bacapp_encode_known_property() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_generic_property(
|
||||
const uint8_t *apdu,
|
||||
int max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_PROPERTY_ID prop);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_application_tag_value(
|
||||
const uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
BACNET_APPLICATION_TAG tag,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_known_property(const uint8_t *apdu,
|
||||
int max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_application_tag_value(
|
||||
const uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
BACNET_APPLICATION_TAG tag,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_known_property(
|
||||
const uint8_t *apdu,
|
||||
int max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
BACNET_PROPERTY_ID property);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_known_property_tag(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_known_property_tag(
|
||||
BACNET_OBJECT_TYPE object_type, BACNET_PROPERTY_ID property);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_copy(
|
||||
BACNET_APPLICATION_DATA_VALUE * dest_value,
|
||||
BACNET_APPLICATION_DATA_VALUE * src_value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_copy(
|
||||
BACNET_APPLICATION_DATA_VALUE *dest_value,
|
||||
BACNET_APPLICATION_DATA_VALUE *src_value);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_enclosed_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_data_len(
|
||||
const uint8_t * apdu,
|
||||
unsigned max_apdu_len,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_enclosed_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_data_len(
|
||||
const uint8_t *apdu, unsigned max_apdu_len, BACNET_PROPERTY_ID property);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_application_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_data_len(
|
||||
const uint8_t * apdu,
|
||||
uint8_t tag_data_type,
|
||||
uint32_t len_value_type);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_application_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_data_len(
|
||||
const uint8_t *apdu, uint8_t tag_data_type, uint32_t len_value_type);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_enclosed_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_application_data_len(
|
||||
const uint8_t * apdu,
|
||||
unsigned max_apdu_len);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_enclosed_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_application_data_len(
|
||||
const uint8_t *apdu, unsigned max_apdu_len);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_enclosed_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_data_len(
|
||||
const uint8_t * apdu,
|
||||
unsigned max_apdu_len,
|
||||
BACNET_PROPERTY_ID property);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_enclosed_data_length() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_data_len(
|
||||
const uint8_t *apdu, unsigned max_apdu_len, BACNET_PROPERTY_ID property);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_snprintf(
|
||||
char *buffer,
|
||||
size_t count,
|
||||
const char *format, ...);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_snprintf_shift(
|
||||
int len,
|
||||
char **buf,
|
||||
size_t *buf_size);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_snprintf_value(
|
||||
char *str,
|
||||
size_t str_len,
|
||||
const BACNET_OBJECT_PROPERTY_VALUE * object_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_snprintf(char *buffer, size_t count, const char *format, ...);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_snprintf_shift(int len, char **buf, size_t *buf_size);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_snprintf_value(
|
||||
char *str,
|
||||
size_t str_len,
|
||||
const BACNET_OBJECT_PROPERTY_VALUE *object_value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_parse_application_data(
|
||||
BACNET_APPLICATION_TAG tag_number,
|
||||
char *argv,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_parse_application_data(
|
||||
BACNET_APPLICATION_TAG tag_number,
|
||||
char *argv,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_print_value(
|
||||
FILE * stream,
|
||||
const BACNET_OBJECT_PROPERTY_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_print_value(
|
||||
FILE *stream, const BACNET_OBJECT_PROPERTY_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_same_value(
|
||||
const BACNET_APPLICATION_DATA_VALUE * value,
|
||||
const BACNET_APPLICATION_DATA_VALUE * test_value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacapp_same_value(
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
const BACNET_APPLICATION_DATA_VALUE *test_value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+153
-81
@@ -205,7 +205,8 @@ int decode_max_apdu(uint8_t octet)
|
||||
*
|
||||
* @return Returns the number of apdu bytes consumed.
|
||||
*/
|
||||
int encode_tag(uint8_t *apdu,
|
||||
int encode_tag(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
bool context_specific,
|
||||
uint32_t len_value_type)
|
||||
@@ -738,7 +739,10 @@ int decode_tag_number_and_value(
|
||||
* @deprecated use bacnet_tag_decode() instead
|
||||
*/
|
||||
int bacnet_tag_number_and_value_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t *tag_number, uint32_t *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t *tag_number,
|
||||
uint32_t *value)
|
||||
{
|
||||
int len = 0;
|
||||
BACNET_TAG tag = { 0 };
|
||||
@@ -762,8 +766,7 @@ int bacnet_tag_number_and_value_decode(
|
||||
* @param len_value_type Length of the data in bytes.
|
||||
* @return datalength for the given tag, or INT_MAX if out of range.
|
||||
*/
|
||||
int bacnet_application_data_length(
|
||||
uint8_t tag_number, uint32_t len_value_type)
|
||||
int bacnet_application_data_length(uint8_t tag_number, uint32_t len_value_type)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@@ -804,8 +807,7 @@ int bacnet_application_data_length(
|
||||
* @return length of data between an opening tag and a closing tag 0..N,
|
||||
* or BACNET_STATUS_ERROR.
|
||||
*/
|
||||
int bacnet_enclosed_data_length(
|
||||
const uint8_t *apdu, size_t apdu_size)
|
||||
int bacnet_enclosed_data_length(const uint8_t *apdu, size_t apdu_size)
|
||||
{
|
||||
int len = 0;
|
||||
int total_len = 0;
|
||||
@@ -862,8 +864,8 @@ int bacnet_enclosed_data_length(
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
/* application tagged data */
|
||||
len += bacnet_application_data_length(tag.number,
|
||||
tag.len_value_type);
|
||||
len +=
|
||||
bacnet_application_data_length(tag.number, tag.len_value_type);
|
||||
total_len_enable = true;
|
||||
}
|
||||
if (opening_tag_number_counter > 0) {
|
||||
@@ -946,8 +948,11 @@ bool decode_is_context_tag_with_length(
|
||||
* @return true on a match, false otherwise.
|
||||
*/
|
||||
bool bacnet_is_context_tag_number(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t tag_number,
|
||||
int *tag_length, uint32_t *len_value_type)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
int *tag_length,
|
||||
uint32_t *len_value_type)
|
||||
{
|
||||
bool match = false;
|
||||
int len;
|
||||
@@ -1006,7 +1011,10 @@ bool decode_is_opening_tag_number(const uint8_t *apdu, uint8_t tag_number)
|
||||
* @return true if the tag number matches and is an opening tag.
|
||||
*/
|
||||
bool bacnet_is_opening_tag_number(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t tag_number, int *tag_length)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
int *tag_length)
|
||||
{
|
||||
bool match = false;
|
||||
int len;
|
||||
@@ -1060,7 +1068,10 @@ bool decode_is_closing_tag_number(const uint8_t *apdu, uint8_t tag_number)
|
||||
* @return true if the tag number matches is an closing tag.
|
||||
*/
|
||||
bool bacnet_is_closing_tag_number(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t tag_number, int *tag_length)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
int *tag_length)
|
||||
{
|
||||
bool match = false;
|
||||
int len;
|
||||
@@ -1284,7 +1295,10 @@ int bacnet_boolean_application_decode(
|
||||
* or #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacnet_boolean_context_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t tag_value, bool *boolean_value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_value,
|
||||
bool *boolean_value)
|
||||
{
|
||||
int apdu_len = BACNET_STATUS_ERROR;
|
||||
int len = 0;
|
||||
@@ -1435,7 +1449,8 @@ int decode_bitstring(
|
||||
*
|
||||
* @return number of bytes decoded, or zero if errors occur
|
||||
*/
|
||||
int bacnet_bitstring_decode(const uint8_t *apdu,
|
||||
int bacnet_bitstring_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
BACNET_BIT_STRING *value)
|
||||
@@ -1520,8 +1535,9 @@ int bacnet_bitstring_application_decode(
|
||||
if ((len > 0) && tag.application) {
|
||||
if (tag.number == BACNET_APPLICATION_TAG_BIT_STRING) {
|
||||
apdu_len = len;
|
||||
len = bacnet_bitstring_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_bitstring_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -1548,7 +1564,8 @@ int bacnet_bitstring_application_decode(
|
||||
* @return number of bytes decoded, or zero if tag number mismatch, or
|
||||
* #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacnet_bitstring_context_decode(const uint8_t *apdu,
|
||||
int bacnet_bitstring_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_value,
|
||||
BACNET_BIT_STRING *value)
|
||||
@@ -1561,8 +1578,9 @@ int bacnet_bitstring_context_decode(const uint8_t *apdu,
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_bitstring_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_bitstring_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -1667,7 +1685,8 @@ int encode_application_bitstring(uint8_t *apdu, const BACNET_BIT_STRING *value)
|
||||
|
||||
/* bit string may use more than 1 octet for the tag, so find out how many */
|
||||
bit_string_encoded_length += bitstring_bytes_used(value);
|
||||
len = encode_tag(apdu, BACNET_APPLICATION_TAG_BIT_STRING, false,
|
||||
len = encode_tag(
|
||||
apdu, BACNET_APPLICATION_TAG_BIT_STRING, false,
|
||||
bit_string_encoded_length);
|
||||
if (apdu) {
|
||||
apdu_offset = &apdu[len];
|
||||
@@ -1717,7 +1736,8 @@ int encode_context_bitstring(
|
||||
*
|
||||
* @return the number of apdu bytes consumed
|
||||
*/
|
||||
int decode_object_id_safe(const uint8_t *apdu,
|
||||
int decode_object_id_safe(
|
||||
const uint8_t *apdu,
|
||||
uint32_t len_value_type,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t *instance)
|
||||
@@ -1772,7 +1792,8 @@ int decode_object_id(
|
||||
*
|
||||
* @return the number of apdu bytes consumed, or 0 if apdu is too small
|
||||
*/
|
||||
int bacnet_object_id_decode(const uint8_t *apdu,
|
||||
int bacnet_object_id_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value_type,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
@@ -1833,7 +1854,8 @@ int bacnet_object_id_application_encode(
|
||||
* @return number of bytes decoded, zero if wrong tag number,
|
||||
* or #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacnet_object_id_application_decode(const uint8_t *apdu,
|
||||
int bacnet_object_id_application_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t *object_instance)
|
||||
@@ -1846,8 +1868,9 @@ int bacnet_object_id_application_decode(const uint8_t *apdu,
|
||||
if ((len > 0) && tag.application) {
|
||||
if (tag.number == BACNET_APPLICATION_TAG_OBJECT_ID) {
|
||||
apdu_len = len;
|
||||
len = bacnet_object_id_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, object_type, object_instance);
|
||||
len = bacnet_object_id_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
object_type, object_instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -1875,7 +1898,8 @@ int bacnet_object_id_application_decode(const uint8_t *apdu,
|
||||
* @return number of bytes decoded, zero if wrong tag number,
|
||||
* or #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacnet_object_id_context_decode(const uint8_t *apdu,
|
||||
int bacnet_object_id_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_value,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
@@ -1889,8 +1913,9 @@ int bacnet_object_id_context_decode(const uint8_t *apdu,
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_object_id_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, object_type, object_instance);
|
||||
len = bacnet_object_id_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
object_type, object_instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -1918,7 +1943,8 @@ int bacnet_object_id_context_decode(const uint8_t *apdu,
|
||||
* if wrong tag number or malformed
|
||||
* @deprecated Use bacnet_object_id_context_decode() instead
|
||||
*/
|
||||
int decode_context_object_id(const uint8_t *apdu,
|
||||
int decode_context_object_id(
|
||||
const uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t *instance)
|
||||
@@ -1971,7 +1997,8 @@ int encode_bacnet_object_id(
|
||||
*
|
||||
* @return the number of apdu bytes encoded
|
||||
*/
|
||||
int encode_context_object_id(uint8_t *apdu,
|
||||
int encode_context_object_id(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t instance)
|
||||
@@ -2058,12 +2085,14 @@ int encode_octet_string(uint8_t *apdu, const BACNET_OCTET_STRING *octet_string)
|
||||
*
|
||||
* @return returns the number of apdu bytes consumed
|
||||
*/
|
||||
int encode_application_octet_string(uint8_t *apdu, const BACNET_OCTET_STRING *value)
|
||||
int encode_application_octet_string(
|
||||
uint8_t *apdu, const BACNET_OCTET_STRING *value)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
if (value) {
|
||||
len = encode_tag(apdu, BACNET_APPLICATION_TAG_OCTET_STRING, false,
|
||||
len = encode_tag(
|
||||
apdu, BACNET_APPLICATION_TAG_OCTET_STRING, false,
|
||||
octetstring_length(value));
|
||||
if (apdu) {
|
||||
apdu += len;
|
||||
@@ -2114,7 +2143,8 @@ int encode_context_octet_string(
|
||||
*
|
||||
* @return number of bytes decoded (0..N), or BACNET_STATUS_ERROR on error
|
||||
*/
|
||||
int bacnet_octet_string_decode(const uint8_t *apdu,
|
||||
int bacnet_octet_string_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
BACNET_OCTET_STRING *value)
|
||||
@@ -2270,7 +2300,8 @@ int bacnet_octet_string_application_decode(
|
||||
* @return number of bytes decoded, or zero if tag number mismatch, or
|
||||
* #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacnet_octet_string_context_decode(const uint8_t *apdu,
|
||||
int bacnet_octet_string_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_value,
|
||||
BACNET_OCTET_STRING *value)
|
||||
@@ -2283,8 +2314,9 @@ int bacnet_octet_string_context_decode(const uint8_t *apdu,
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_octet_string_decode(&apdu[apdu_len],
|
||||
apdu_size - apdu_len, tag.len_value_type, value);
|
||||
len = bacnet_octet_string_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len >= 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -2313,7 +2345,8 @@ int bacnet_octet_string_context_decode(const uint8_t *apdu,
|
||||
* @return returns the number of apdu bytes consumed, or 0 if too large
|
||||
* @deprecated use encode_bacnet_character_string() instead
|
||||
*/
|
||||
uint32_t encode_bacnet_character_string_safe(uint8_t *apdu,
|
||||
uint32_t encode_bacnet_character_string_safe(
|
||||
uint8_t *apdu,
|
||||
uint32_t max_apdu,
|
||||
uint8_t encoding,
|
||||
const char *value,
|
||||
@@ -2407,7 +2440,9 @@ int encode_application_character_string(
|
||||
* @return returns the number of apdu bytes consumed
|
||||
*/
|
||||
int encode_context_character_string(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_CHARACTER_STRING *char_string)
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_CHARACTER_STRING *char_string)
|
||||
{
|
||||
int len = 0;
|
||||
uint8_t *apdu_offset = NULL;
|
||||
@@ -2434,7 +2469,8 @@ int encode_context_character_string(
|
||||
*
|
||||
* @return number of bytes decoded, or zero if errors occur
|
||||
*/
|
||||
int bacnet_character_string_decode(const uint8_t *apdu,
|
||||
int bacnet_character_string_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
BACNET_CHARACTER_STRING *char_string)
|
||||
@@ -2557,7 +2593,8 @@ int bacnet_character_string_application_decode(
|
||||
* @return number of bytes decoded, or zero if tag number mismatch, or
|
||||
* #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacnet_character_string_context_decode(const uint8_t *apdu,
|
||||
int bacnet_character_string_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_value,
|
||||
BACNET_CHARACTER_STRING *value)
|
||||
@@ -2570,8 +2607,9 @@ int bacnet_character_string_context_decode(const uint8_t *apdu,
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_character_string_decode(&apdu[apdu_len],
|
||||
apdu_size - apdu_len, tag.len_value_type, value);
|
||||
len = bacnet_character_string_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -2625,7 +2663,8 @@ int decode_context_character_string(
|
||||
*
|
||||
* @return number of bytes decoded, or zero if errors occur
|
||||
*/
|
||||
int bacnet_unsigned_decode(const uint8_t *apdu,
|
||||
int bacnet_unsigned_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
BACNET_UNSIGNED_INTEGER *value)
|
||||
@@ -2720,7 +2759,8 @@ int bacnet_unsigned_decode(const uint8_t *apdu,
|
||||
* @return number of bytes decoded, zero if wrong tag number,
|
||||
* or #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacnet_unsigned_context_decode(const uint8_t *apdu,
|
||||
int bacnet_unsigned_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_value,
|
||||
BACNET_UNSIGNED_INTEGER *value)
|
||||
@@ -2733,8 +2773,9 @@ int bacnet_unsigned_context_decode(const uint8_t *apdu,
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_unsigned_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_unsigned_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -2799,8 +2840,9 @@ int bacnet_unsigned_application_decode(
|
||||
if ((len > 0) && tag.application) {
|
||||
if (tag.number == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
||||
apdu_len = len;
|
||||
len = bacnet_unsigned_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_unsigned_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -2976,7 +3018,10 @@ int encode_application_unsigned(uint8_t *apdu, BACNET_UNSIGNED_INTEGER value)
|
||||
* @return number of bytes decoded, or zero if errors occur
|
||||
*/
|
||||
int bacnet_enumerated_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint32_t len_value, uint32_t *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
uint32_t *value)
|
||||
{
|
||||
BACNET_UNSIGNED_INTEGER unsigned_value = 0;
|
||||
int len;
|
||||
@@ -3061,8 +3106,9 @@ int bacnet_enumerated_application_decode(
|
||||
if (tag.number == BACNET_APPLICATION_TAG_ENUMERATED) {
|
||||
apdu_len = len;
|
||||
/* note: enumerated is encoded as UNSIGNED INT */
|
||||
len = bacnet_unsigned_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, &unsigned_value);
|
||||
len = bacnet_unsigned_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
&unsigned_value);
|
||||
if (len > 0) {
|
||||
if (unsigned_value > UINT32_MAX) {
|
||||
apdu_len = BACNET_STATUS_ERROR;
|
||||
@@ -3107,8 +3153,9 @@ int bacnet_enumerated_context_decode(
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_enumerated_decode(&apdu[apdu_len],
|
||||
apdu_size - apdu_len, tag.len_value_type, value);
|
||||
len = bacnet_enumerated_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -3135,7 +3182,8 @@ int bacnet_enumerated_context_decode(
|
||||
* if wrong tag number or malformed
|
||||
* @deprecated use bacnet_enumerated_context_decode() instead
|
||||
*/
|
||||
int decode_context_enumerated(const uint8_t *apdu, uint8_t tag_value, uint32_t *value)
|
||||
int decode_context_enumerated(
|
||||
const uint8_t *apdu, uint8_t tag_value, uint32_t *value)
|
||||
{
|
||||
const uint32_t apdu_size = 6;
|
||||
int len = 0;
|
||||
@@ -3282,8 +3330,9 @@ int bacnet_signed_context_decode(
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_signed_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_signed_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -3347,8 +3396,9 @@ int bacnet_signed_application_decode(
|
||||
if ((len > 0) && tag.application) {
|
||||
if (tag.number == BACNET_APPLICATION_TAG_SIGNED_INT) {
|
||||
apdu_len = len;
|
||||
len = bacnet_signed_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_signed_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -3395,7 +3445,8 @@ int decode_signed(const uint8_t *apdu, uint32_t len_value, int32_t *value)
|
||||
* wrong tag number, or error (-1) if malformed
|
||||
* @deprecated use bacnet_signed_context_decode() instead
|
||||
*/
|
||||
int decode_context_signed(const uint8_t *apdu, uint8_t tag_value, int32_t *value)
|
||||
int decode_context_signed(
|
||||
const uint8_t *apdu, uint8_t tag_value, int32_t *value)
|
||||
{
|
||||
const uint32_t apdu_size = 6;
|
||||
int len = 0;
|
||||
@@ -3590,8 +3641,9 @@ int bacnet_real_context_decode(
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_real_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_real_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -3655,8 +3707,9 @@ int bacnet_real_application_decode(
|
||||
if ((len > 0) && tag.application) {
|
||||
if (tag.number == BACNET_APPLICATION_TAG_REAL) {
|
||||
apdu_len = len;
|
||||
len = bacnet_real_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_real_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -3683,7 +3736,8 @@ int bacnet_real_application_decode(
|
||||
* if wrong tag number or malformed
|
||||
* @deprecated use bacnet_real_context_decode() instead
|
||||
*/
|
||||
int decode_context_real(const uint8_t *apdu, uint8_t tag_number, float *real_value)
|
||||
int decode_context_real(
|
||||
const uint8_t *apdu, uint8_t tag_number, float *real_value)
|
||||
{
|
||||
uint32_t len_value;
|
||||
int len = 0;
|
||||
@@ -3798,8 +3852,9 @@ int bacnet_double_context_decode(
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_double_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_double_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -3863,8 +3918,9 @@ int bacnet_double_application_decode(
|
||||
if ((len > 0) && tag.application) {
|
||||
if (tag.number == BACNET_APPLICATION_TAG_DOUBLE) {
|
||||
apdu_len = len;
|
||||
len = bacnet_double_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_double_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -3994,7 +4050,10 @@ int encode_context_time(
|
||||
* @return number of bytes decoded, or zero if errors occur
|
||||
*/
|
||||
int bacnet_time_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint32_t len_value, BACNET_TIME *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
BACNET_TIME *value)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@@ -4026,7 +4085,10 @@ int bacnet_time_decode(
|
||||
* or error (-1) if malformed
|
||||
*/
|
||||
int bacnet_time_context_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t tag_value, BACNET_TIME *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_value,
|
||||
BACNET_TIME *value)
|
||||
{
|
||||
int apdu_len = BACNET_STATUS_ERROR;
|
||||
int len = 0;
|
||||
@@ -4036,8 +4098,9 @@ int bacnet_time_context_decode(
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_time_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_time_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -4101,8 +4164,9 @@ int bacnet_time_application_decode(
|
||||
if ((len > 0) && tag.application) {
|
||||
if (tag.number == BACNET_APPLICATION_TAG_TIME) {
|
||||
apdu_len = len;
|
||||
len = bacnet_time_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_time_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -4291,7 +4355,8 @@ int encode_application_date(uint8_t *apdu, const BACNET_DATE *bdate)
|
||||
*
|
||||
* @return the number of apdu bytes consumed.
|
||||
*/
|
||||
int encode_context_date(uint8_t *apdu, uint8_t tag_number, const BACNET_DATE *bdate)
|
||||
int encode_context_date(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_DATE *bdate)
|
||||
{
|
||||
int len = 0; /* return value */
|
||||
uint8_t *apdu_offset = NULL;
|
||||
@@ -4339,7 +4404,8 @@ int decode_date(const uint8_t *apdu, BACNET_DATE *bdate)
|
||||
* @return number of bytes decoded, or zero if errors occur
|
||||
* @deprecated use bacnet_date_decode() instead
|
||||
*/
|
||||
int decode_date_safe(const uint8_t *apdu, uint32_t len_value, BACNET_DATE *bdate)
|
||||
int decode_date_safe(
|
||||
const uint8_t *apdu, uint32_t len_value, BACNET_DATE *bdate)
|
||||
{
|
||||
if (len_value != 4) {
|
||||
bdate->day = 0;
|
||||
@@ -4365,7 +4431,10 @@ int decode_date_safe(const uint8_t *apdu, uint32_t len_value, BACNET_DATE *bdate
|
||||
* @return number of bytes decoded, or zero if errors occur
|
||||
*/
|
||||
int bacnet_date_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint32_t len_value, BACNET_DATE *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
BACNET_DATE *value)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@@ -4410,8 +4479,9 @@ int bacnet_date_context_decode(
|
||||
if ((len > 0) && tag.context) {
|
||||
if (tag.number == tag_value) {
|
||||
apdu_len = len;
|
||||
len = bacnet_date_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, value);
|
||||
len = bacnet_date_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
value);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else {
|
||||
@@ -4529,7 +4599,8 @@ int decode_application_date(const uint8_t *apdu, BACNET_DATE *value)
|
||||
* if wrong tag number or malformed
|
||||
* @deprecated use bacnet_date_context_decode() instead
|
||||
*/
|
||||
int decode_context_date(const uint8_t *apdu, uint8_t tag_value, BACNET_DATE *value)
|
||||
int decode_context_date(
|
||||
const uint8_t *apdu, uint8_t tag_value, BACNET_DATE *value)
|
||||
{
|
||||
int len = 0;
|
||||
const uint32_t apdu_size = BACNET_TAG_SIZE + 4;
|
||||
@@ -4577,7 +4648,8 @@ int encode_simple_ack(uint8_t *apdu, uint8_t invoke_id, uint8_t service_choice)
|
||||
* BACNET_STATUS_ERROR for an invalid array index
|
||||
* BACNET_STATUS_ABORT for abort message.
|
||||
*/
|
||||
int bacnet_array_encode(uint32_t object_instance,
|
||||
int bacnet_array_encode(
|
||||
uint32_t object_instance,
|
||||
BACNET_ARRAY_INDEX array_index,
|
||||
bacnet_array_property_element_encode_function encoder,
|
||||
BACNET_UNSIGNED_INTEGER array_size,
|
||||
|
||||
+84
-41
@@ -49,7 +49,8 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_tag(uint8_t *apdu,
|
||||
int encode_tag(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
bool context_specific,
|
||||
uint32_t len_value_type);
|
||||
@@ -61,8 +62,7 @@ int encode_closing_tag(uint8_t *apdu, uint8_t tag_number);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_tag_encode(uint8_t *apdu, uint32_t apdu_size, const BACNET_TAG *tag);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_tag_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, BACNET_TAG *tag);
|
||||
int bacnet_tag_decode(const uint8_t *apdu, uint32_t apdu_size, BACNET_TAG *tag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_is_opening_tag(const uint8_t *apdu, uint32_t apdu_size);
|
||||
@@ -89,20 +89,23 @@ bool bacnet_is_opening_tag_number(
|
||||
int *tag_length);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_is_closing_tag_number(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t tag_number,
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
int *tag_length);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_application_data_length(
|
||||
uint8_t tag_number, uint32_t len_value_type);
|
||||
int bacnet_application_data_length(uint8_t tag_number, uint32_t len_value_type);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_enclosed_data_length(
|
||||
const uint8_t *apdu, size_t apdu_size);
|
||||
int bacnet_enclosed_data_length(const uint8_t *apdu, size_t apdu_size);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_tag_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_tag_number_and_value_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t *tag_number, uint32_t *value);
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t *tag_number,
|
||||
uint32_t *value);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_tag_number_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_tag_number(const uint8_t *apdu, uint8_t *tag_number);
|
||||
@@ -158,7 +161,8 @@ BACNET_STACK_EXPORT
|
||||
int bacnet_boolean_application_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, bool *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_boolean_context_decode(const uint8_t *apdu,
|
||||
int bacnet_boolean_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint8_t tag_value,
|
||||
bool *boolean_value);
|
||||
@@ -166,7 +170,8 @@ int bacnet_boolean_context_decode(const uint8_t *apdu,
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_bitstring(uint8_t *apdu, const BACNET_BIT_STRING *bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_application_bitstring(uint8_t *apdu, const BACNET_BIT_STRING *bit_string);
|
||||
int encode_application_bitstring(
|
||||
uint8_t *apdu, const BACNET_BIT_STRING *bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_context_bitstring(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_BIT_STRING *bit_string);
|
||||
@@ -179,7 +184,8 @@ BACNET_STACK_EXPORT
|
||||
int decode_context_bitstring(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_BIT_STRING *bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_bitstring_decode(const uint8_t *apdu,
|
||||
int bacnet_bitstring_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
BACNET_BIT_STRING *value);
|
||||
@@ -203,13 +209,20 @@ BACNET_STACK_EXPORT
|
||||
int encode_context_real(uint8_t *apdu, uint8_t tag_number, float value);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_real_context_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_context_real(const uint8_t *apdu, uint8_t tag_number, float *real_value);
|
||||
int decode_context_real(
|
||||
const uint8_t *apdu, uint8_t tag_number, float *real_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_real_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, uint32_t len_value, float *value);
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
float *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_real_context_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, uint8_t tag_value, float *value);
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint8_t tag_value,
|
||||
float *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_real_application_encode(
|
||||
uint8_t *apdu, uint32_t apdu_size, float value);
|
||||
@@ -227,10 +240,16 @@ int decode_context_double(
|
||||
const uint8_t *apdu, uint8_t tag_number, double *double_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_double_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, uint32_t len_value, double *value);
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
double *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_double_context_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, uint8_t tag_value, double *value);
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint8_t tag_value,
|
||||
double *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_double_application_encode(
|
||||
uint8_t *apdu, uint32_t apdu_size, double value);
|
||||
@@ -242,7 +261,8 @@ BACNET_STACK_EXPORT
|
||||
int encode_bacnet_object_id(
|
||||
uint8_t *apdu, BACNET_OBJECT_TYPE object_type, uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_context_object_id(uint8_t *apdu,
|
||||
int encode_context_object_id(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t instance);
|
||||
@@ -257,17 +277,20 @@ int decode_object_id(
|
||||
uint32_t *object_instance);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_object_id_context_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_context_object_id(const uint8_t *apdu,
|
||||
int decode_context_object_id(
|
||||
const uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t *instance);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_object_id_safe(const uint8_t *apdu,
|
||||
int decode_object_id_safe(
|
||||
const uint8_t *apdu,
|
||||
uint32_t len_value,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t *object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_object_id_decode(const uint8_t *apdu,
|
||||
int bacnet_object_id_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
@@ -310,7 +333,8 @@ BACNET_STACK_EXPORT
|
||||
int decode_context_octet_string(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_OCTET_STRING *octet_string);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_octet_string_decode(const uint8_t *apdu,
|
||||
int bacnet_octet_string_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
BACNET_OCTET_STRING *value);
|
||||
@@ -329,7 +353,8 @@ int bacnet_octet_string_context_decode(
|
||||
BACNET_OCTET_STRING *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t encode_bacnet_character_string_safe(uint8_t *apdu,
|
||||
uint32_t encode_bacnet_character_string_safe(
|
||||
uint8_t *apdu,
|
||||
uint32_t max_apdu,
|
||||
uint8_t encoding,
|
||||
const char *pString,
|
||||
@@ -342,7 +367,9 @@ int encode_application_character_string(
|
||||
uint8_t *apdu, const BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_context_character_string(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_CHARACTER_STRING *char_string);
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_character_string_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_character_string(
|
||||
@@ -356,7 +383,8 @@ int decode_context_character_string(
|
||||
uint8_t tag_number,
|
||||
BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_character_string_decode(const uint8_t *apdu,
|
||||
int bacnet_character_string_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
BACNET_CHARACTER_STRING *char_string);
|
||||
@@ -390,7 +418,8 @@ BACNET_STACK_EXPORT
|
||||
int decode_context_unsigned(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_UNSIGNED_INTEGER *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_unsigned_decode(const uint8_t *apdu,
|
||||
int bacnet_unsigned_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_max_len,
|
||||
uint32_t len_value,
|
||||
BACNET_UNSIGNED_INTEGER *value);
|
||||
@@ -419,11 +448,15 @@ BACNET_STACK_EXPORT
|
||||
int decode_signed(const uint8_t *apdu, uint32_t len_value, int32_t *value);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_signed_context_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_context_signed(const uint8_t *apdu, uint8_t tag_number, int32_t *value);
|
||||
int decode_context_signed(
|
||||
const uint8_t *apdu, uint8_t tag_number, int32_t *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_signed_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint32_t len_value, int32_t *value);
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint32_t len_value,
|
||||
int32_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_signed_context_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, uint8_t tag_value, int32_t *value);
|
||||
@@ -450,8 +483,10 @@ int decode_context_enumerated(
|
||||
const uint8_t *apdu, uint8_t tag_value, uint32_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_enumerated_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_max_len, uint32_t len_value, uint32_t *value);
|
||||
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_max_len,
|
||||
uint32_t len_value,
|
||||
uint32_t *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_enumerated_application_encode(
|
||||
@@ -461,7 +496,10 @@ int bacnet_enumerated_application_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, uint32_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_enumerated_context_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, uint8_t tag_value, uint32_t *value);
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint8_t tag_value,
|
||||
uint32_t *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_bacnet_time(uint8_t *apdu, const BACNET_TIME *btime);
|
||||
@@ -485,12 +523,14 @@ BACNET_STACK_EXPORT
|
||||
int decode_context_bacnet_time(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_TIME *btime);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_decode(const uint8_t *apdu,
|
||||
int bacnet_time_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
BACNET_TIME *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_context_decode(const uint8_t *apdu,
|
||||
int bacnet_time_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint8_t tag_value,
|
||||
BACNET_TIME *value);
|
||||
@@ -523,7 +563,8 @@ BACNET_STACK_EXPORT
|
||||
int decode_context_date(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_DATE *bdate);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_date_decode(const uint8_t *apdu,
|
||||
int bacnet_date_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint32_t len_value,
|
||||
BACNET_DATE *value);
|
||||
@@ -535,7 +576,8 @@ BACNET_STACK_EXPORT
|
||||
int bacnet_date_application_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_len_max, BACNET_DATE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_date_context_decode(const uint8_t *apdu,
|
||||
int bacnet_date_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_len_max,
|
||||
uint8_t tag_value,
|
||||
BACNET_DATE *value);
|
||||
@@ -555,7 +597,8 @@ BACNET_STACK_EXPORT
|
||||
int encode_simple_ack(uint8_t *apdu, uint8_t invoke_id, uint8_t service_choice);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_array_encode(uint32_t object_instance,
|
||||
int bacnet_array_encode(
|
||||
uint32_t object_instance,
|
||||
BACNET_ARRAY_INDEX array_index,
|
||||
bacnet_array_property_element_encode_function encoder,
|
||||
BACNET_UNSIGNED_INTEGER array_size,
|
||||
@@ -564,23 +607,23 @@ int bacnet_array_encode(uint32_t object_instance,
|
||||
|
||||
/* from clause 20.2.1.2 Tag Number */
|
||||
/* true if extended tag numbering is used */
|
||||
#define IS_EXTENDED_TAG_NUMBER(x) (((x)&0xF0) == 0xF0)
|
||||
#define IS_EXTENDED_TAG_NUMBER(x) (((x) & 0xF0) == 0xF0)
|
||||
|
||||
/* from clause 20.2.1.3.1 Primitive Data */
|
||||
/* true if the extended value is used */
|
||||
#define IS_EXTENDED_VALUE(x) (((x)&0x07) == 5)
|
||||
#define IS_EXTENDED_VALUE(x) (((x) & 0x07) == 5)
|
||||
|
||||
/* from clause 20.2.1.1 Class */
|
||||
/* true if the tag is context specific */
|
||||
#define IS_CONTEXT_SPECIFIC(x) (((x)&BIT(3)) == BIT(3))
|
||||
#define IS_CONTEXT_SPECIFIC(x) (((x) & BIT(3)) == BIT(3))
|
||||
|
||||
/* from clause 20.2.1.3.2 Constructed Data */
|
||||
/* true if the tag is an opening tag */
|
||||
#define IS_OPENING_TAG(x) (((x)&0x07) == 6)
|
||||
#define IS_OPENING_TAG(x) (((x) & 0x07) == 6)
|
||||
|
||||
/* from clause 20.2.1.3.2 Constructed Data */
|
||||
/* true if the tag is a closing tag */
|
||||
#define IS_CLOSING_TAG(x) (((x)&0x07) == 7)
|
||||
#define IS_CLOSING_TAG(x) (((x) & 0x07) == 7)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+4
-4
@@ -185,11 +185,11 @@ typedef struct BACnet_Object_Id {
|
||||
#define MAX_NPDU (1 + 1 + 2 + 1 + MAX_MAC_LEN + 2 + 1 + MAX_MAC_LEN + 1 + 1 + 2)
|
||||
#define MAX_PDU (MAX_APDU + MAX_NPDU)
|
||||
|
||||
#define BACNET_ID_VALUE(bacnet_object_instance, bacnet_object_type) \
|
||||
((((bacnet_object_type)&BACNET_MAX_OBJECT) << BACNET_INSTANCE_BITS) | \
|
||||
((bacnet_object_instance)&BACNET_MAX_INSTANCE))
|
||||
#define BACNET_ID_VALUE(bacnet_object_instance, bacnet_object_type) \
|
||||
((((bacnet_object_type) & BACNET_MAX_OBJECT) << BACNET_INSTANCE_BITS) | \
|
||||
((bacnet_object_instance) & BACNET_MAX_INSTANCE))
|
||||
#define BACNET_INSTANCE(bacnet_object_id_num) \
|
||||
((bacnet_object_id_num)&BACNET_MAX_INSTANCE)
|
||||
((bacnet_object_id_num) & BACNET_MAX_INSTANCE)
|
||||
#define BACNET_TYPE(bacnet_object_id_num) \
|
||||
(((bacnet_object_id_num) >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT)
|
||||
|
||||
|
||||
@@ -82,8 +82,7 @@ void bacnet_destination_copy(
|
||||
BACNET_DESTINATION *dest, const BACNET_DESTINATION *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bacnet_recipient_copy(
|
||||
BACNET_RECIPIENT *dest, const BACNET_RECIPIENT *src);
|
||||
void bacnet_recipient_copy(BACNET_RECIPIENT *dest, const BACNET_RECIPIENT *src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_recipient_same(
|
||||
const BACNET_RECIPIENT *r1, const BACNET_RECIPIENT *r2);
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
*
|
||||
* @return Bytes encoded or 0 on failure.
|
||||
*/
|
||||
int bacapp_encode_context_device_obj_property_ref(uint8_t *apdu,
|
||||
int bacapp_encode_context_device_obj_property_ref(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value)
|
||||
{
|
||||
@@ -78,7 +79,8 @@ int bacapp_encode_device_obj_property_ref(
|
||||
return apdu_len;
|
||||
}
|
||||
/* object-identifier [0] BACnetObjectIdentifier */
|
||||
len = encode_context_object_id(apdu, 0, value->objectIdentifier.type,
|
||||
len = encode_context_object_id(
|
||||
apdu, 0, value->objectIdentifier.type,
|
||||
value->objectIdentifier.instance);
|
||||
apdu_len += len;
|
||||
if (apdu) {
|
||||
@@ -104,7 +106,8 @@ int bacapp_encode_device_obj_property_ref(
|
||||
* (set type to BACNET_NO_DEV_TYPE or something other than OBJECT_DEVICE to
|
||||
* omit */
|
||||
if (value->deviceIdentifier.type == OBJECT_DEVICE) {
|
||||
len = encode_context_object_id(apdu, 3, value->deviceIdentifier.type,
|
||||
len = encode_context_object_id(
|
||||
apdu, 3, value->deviceIdentifier.type,
|
||||
value->deviceIdentifier.instance);
|
||||
apdu_len += len;
|
||||
}
|
||||
@@ -131,7 +134,8 @@ int bacapp_encode_device_obj_property_ref(
|
||||
*
|
||||
* @return number of bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||
*/
|
||||
int bacnet_device_object_property_reference_decode(const uint8_t *apdu,
|
||||
int bacnet_device_object_property_reference_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value)
|
||||
{
|
||||
@@ -147,8 +151,9 @@ int bacnet_device_object_property_reference_decode(const uint8_t *apdu,
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
/* object-identifier [0] BACnetObjectIdentifier */
|
||||
len = bacnet_object_id_context_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
0, &object_type, &object_instance);
|
||||
len = bacnet_object_id_context_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 0, &object_type,
|
||||
&object_instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (value) {
|
||||
@@ -173,8 +178,9 @@ int bacnet_device_object_property_reference_decode(const uint8_t *apdu,
|
||||
if (bacnet_is_context_tag_number(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 2, &len, &len_value_type)) {
|
||||
apdu_len += len;
|
||||
len = bacnet_unsigned_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
len_value_type, &array_index);
|
||||
len = bacnet_unsigned_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, len_value_type,
|
||||
&array_index);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (value) {
|
||||
@@ -193,8 +199,9 @@ int bacnet_device_object_property_reference_decode(const uint8_t *apdu,
|
||||
if (bacnet_is_context_tag_number(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 3, &len, &len_value_type)) {
|
||||
apdu_len += len;
|
||||
len = bacnet_object_id_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
len_value_type, &object_type, &object_instance);
|
||||
len = bacnet_object_id_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, len_value_type, &object_type,
|
||||
&object_instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (value) {
|
||||
@@ -226,7 +233,8 @@ int bacnet_device_object_property_reference_decode(const uint8_t *apdu,
|
||||
*
|
||||
* @return number of bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||
*/
|
||||
int bacnet_device_object_property_reference_context_decode(const uint8_t *apdu,
|
||||
int bacnet_device_object_property_reference_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value)
|
||||
@@ -275,10 +283,10 @@ bool bacnet_device_object_property_reference_same(
|
||||
if (value1 && value2) {
|
||||
if ((value1->arrayIndex == value2->arrayIndex) &&
|
||||
(value1->deviceIdentifier.instance ==
|
||||
value2->deviceIdentifier.instance) &&
|
||||
value2->deviceIdentifier.instance) &&
|
||||
(value1->deviceIdentifier.type == value2->deviceIdentifier.type) &&
|
||||
(value1->objectIdentifier.instance ==
|
||||
value2->objectIdentifier.instance) &&
|
||||
value2->objectIdentifier.instance) &&
|
||||
(value1->objectIdentifier.type == value2->objectIdentifier.type) &&
|
||||
(value1->propertyIdentifier == value2->propertyIdentifier)) {
|
||||
status = true;
|
||||
@@ -328,7 +336,8 @@ int bacapp_decode_device_obj_property_ref(
|
||||
* @deprecated Use bacnet_device_object_property_reference_context_decode()
|
||||
* instead
|
||||
*/
|
||||
int bacapp_decode_context_device_obj_property_ref(const uint8_t *apdu,
|
||||
int bacapp_decode_context_device_obj_property_ref(
|
||||
const uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value)
|
||||
{
|
||||
@@ -352,7 +361,9 @@ int bacapp_decode_context_device_obj_property_ref(const uint8_t *apdu,
|
||||
* @return Bytes encoded or 0 on failure.
|
||||
*/
|
||||
int bacapp_encode_context_device_obj_ref(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||
{
|
||||
int len;
|
||||
int apdu_len = 0;
|
||||
@@ -400,15 +411,17 @@ int bacapp_encode_device_obj_ref(
|
||||
set type to BACNET_NO_DEV_TYPE or something other
|
||||
than OBJECT_DEVICE to omit */
|
||||
if (value->deviceIdentifier.type == OBJECT_DEVICE) {
|
||||
len = encode_context_object_id(apdu, 0,
|
||||
value->deviceIdentifier.type, value->deviceIdentifier.instance);
|
||||
len = encode_context_object_id(
|
||||
apdu, 0, value->deviceIdentifier.type,
|
||||
value->deviceIdentifier.instance);
|
||||
apdu_len += len;
|
||||
if (apdu) {
|
||||
apdu += len;
|
||||
}
|
||||
}
|
||||
/* object-identifier [1] BACnetObjectIdentifier */
|
||||
len = encode_context_object_id(apdu, 1, value->objectIdentifier.type,
|
||||
len = encode_context_object_id(
|
||||
apdu, 1, value->objectIdentifier.type,
|
||||
value->objectIdentifier.instance);
|
||||
apdu_len += len;
|
||||
}
|
||||
@@ -431,7 +444,9 @@ int bacapp_encode_device_obj_ref(
|
||||
* @return number of bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||
*/
|
||||
int bacnet_device_object_reference_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||
{
|
||||
int len;
|
||||
int apdu_len = 0;
|
||||
@@ -446,8 +461,9 @@ int bacnet_device_object_reference_decode(
|
||||
if (bacnet_is_context_tag_number(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 0, &len, &len_value_type)) {
|
||||
apdu_len += len;
|
||||
len = bacnet_object_id_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
len_value_type, &object_type, &object_instance);
|
||||
len = bacnet_object_id_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, len_value_type, &object_type,
|
||||
&object_instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (value) {
|
||||
@@ -463,8 +479,9 @@ int bacnet_device_object_reference_decode(
|
||||
value->deviceIdentifier.instance = BACNET_NO_DEV_ID;
|
||||
}
|
||||
/* object-identifier [1] BACnetObjectIdentifier */
|
||||
len = bacnet_object_id_context_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
1, &object_type, &object_instance);
|
||||
len = bacnet_object_id_context_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 1, &object_type,
|
||||
&object_instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
if (value) {
|
||||
@@ -489,7 +506,8 @@ int bacnet_device_object_reference_decode(
|
||||
*
|
||||
* @return number of bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||
*/
|
||||
int bacnet_device_object_reference_context_decode(const uint8_t *apdu,
|
||||
int bacnet_device_object_reference_context_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||
@@ -537,10 +555,10 @@ bool bacnet_device_object_reference_same(
|
||||
|
||||
if (value1 && value2) {
|
||||
if ((value1->deviceIdentifier.instance ==
|
||||
value2->deviceIdentifier.instance) &&
|
||||
value2->deviceIdentifier.instance) &&
|
||||
(value1->deviceIdentifier.type == value2->deviceIdentifier.type) &&
|
||||
(value1->objectIdentifier.instance ==
|
||||
value2->objectIdentifier.instance) &&
|
||||
value2->objectIdentifier.instance) &&
|
||||
(value1->objectIdentifier.type == value2->objectIdentifier.type)) {
|
||||
status = true;
|
||||
}
|
||||
@@ -583,7 +601,9 @@ int bacapp_decode_device_obj_ref(
|
||||
* @deprecated Use bacnet_device_object_reference_context_decode() instead.
|
||||
*/
|
||||
int bacapp_decode_context_device_obj_ref(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||
const uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||
{
|
||||
return bacnet_device_object_reference_context_decode(
|
||||
apdu, MAX_APDU, tag_number, value);
|
||||
@@ -616,7 +636,8 @@ int bacapp_encode_obj_property_ref(
|
||||
if (reference->object_identifier.type == OBJECT_NONE) {
|
||||
return 0;
|
||||
}
|
||||
len = encode_context_object_id(apdu, 0, reference->object_identifier.type,
|
||||
len = encode_context_object_id(
|
||||
apdu, 0, reference->object_identifier.type,
|
||||
reference->object_identifier.instance);
|
||||
apdu_len += len;
|
||||
if (apdu) {
|
||||
@@ -642,7 +663,8 @@ int bacapp_encode_obj_property_ref(
|
||||
* @param reference - BACnetObjectPropertyReference to encode
|
||||
* @return length of the APDU buffer
|
||||
*/
|
||||
int bacapp_encode_context_obj_property_ref(uint8_t *apdu,
|
||||
int bacapp_encode_context_obj_property_ref(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_OBJECT_PROPERTY_REFERENCE *reference)
|
||||
{
|
||||
@@ -684,7 +706,8 @@ int bacapp_encode_context_obj_property_ref(uint8_t *apdu,
|
||||
* @param reference - BACnetObjectPropertyReference to decode into
|
||||
* @return number of bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||
*/
|
||||
int bacapp_decode_obj_property_ref(const uint8_t *apdu,
|
||||
int bacapp_decode_obj_property_ref(
|
||||
const uint8_t *apdu,
|
||||
uint16_t apdu_size,
|
||||
BACNET_OBJECT_PROPERTY_REFERENCE *reference)
|
||||
{
|
||||
@@ -698,8 +721,9 @@ int bacapp_decode_obj_property_ref(const uint8_t *apdu,
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
/* object-identifier [0] BACnetObjectIdentifier */
|
||||
len = bacnet_object_id_context_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
0, &object_identifier.type, &object_identifier.instance);
|
||||
len = bacnet_object_id_context_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, 0, &object_identifier.type,
|
||||
&object_identifier.instance);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
} else if (len <= 0) {
|
||||
@@ -756,7 +780,8 @@ int bacapp_decode_obj_property_ref(const uint8_t *apdu,
|
||||
*
|
||||
* @return number of bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||
*/
|
||||
int bacapp_decode_context_obj_property_ref(const uint8_t *apdu,
|
||||
int bacapp_decode_context_obj_property_ref(
|
||||
const uint8_t *apdu,
|
||||
uint16_t apdu_size,
|
||||
uint8_t tag_number,
|
||||
BACNET_OBJECT_PROPERTY_REFERENCE *value)
|
||||
@@ -804,9 +829,9 @@ bool bacnet_object_property_reference_same(
|
||||
if (value1 && value2) {
|
||||
if ((value1->property_identifier == value2->property_identifier) &&
|
||||
(value1->object_identifier.instance ==
|
||||
value2->object_identifier.instance) &&
|
||||
value2->object_identifier.instance) &&
|
||||
(value1->object_identifier.type ==
|
||||
value2->object_identifier.type)) {
|
||||
value2->object_identifier.type)) {
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ int bacapp_encode_device_obj_property_ref(
|
||||
uint8_t *apdu, const BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_device_obj_property_ref(uint8_t *apdu,
|
||||
int bacapp_encode_context_device_obj_property_ref(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value);
|
||||
|
||||
@@ -73,7 +74,8 @@ int bacapp_decode_device_obj_property_ref(
|
||||
BACNET_STACK_DEPRECATED(
|
||||
"Use bacnet_device_object_property_reference_context_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_device_obj_property_ref(const uint8_t *apdu,
|
||||
int bacapp_decode_context_device_obj_property_ref(
|
||||
const uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value);
|
||||
|
||||
|
||||
@@ -1745,8 +1745,8 @@ typedef enum BACnet_Services_Supported {
|
||||
SERVICE_SUPPORTED_PRIVATE_TRANSFER = 18,
|
||||
SERVICE_SUPPORTED_TEXT_MESSAGE = 19,
|
||||
SERVICE_SUPPORTED_REINITIALIZE_DEVICE = 20,
|
||||
SERVICE_SUPPORTED_WHO_AM_I = 47, /* Addendum 135-2016bz */
|
||||
SERVICE_SUPPORTED_YOU_ARE = 48, /* Addendum 135-2016bz */
|
||||
SERVICE_SUPPORTED_WHO_AM_I = 47, /* Addendum 135-2016bz */
|
||||
SERVICE_SUPPORTED_YOU_ARE = 48, /* Addendum 135-2016bz */
|
||||
/* Virtual Terminal Services */
|
||||
SERVICE_SUPPORTED_VT_OPEN = 21,
|
||||
SERVICE_SUPPORTED_VT_CLOSE = 22,
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
* @param error_code - #BACNET_ERROR_CODE value to be encoded
|
||||
* @return number of bytes encoded
|
||||
*/
|
||||
int bacerror_encode_apdu(uint8_t *apdu,
|
||||
int bacerror_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE service,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
@@ -84,7 +85,8 @@ int bacerror_encode_apdu(uint8_t *apdu,
|
||||
*
|
||||
* @return number of bytes decoded, or #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacerror_decode_error_class_and_code(const uint8_t *apdu,
|
||||
int bacerror_decode_error_class_and_code(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
BACNET_ERROR_CODE *error_code)
|
||||
@@ -96,7 +98,7 @@ int bacerror_decode_error_class_and_code(const uint8_t *apdu,
|
||||
if (apdu) {
|
||||
/* error class */
|
||||
tag_len = bacnet_enumerated_application_decode(
|
||||
&apdu[apdu_len], apdu_size-apdu_len, &decoded_value);
|
||||
&apdu[apdu_len], apdu_size - apdu_len, &decoded_value);
|
||||
if (tag_len <= 0) {
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
@@ -130,7 +132,8 @@ int bacerror_decode_error_class_and_code(const uint8_t *apdu,
|
||||
*
|
||||
* @return number of bytes decoded, or #BACNET_STATUS_ERROR (-1) if malformed
|
||||
*/
|
||||
int bacerror_decode_service_request(const uint8_t *apdu,
|
||||
int bacerror_decode_service_request(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE *service,
|
||||
|
||||
+21
-21
@@ -17,29 +17,29 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacerror_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE service,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacerror_encode_apdu(
|
||||
uint8_t *apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE service,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacerror_decode_service_request(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE * service,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacerror_decode_service_request(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
uint8_t *invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE *service,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
BACNET_ERROR_CODE *error_code);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacerror_decode_error_class_and_code(
|
||||
const uint8_t * apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacerror_decode_error_class_and_code(
|
||||
const uint8_t *apdu,
|
||||
unsigned apdu_size,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
BACNET_ERROR_CODE *error_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+24
-24
@@ -26,7 +26,7 @@ int encode_unsigned16(uint8_t *apdu, uint16_t value)
|
||||
int decode_unsigned16(const uint8_t *apdu, uint16_t *value)
|
||||
{
|
||||
if (apdu && value) {
|
||||
*value = (uint16_t)apdu[0] << 8;
|
||||
*value = (uint16_t)apdu[0] << 8;
|
||||
*value |= (uint16_t)apdu[1];
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ int encode_unsigned24(uint8_t *apdu, uint32_t value)
|
||||
{
|
||||
if (apdu) {
|
||||
apdu[0] = (uint8_t)((value >> 16) & 0xFF);
|
||||
apdu[1] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 0) & 0xFF);
|
||||
apdu[1] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 3;
|
||||
@@ -47,7 +47,7 @@ int encode_unsigned24(uint8_t *apdu, uint32_t value)
|
||||
int decode_unsigned24(const uint8_t *apdu, uint32_t *value)
|
||||
{
|
||||
if (apdu && value) {
|
||||
*value = (uint32_t)apdu[0] << 16;
|
||||
*value = (uint32_t)apdu[0] << 16;
|
||||
*value |= (uint32_t)apdu[1] << 8;
|
||||
*value |= (uint32_t)apdu[2];
|
||||
}
|
||||
@@ -60,8 +60,8 @@ int encode_unsigned32(uint8_t *apdu, uint32_t value)
|
||||
if (apdu) {
|
||||
apdu[0] = (uint8_t)((value >> 24) & 0xFF);
|
||||
apdu[1] = (uint8_t)((value >> 16) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[3] = (uint8_t)((value >> 0) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[3] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 4;
|
||||
@@ -70,7 +70,7 @@ int encode_unsigned32(uint8_t *apdu, uint32_t value)
|
||||
int decode_unsigned32(const uint8_t *apdu, uint32_t *value)
|
||||
{
|
||||
if (apdu && value) {
|
||||
*value = (uint32_t)apdu[0] << 24;
|
||||
*value = (uint32_t)apdu[0] << 24;
|
||||
*value |= (uint32_t)apdu[1] << 16;
|
||||
*value |= (uint32_t)apdu[2] << 8;
|
||||
*value |= (uint32_t)apdu[3];
|
||||
@@ -92,8 +92,8 @@ int encode_unsigned40(uint8_t *buffer, uint64_t value)
|
||||
buffer[0] = (uint8_t)((value >> 32) & 0xFF);
|
||||
buffer[1] = (uint8_t)((value >> 24) & 0xFF);
|
||||
buffer[2] = (uint8_t)((value >> 16) & 0xFF);
|
||||
buffer[3] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[4] = (uint8_t)((value >> 0) & 0xFF);
|
||||
buffer[3] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[4] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 5;
|
||||
@@ -108,7 +108,7 @@ int encode_unsigned40(uint8_t *buffer, uint64_t value)
|
||||
int decode_unsigned40(const uint8_t *buffer, uint64_t *value)
|
||||
{
|
||||
if (buffer && value) {
|
||||
*value = (uint64_t)buffer[0] << 32;
|
||||
*value = (uint64_t)buffer[0] << 32;
|
||||
*value |= (uint64_t)buffer[1] << 24;
|
||||
*value |= (uint64_t)buffer[2] << 16;
|
||||
*value |= (uint64_t)buffer[3] << 8;
|
||||
@@ -131,8 +131,8 @@ int encode_unsigned48(uint8_t *buffer, uint64_t value)
|
||||
buffer[1] = (uint8_t)((value >> 32) & 0xFF);
|
||||
buffer[2] = (uint8_t)((value >> 24) & 0xFF);
|
||||
buffer[3] = (uint8_t)((value >> 16) & 0xFF);
|
||||
buffer[4] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[5] = (uint8_t)((value >> 0) & 0xFF);
|
||||
buffer[4] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[5] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 6;
|
||||
@@ -147,7 +147,7 @@ int encode_unsigned48(uint8_t *buffer, uint64_t value)
|
||||
int decode_unsigned48(const uint8_t *buffer, uint64_t *value)
|
||||
{
|
||||
if (buffer && value) {
|
||||
*value = (uint64_t)buffer[0] << 40;
|
||||
*value = (uint64_t)buffer[0] << 40;
|
||||
*value |= (uint64_t)buffer[1] << 32;
|
||||
*value |= (uint64_t)buffer[2] << 24;
|
||||
*value |= (uint64_t)buffer[3] << 16;
|
||||
@@ -172,8 +172,8 @@ int encode_unsigned56(uint8_t *buffer, uint64_t value)
|
||||
buffer[2] = (uint8_t)((value >> 32) & 0xFF);
|
||||
buffer[3] = (uint8_t)((value >> 24) & 0xFF);
|
||||
buffer[4] = (uint8_t)((value >> 16) & 0xFF);
|
||||
buffer[5] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[6] = (uint8_t)((value >> 0) & 0xFF);
|
||||
buffer[5] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[6] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 7;
|
||||
@@ -188,7 +188,7 @@ int encode_unsigned56(uint8_t *buffer, uint64_t value)
|
||||
int decode_unsigned56(const uint8_t *buffer, uint64_t *value)
|
||||
{
|
||||
if (buffer && value) {
|
||||
*value = (uint64_t)buffer[0] << 48;
|
||||
*value = (uint64_t)buffer[0] << 48;
|
||||
*value |= (uint64_t)buffer[1] << 40;
|
||||
*value |= (uint64_t)buffer[2] << 32;
|
||||
*value |= (uint64_t)buffer[3] << 24;
|
||||
@@ -215,8 +215,8 @@ int encode_unsigned64(uint8_t *buffer, uint64_t value)
|
||||
buffer[3] = (uint8_t)((value >> 32) & 0xFF);
|
||||
buffer[4] = (uint8_t)((value >> 24) & 0xFF);
|
||||
buffer[5] = (uint8_t)((value >> 16) & 0xFF);
|
||||
buffer[6] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[7] = (uint8_t)((value >> 0) & 0xFF);
|
||||
buffer[6] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[7] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 8;
|
||||
@@ -231,7 +231,7 @@ int encode_unsigned64(uint8_t *buffer, uint64_t value)
|
||||
int decode_unsigned64(const uint8_t *buffer, uint64_t *value)
|
||||
{
|
||||
if (buffer && value) {
|
||||
*value = (uint64_t)buffer[0] << 56;
|
||||
*value = (uint64_t)buffer[0] << 56;
|
||||
*value |= (uint64_t)buffer[1] << 48;
|
||||
*value |= (uint64_t)buffer[2] << 40;
|
||||
*value |= (uint64_t)buffer[3] << 32;
|
||||
@@ -339,8 +339,8 @@ int encode_signed24(uint8_t *apdu, int32_t value)
|
||||
{
|
||||
if (apdu) {
|
||||
apdu[0] = (uint8_t)((value >> 16) & 0xFF);
|
||||
apdu[1] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 0) & 0xFF);
|
||||
apdu[1] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 3;
|
||||
@@ -368,8 +368,8 @@ int encode_signed32(uint8_t *apdu, int32_t value)
|
||||
if (apdu) {
|
||||
apdu[0] = (uint8_t)((value >> 24) & 0xFF);
|
||||
apdu[1] = (uint8_t)((value >> 16) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[3] = (uint8_t)((value >> 0) & 0xFF);
|
||||
apdu[2] = (uint8_t)((value >> 8) & 0xFF);
|
||||
apdu[3] = (uint8_t)((value >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
return 4;
|
||||
@@ -378,7 +378,7 @@ int encode_signed32(uint8_t *apdu, int32_t value)
|
||||
int decode_signed32(const uint8_t *apdu, int32_t *value)
|
||||
{
|
||||
if (apdu && value) {
|
||||
*value = (int32_t)apdu[0] << 24;
|
||||
*value = (int32_t)apdu[0] << 24;
|
||||
*value |= (int32_t)apdu[1] << 16;
|
||||
*value |= (int32_t)apdu[2] << 8;
|
||||
*value |= (int32_t)apdu[3];
|
||||
|
||||
+50
-96
@@ -18,106 +18,60 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* unsigned value encoding and decoding */
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned16(
|
||||
uint8_t * apdu,
|
||||
uint16_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned16(
|
||||
const uint8_t * apdu,
|
||||
uint16_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned24(
|
||||
uint8_t * apdu,
|
||||
uint32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned24(
|
||||
const uint8_t * apdu,
|
||||
uint32_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned32(
|
||||
uint8_t * apdu,
|
||||
uint32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned32(
|
||||
const uint8_t * apdu,
|
||||
uint32_t * value);
|
||||
/* unsigned value encoding and decoding */
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned16(uint8_t *apdu, uint16_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned16(const uint8_t *apdu, uint16_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned24(uint8_t *apdu, uint32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned24(const uint8_t *apdu, uint32_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned32(uint8_t *apdu, uint32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned32(const uint8_t *apdu, uint32_t *value);
|
||||
#ifdef UINT64_MAX
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned40(
|
||||
uint8_t * buffer,
|
||||
uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned40(
|
||||
const uint8_t * buffer,
|
||||
uint64_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned48(
|
||||
uint8_t * buffer,
|
||||
uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned48(
|
||||
const uint8_t * buffer,
|
||||
uint64_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned56(
|
||||
uint8_t * buffer,
|
||||
uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned56(
|
||||
const uint8_t * buffer,
|
||||
uint64_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned64(
|
||||
uint8_t * buffer,
|
||||
uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned64(
|
||||
const uint8_t * buffer,
|
||||
uint64_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned40(uint8_t *buffer, uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned40(const uint8_t *buffer, uint64_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned48(uint8_t *buffer, uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned48(const uint8_t *buffer, uint64_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned56(uint8_t *buffer, uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned56(const uint8_t *buffer, uint64_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_unsigned64(uint8_t *buffer, uint64_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_unsigned64(const uint8_t *buffer, uint64_t *value);
|
||||
#endif
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_unsigned_length(
|
||||
BACNET_UNSIGNED_INTEGER value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_signed_length(
|
||||
int32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_unsigned_length(BACNET_UNSIGNED_INTEGER value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_signed_length(int32_t value);
|
||||
|
||||
/* signed value encoding and decoding */
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed8(
|
||||
uint8_t * apdu,
|
||||
int8_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed8(
|
||||
const uint8_t * apdu,
|
||||
int32_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed16(
|
||||
uint8_t * apdu,
|
||||
int16_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed16(
|
||||
const uint8_t * apdu,
|
||||
int32_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed24(
|
||||
uint8_t * apdu,
|
||||
int32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed24(
|
||||
const uint8_t * apdu,
|
||||
int32_t * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed32(
|
||||
uint8_t * apdu,
|
||||
int32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed32(
|
||||
const uint8_t * apdu,
|
||||
int32_t * value);
|
||||
/* signed value encoding and decoding */
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed8(uint8_t *apdu, int8_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed8(const uint8_t *apdu, int32_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed16(uint8_t *apdu, int16_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed16(const uint8_t *apdu, int32_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed24(uint8_t *apdu, int32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed24(const uint8_t *apdu, int32_t *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_signed32(uint8_t *apdu, int32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_signed32(const uint8_t *apdu, int32_t *value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ PROP_TAG_DATA bacnet_object_device_property_tag_map[] = {
|
||||
{ PROP_MODEL_NAME, BACNET_APPLICATION_TAG_CHARACTER_STRING },
|
||||
{ PROP_FIRMWARE_REVISION, BACNET_APPLICATION_TAG_CHARACTER_STRING },
|
||||
{ PROP_APPLICATION_SOFTWARE_VERSION,
|
||||
BACNET_APPLICATION_TAG_CHARACTER_STRING },
|
||||
BACNET_APPLICATION_TAG_CHARACTER_STRING },
|
||||
{ PROP_PROTOCOL_VERSION, BACNET_APPLICATION_TAG_UNSIGNED_INT },
|
||||
{ PROP_PROTOCOL_CONFORMANCE_CLASS, BACNET_APPLICATION_TAG_UNSIGNED_INT },
|
||||
{ PROP_PROTOCOL_SERVICES_SUPPORTED, BACNET_APPLICATION_TAG_BIT_STRING },
|
||||
|
||||
+7
-11
@@ -15,24 +15,20 @@
|
||||
#include "bacnet/bacdef.h"
|
||||
|
||||
typedef struct {
|
||||
signed prop_id; /* index number that matches the text */
|
||||
signed tag_id; /* text pair - use NULL to end the list */
|
||||
signed prop_id; /* index number that matches the text */
|
||||
signed tag_id; /* text pair - use NULL to end the list */
|
||||
} PROP_TAG_DATA;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
signed bacprop_tag_by_index_default(
|
||||
const PROP_TAG_DATA * data_list,
|
||||
signed index,
|
||||
signed default_ret);
|
||||
BACNET_STACK_EXPORT
|
||||
signed bacprop_tag_by_index_default(
|
||||
const PROP_TAG_DATA *data_list, signed index, signed default_ret);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
signed bacprop_property_tag(
|
||||
BACNET_OBJECT_TYPE type,
|
||||
signed prop);
|
||||
BACNET_STACK_EXPORT
|
||||
signed bacprop_property_tag(BACNET_OBJECT_TYPE type, signed prop);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -72,8 +72,9 @@ int bacapp_property_state_decode(
|
||||
apdu_len++;
|
||||
}
|
||||
} else if (tag.number == PROP_STATE_INTEGER_VALUE) {
|
||||
len = bacnet_signed_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, &integer_value);
|
||||
len = bacnet_signed_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
&integer_value);
|
||||
if (len <= 0) {
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
@@ -82,8 +83,9 @@ int bacapp_property_state_decode(
|
||||
value->state.integerValue = integer_value;
|
||||
}
|
||||
} else {
|
||||
len = bacnet_enumerated_decode(&apdu[apdu_len], apdu_size - apdu_len,
|
||||
tag.len_value_type, &enum_value);
|
||||
len = bacnet_enumerated_decode(
|
||||
&apdu[apdu_len], apdu_size - apdu_len, tag.len_value_type,
|
||||
&enum_value);
|
||||
if (len <= 0) {
|
||||
return BACNET_STATUS_ERROR;
|
||||
}
|
||||
|
||||
+12
-18
@@ -87,27 +87,21 @@ typedef struct {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_property_state_decode(
|
||||
const uint8_t *apdu,
|
||||
uint32_t apdu_size,
|
||||
BACNET_PROPERTY_STATE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_property_state_decode(
|
||||
const uint8_t *apdu, uint32_t apdu_size, BACNET_PROPERTY_STATE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_property_state(
|
||||
const uint8_t * apdu,
|
||||
BACNET_PROPERTY_STATE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_property_state(
|
||||
const uint8_t *apdu, BACNET_PROPERTY_STATE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_property_state(
|
||||
const uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_PROPERTY_STATE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_property_state(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_PROPERTY_STATE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_property_state(
|
||||
uint8_t * apdu,
|
||||
const BACNET_PROPERTY_STATE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_property_state(
|
||||
uint8_t *apdu, const BACNET_PROPERTY_STATE *value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+14
-26
@@ -18,35 +18,23 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_real_safe(
|
||||
const uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
float *real_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_real_safe(
|
||||
const uint8_t *apdu, uint32_t len_value, float *real_value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_real(
|
||||
const uint8_t * apdu,
|
||||
float *real_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_real(const uint8_t *apdu, float *real_value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_bacnet_real(
|
||||
float value,
|
||||
uint8_t * apdu);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_double(
|
||||
const uint8_t * apdu,
|
||||
double *real_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_double_safe(
|
||||
const uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
double *double_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_bacnet_real(float value, uint8_t *apdu);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_double(const uint8_t *apdu, double *real_value);
|
||||
BACNET_STACK_EXPORT
|
||||
int decode_double_safe(
|
||||
const uint8_t *apdu, uint32_t len_value, double *double_value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_bacnet_double(
|
||||
double value,
|
||||
uint8_t * apdu);
|
||||
BACNET_STACK_EXPORT
|
||||
int encode_bacnet_double(double value, uint8_t *apdu);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+29
-21
@@ -148,7 +148,8 @@ uint8_t bitstring_bytes_used(const BACNET_BIT_STRING *bit_string)
|
||||
*
|
||||
* @return Value of the octet.
|
||||
*/
|
||||
uint8_t bitstring_octet(const BACNET_BIT_STRING *bit_string, uint8_t octet_index)
|
||||
uint8_t
|
||||
bitstring_octet(const BACNET_BIT_STRING *bit_string, uint8_t octet_index)
|
||||
{
|
||||
uint8_t octet = 0;
|
||||
|
||||
@@ -356,7 +357,8 @@ bool bitstring_init_ascii(BACNET_BIT_STRING *bit_string, const char *ascii)
|
||||
*
|
||||
* @return true on success, false if the string exceeds capacity.
|
||||
*/
|
||||
bool characterstring_init(BACNET_CHARACTER_STRING *char_string,
|
||||
bool characterstring_init(
|
||||
BACNET_CHARACTER_STRING *char_string,
|
||||
uint8_t encoding,
|
||||
const char *value,
|
||||
size_t length)
|
||||
@@ -409,7 +411,7 @@ bool characterstring_init(BACNET_CHARACTER_STRING *char_string,
|
||||
*/
|
||||
size_t characterstring_strnlen(const char *str, size_t maxlen)
|
||||
{
|
||||
const char* p = memchr(str, 0, maxlen);
|
||||
const char *p = memchr(str, 0, maxlen);
|
||||
if (p == NULL) {
|
||||
return maxlen;
|
||||
}
|
||||
@@ -430,7 +432,8 @@ size_t characterstring_strnlen(const char *str, size_t maxlen)
|
||||
bool characterstring_init_ansi_safe(
|
||||
BACNET_CHARACTER_STRING *char_string, const char *value, size_t tmax)
|
||||
{
|
||||
return characterstring_init(char_string, CHARACTER_ANSI_X34, value,
|
||||
return characterstring_init(
|
||||
char_string, CHARACTER_ANSI_X34, value,
|
||||
value ? characterstring_strnlen(value, tmax) : 0);
|
||||
}
|
||||
|
||||
@@ -463,8 +466,9 @@ bool characterstring_copy(
|
||||
BACNET_CHARACTER_STRING *dest, const BACNET_CHARACTER_STRING *src)
|
||||
{
|
||||
if (dest && src) {
|
||||
return characterstring_init(dest, characterstring_encoding(src),
|
||||
characterstring_value(src), characterstring_length(src));
|
||||
return characterstring_init(
|
||||
dest, characterstring_encoding(src), characterstring_value(src),
|
||||
characterstring_length(src));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -550,7 +554,8 @@ bool characterstring_same(
|
||||
*
|
||||
* @return true if the character encoding and string contents are the same
|
||||
*/
|
||||
bool characterstring_ansi_same(const BACNET_CHARACTER_STRING *dest, const char *src)
|
||||
bool characterstring_ansi_same(
|
||||
const BACNET_CHARACTER_STRING *dest, const char *src)
|
||||
{
|
||||
size_t i; /* counter */
|
||||
bool same_status = false;
|
||||
@@ -787,17 +792,19 @@ bool characterstring_printable(const BACNET_CHARACTER_STRING *char_string)
|
||||
/* Basic UTF-8 manipulation routines
|
||||
* by Jeff Bezanson
|
||||
* placed in the public domain Fall 2005 */
|
||||
static const char trailingBytesForUTF8[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 };
|
||||
static const char trailingBytesForUTF8[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Based on the valid_utf8 routine from the PCRE library by Philip Hazel
|
||||
@@ -1042,8 +1049,8 @@ bool octetstring_init_ascii_hex(
|
||||
bool octetstring_copy(BACNET_OCTET_STRING *dest, const BACNET_OCTET_STRING *src)
|
||||
{
|
||||
return octetstring_init(
|
||||
dest, octetstring_value(
|
||||
(BACNET_OCTET_STRING *)src), octetstring_length(src));
|
||||
dest, octetstring_value((BACNET_OCTET_STRING *)src),
|
||||
octetstring_length(src));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1196,7 +1203,8 @@ size_t octetstring_capacity(const BACNET_OCTET_STRING *octet_string)
|
||||
* @return true if the octet strings are the same, false otherwise.
|
||||
*/
|
||||
bool octetstring_value_same(
|
||||
const BACNET_OCTET_STRING *octet_string1, const BACNET_OCTET_STRING *octet_string2)
|
||||
const BACNET_OCTET_STRING *octet_string1,
|
||||
const BACNET_OCTET_STRING *octet_string2)
|
||||
{
|
||||
size_t i = 0; /* loop counter */
|
||||
|
||||
|
||||
+111
-164
@@ -36,189 +36,136 @@ typedef struct BACnet_Octet_String {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bitstring_init(
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
void bitstring_set_bit(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bit_number,
|
||||
bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_bit(
|
||||
const BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bit_number);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t bitstring_bits_used(
|
||||
const BACNET_BIT_STRING * bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
void bitstring_init(BACNET_BIT_STRING *bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
void bitstring_set_bit(
|
||||
BACNET_BIT_STRING *bit_string, uint8_t bit_number, bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_bit(const BACNET_BIT_STRING *bit_string, uint8_t bit_number);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t bitstring_bits_used(const BACNET_BIT_STRING *bit_string);
|
||||
/* returns the number of bytes that a bit string is using */
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t bitstring_bytes_used(
|
||||
const BACNET_BIT_STRING * bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned bitstring_bits_capacity(
|
||||
const BACNET_BIT_STRING * bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t bitstring_bytes_used(const BACNET_BIT_STRING *bit_string);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned bitstring_bits_capacity(const BACNET_BIT_STRING *bit_string);
|
||||
/* used for encoding and decoding from the APDU */
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t bitstring_octet(
|
||||
const BACNET_BIT_STRING * bit_string,
|
||||
uint8_t octet_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_set_octet(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t index,
|
||||
uint8_t octet);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_set_bits_used(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bytes_used,
|
||||
uint8_t unused_bits);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_copy(
|
||||
BACNET_BIT_STRING * dest,
|
||||
const BACNET_BIT_STRING * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_same(
|
||||
const BACNET_BIT_STRING * bitstring1,
|
||||
const BACNET_BIT_STRING * bitstring2);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_init_ascii(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
const char *ascii);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t
|
||||
bitstring_octet(const BACNET_BIT_STRING *bit_string, uint8_t octet_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_set_octet(
|
||||
BACNET_BIT_STRING *bit_string, uint8_t index, uint8_t octet);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_set_bits_used(
|
||||
BACNET_BIT_STRING *bit_string, uint8_t bytes_used, uint8_t unused_bits);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_copy(BACNET_BIT_STRING *dest, const BACNET_BIT_STRING *src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_same(
|
||||
const BACNET_BIT_STRING *bitstring1, const BACNET_BIT_STRING *bitstring2);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bitstring_init_ascii(BACNET_BIT_STRING *bit_string, const char *ascii);
|
||||
|
||||
/* returns false if the string exceeds capacity
|
||||
initialize by using length=0 */
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_init(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
uint8_t encoding,
|
||||
const char *value,
|
||||
size_t length);
|
||||
/* used for ANSI C-Strings */
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_init_ansi(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
const char *value);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t characterstring_strnlen(
|
||||
const char *str,
|
||||
size_t maxlen);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_init_ansi_safe(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
const char *value,
|
||||
size_t tmax);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_copy(
|
||||
BACNET_CHARACTER_STRING * dest,
|
||||
const BACNET_CHARACTER_STRING * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_ansi_copy(
|
||||
char *dest,
|
||||
size_t dest_max_len,
|
||||
const BACNET_CHARACTER_STRING * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_init(
|
||||
BACNET_CHARACTER_STRING *char_string,
|
||||
uint8_t encoding,
|
||||
const char *value,
|
||||
size_t length);
|
||||
/* used for ANSI C-Strings */
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_init_ansi(
|
||||
BACNET_CHARACTER_STRING *char_string, const char *value);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t characterstring_strnlen(const char *str, size_t maxlen);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_init_ansi_safe(
|
||||
BACNET_CHARACTER_STRING *char_string, const char *value, size_t tmax);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_copy(
|
||||
BACNET_CHARACTER_STRING *dest, const BACNET_CHARACTER_STRING *src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_ansi_copy(
|
||||
char *dest, size_t dest_max_len, const BACNET_CHARACTER_STRING *src);
|
||||
/* returns true if the strings are the same length, encoding, value */
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_same(
|
||||
const BACNET_CHARACTER_STRING * dest,
|
||||
const BACNET_CHARACTER_STRING * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_ansi_same(
|
||||
const BACNET_CHARACTER_STRING * dest,
|
||||
const char *src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_same(
|
||||
const BACNET_CHARACTER_STRING *dest, const BACNET_CHARACTER_STRING *src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_ansi_same(
|
||||
const BACNET_CHARACTER_STRING *dest, const char *src);
|
||||
/* returns false if the string exceeds capacity */
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_append(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
const char *value,
|
||||
size_t length);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_append(
|
||||
BACNET_CHARACTER_STRING *char_string, const char *value, size_t length);
|
||||
/* This function sets a new length without changing the value.
|
||||
If length exceeds capacity, no modification happens and
|
||||
function returns false. */
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_truncate(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
size_t length);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_set_encoding(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
uint8_t encoding);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_truncate(
|
||||
BACNET_CHARACTER_STRING *char_string, size_t length);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_set_encoding(
|
||||
BACNET_CHARACTER_STRING *char_string, uint8_t encoding);
|
||||
/* Returns the value */
|
||||
BACNET_STACK_EXPORT
|
||||
const char *characterstring_value(
|
||||
const BACNET_CHARACTER_STRING * char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *characterstring_value(const BACNET_CHARACTER_STRING *char_string);
|
||||
/* returns the length */
|
||||
BACNET_STACK_EXPORT
|
||||
size_t characterstring_length(
|
||||
const BACNET_CHARACTER_STRING * char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t characterstring_encoding(
|
||||
const BACNET_CHARACTER_STRING * char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t characterstring_capacity(
|
||||
const BACNET_CHARACTER_STRING * char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_printable(
|
||||
const BACNET_CHARACTER_STRING * char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_valid(
|
||||
const BACNET_CHARACTER_STRING * char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool utf8_isvalid(
|
||||
const char *str,
|
||||
size_t length);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t characterstring_length(const BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t characterstring_encoding(const BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t characterstring_capacity(const BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_printable(const BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool characterstring_valid(const BACNET_CHARACTER_STRING *char_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool utf8_isvalid(const char *str, size_t length);
|
||||
|
||||
/* returns false if the string exceeds capacity
|
||||
initialize by using length=0 */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_init(
|
||||
BACNET_OCTET_STRING * octet_string,
|
||||
const uint8_t * value,
|
||||
size_t length);
|
||||
/* converts an null terminated ASCII Hex string to an octet string.
|
||||
returns true if successfully converted and fits; false if too long */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_init_ascii_hex(
|
||||
BACNET_OCTET_STRING * octet_string,
|
||||
const char *ascii_hex);
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_copy(
|
||||
BACNET_OCTET_STRING * dest,
|
||||
const BACNET_OCTET_STRING * src);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t octetstring_copy_value(
|
||||
uint8_t * dest,
|
||||
size_t length,
|
||||
const BACNET_OCTET_STRING * src);
|
||||
/* returns false if the string exceeds capacity
|
||||
initialize by using length=0 */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_init(
|
||||
BACNET_OCTET_STRING *octet_string, const uint8_t *value, size_t length);
|
||||
/* converts an null terminated ASCII Hex string to an octet string.
|
||||
returns true if successfully converted and fits; false if too long */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_init_ascii_hex(
|
||||
BACNET_OCTET_STRING *octet_string, const char *ascii_hex);
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_copy(
|
||||
BACNET_OCTET_STRING *dest, const BACNET_OCTET_STRING *src);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t octetstring_copy_value(
|
||||
uint8_t *dest, size_t length, const BACNET_OCTET_STRING *src);
|
||||
/* returns false if the string exceeds capacity */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_append(
|
||||
BACNET_OCTET_STRING * octet_string,
|
||||
const uint8_t * value,
|
||||
size_t length);
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_append(
|
||||
BACNET_OCTET_STRING *octet_string, const uint8_t *value, size_t length);
|
||||
/* This function sets a new length without changing the value.
|
||||
If length exceeds capacity, no modification happens and
|
||||
function returns false. */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_truncate(
|
||||
BACNET_OCTET_STRING * octet_string,
|
||||
size_t length);
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_truncate(BACNET_OCTET_STRING *octet_string, size_t length);
|
||||
/* Returns the value */
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t *octetstring_value(
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t *octetstring_value(BACNET_OCTET_STRING *octet_string);
|
||||
/* Returns the length.*/
|
||||
BACNET_STACK_EXPORT
|
||||
size_t octetstring_length(
|
||||
const BACNET_OCTET_STRING * octet_string);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t octetstring_capacity(
|
||||
const BACNET_OCTET_STRING * octet_string);
|
||||
/* returns true if the same length and contents */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_value_same(
|
||||
const BACNET_OCTET_STRING * octet_string1,
|
||||
const BACNET_OCTET_STRING * octet_string2);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t octetstring_length(const BACNET_OCTET_STRING *octet_string);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t octetstring_capacity(const BACNET_OCTET_STRING *octet_string);
|
||||
/* returns true if the same length and contents */
|
||||
BACNET_STACK_EXPORT
|
||||
bool octetstring_value_same(
|
||||
const BACNET_OCTET_STRING *octet_string1,
|
||||
const BACNET_OCTET_STRING *octet_string2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+466
-287
File diff suppressed because it is too large
Load Diff
+117
-174
@@ -24,193 +24,136 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_confirmed_service_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_unconfirmed_service_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_application_tag_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_application_tag_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_object_type_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_object_type_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_object_type_strtol(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_property_name_proprietary(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_property_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_property_name_default(
|
||||
unsigned index,
|
||||
const char *default_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_property_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_property_strtol(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_engineering_unit_name_proprietary(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_engineering_unit_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_engineering_unit_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_reject_reason_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_abort_reason_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_error_class_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_error_code_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned bactext_property_id(
|
||||
const char *name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_month_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_week_of_month_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_day_of_week_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_notify_type_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_notify_type_index(
|
||||
const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_event_state_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_state_index(
|
||||
const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_state_strtol(
|
||||
const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_event_type_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_type_index(
|
||||
const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_binary_present_value_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_binary_polarity_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_binary_present_value_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_reliability_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_device_status_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_segmentation_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_segmentation_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_node_type_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_character_string_encoding_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_event_transition_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_transition_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_confirmed_service_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_unconfirmed_service_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_application_tag_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_application_tag_index(
|
||||
const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_object_type_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_object_type_index(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_object_type_strtol(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_property_name_proprietary(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_property_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *
|
||||
bactext_property_name_default(unsigned index, const char *default_string);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_property_index(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_property_strtol(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_engineering_unit_name_proprietary(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_engineering_unit_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_engineering_unit_index(
|
||||
const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_reject_reason_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_abort_reason_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_error_class_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_error_code_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned bactext_property_id(const char *name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_month_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_week_of_month_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_day_of_week_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_notify_type_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_notify_type_index(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_event_state_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_state_index(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_state_strtol(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_event_type_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_type_index(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_binary_present_value_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_binary_polarity_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_binary_present_value_index(
|
||||
const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_reliability_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_device_status_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_segmentation_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_segmentation_index(const char *search_name, unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_node_type_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_character_string_encoding_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_event_transition_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_event_transition_index(
|
||||
const char *search_name, unsigned *found_index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_days_of_week_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_days_of_week_index(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_days_of_week_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_days_of_week_index(const char *search_name, unsigned *found_index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_network_layer_msg_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_network_layer_msg_name(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_life_safety_state_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_life_safety_state_name(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_device_communications_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_device_communications_name(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_lighting_operation_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_lighting_operation_name(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_lighting_operation_strtol(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_lighting_operation_strtol(
|
||||
const char *search_name, unsigned *found_index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_binary_lighting_pv_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_binary_lighting_pv_name(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_binary_lighting_pv_names_strtol(
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bactext_binary_lighting_pv_names_strtol(
|
||||
const char *search_name, unsigned *found_index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_lighting_in_progress(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_lighting_in_progress(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_lighting_transition(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_lighting_transition(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_color_operation_name(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_color_operation_name(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_shed_state_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_shed_state_name(unsigned index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_shed_level_type_name(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bactext_shed_level_type_name(unsigned index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+81
-81
@@ -26,7 +26,7 @@
|
||||
* small. Besides, schedule can't contain complex types.
|
||||
*/
|
||||
typedef struct BACnet_Primitive_Data_Value {
|
||||
uint8_t tag; /* application tag data type */
|
||||
uint8_t tag; /* application tag data type */
|
||||
union {
|
||||
/*
|
||||
* ATTENTION! If a new type is added here, update
|
||||
@@ -34,22 +34,22 @@ typedef struct BACnet_Primitive_Data_Value {
|
||||
*/
|
||||
|
||||
/* NULL - not needed as it is encoded in the tag alone */
|
||||
#if defined (BACAPP_BOOLEAN)
|
||||
#if defined(BACAPP_BOOLEAN)
|
||||
bool Boolean;
|
||||
#endif
|
||||
#if defined (BACAPP_UNSIGNED)
|
||||
#if defined(BACAPP_UNSIGNED)
|
||||
BACNET_UNSIGNED_INTEGER Unsigned_Int;
|
||||
#endif
|
||||
#if defined (BACAPP_SIGNED)
|
||||
#if defined(BACAPP_SIGNED)
|
||||
int32_t Signed_Int;
|
||||
#endif
|
||||
#if defined (BACAPP_REAL)
|
||||
#if defined(BACAPP_REAL)
|
||||
float Real;
|
||||
#endif
|
||||
#if defined (BACAPP_DOUBLE)
|
||||
#if defined(BACAPP_DOUBLE)
|
||||
double Double;
|
||||
#endif
|
||||
#if defined (BACAPP_ENUMERATED)
|
||||
#if defined(BACAPP_ENUMERATED)
|
||||
uint32_t Enumerated;
|
||||
#endif
|
||||
} type;
|
||||
@@ -60,95 +60,95 @@ typedef struct BACnet_Time_Value {
|
||||
BACNET_PRIMITIVE_DATA_VALUE Value;
|
||||
} BACNET_TIME_VALUE;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
struct BACnet_Application_Data_Value;
|
||||
struct BACnet_Application_Data_Value;
|
||||
|
||||
/** returns 0 if OK, -1 on error */
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_application_to_primitive_data_value(BACNET_PRIMITIVE_DATA_VALUE * dest,
|
||||
const struct BACnet_Application_Data_Value * src);
|
||||
/** returns 0 if OK, -1 on error */
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_application_to_primitive_data_value(
|
||||
BACNET_PRIMITIVE_DATA_VALUE *dest,
|
||||
const struct BACnet_Application_Data_Value *src);
|
||||
|
||||
/** returns 0 if OK, -1 on error */
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_primitive_to_application_data_value(
|
||||
struct BACnet_Application_Data_Value * dest,
|
||||
const BACNET_PRIMITIVE_DATA_VALUE * src);
|
||||
/** returns 0 if OK, -1 on error */
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_primitive_to_application_data_value(
|
||||
struct BACnet_Application_Data_Value *dest,
|
||||
const BACNET_PRIMITIVE_DATA_VALUE *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_encode(uint8_t * apdu,
|
||||
const BACNET_TIME_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_encode(uint8_t *apdu, const BACNET_TIME_VALUE *value);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_encode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_time_value(uint8_t *apdu,
|
||||
const BACNET_TIME_VALUE *value);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_encode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_time_value(uint8_t *apdu, const BACNET_TIME_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_context_encode(uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_TIME_VALUE * value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_context_encode(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_TIME_VALUE *value);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_context_encode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_time_value(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_TIME_VALUE *value);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_context_encode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_encode_context_time_value(
|
||||
uint8_t *apdu, uint8_t tag_number, const BACNET_TIME_VALUE *value);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_time_value(const uint8_t * apdu,
|
||||
BACNET_TIME_VALUE * value);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_time_value(const uint8_t *apdu, BACNET_TIME_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_decode(const uint8_t *apdu, int max_apdu_len,
|
||||
BACNET_TIME_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_decode(
|
||||
const uint8_t *apdu, int max_apdu_len, BACNET_TIME_VALUE *value);
|
||||
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_context_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_time_value(const uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
BACNET_TIME_VALUE * value);
|
||||
BACNET_STACK_DEPRECATED("Use bacnet_time_value_context_decode() instead")
|
||||
BACNET_STACK_EXPORT
|
||||
int bacapp_decode_context_time_value(
|
||||
const uint8_t *apdu, uint8_t tag_number, BACNET_TIME_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_context_decode(const uint8_t *apdu, int max_apdu_len,
|
||||
uint8_t tag_number, BACNET_TIME_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_value_context_decode(
|
||||
const uint8_t *apdu,
|
||||
int max_apdu_len,
|
||||
uint8_t tag_number,
|
||||
BACNET_TIME_VALUE *value);
|
||||
|
||||
/**
|
||||
* Decode array of time-values wrapped in a context tag
|
||||
* @param apdu
|
||||
* @param max_apdu_len
|
||||
* @param tag_number - number expected in the context tag; 0 used for DailySchedule
|
||||
* @param time_values
|
||||
* @param max_time_values - number of time values to encode
|
||||
* @param[out] out_count - actual number of time values found
|
||||
* @return used bytes, <0 if decoding failed
|
||||
*/
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_values_context_decode(
|
||||
const uint8_t * apdu,
|
||||
int max_apdu_len,
|
||||
uint8_t tag_number,
|
||||
BACNET_TIME_VALUE *time_values,
|
||||
unsigned int max_time_values,
|
||||
unsigned int *out_count);
|
||||
/**
|
||||
* Decode array of time-values wrapped in a context tag
|
||||
* @param apdu
|
||||
* @param max_apdu_len
|
||||
* @param tag_number - number expected in the context tag; 0 used for
|
||||
* DailySchedule
|
||||
* @param time_values
|
||||
* @param max_time_values - number of time values to encode
|
||||
* @param[out] out_count - actual number of time values found
|
||||
* @return used bytes, <0 if decoding failed
|
||||
*/
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_values_context_decode(
|
||||
const uint8_t *apdu,
|
||||
int max_apdu_len,
|
||||
uint8_t tag_number,
|
||||
BACNET_TIME_VALUE *time_values,
|
||||
unsigned int max_time_values,
|
||||
unsigned int *out_count);
|
||||
|
||||
/**
|
||||
* Encode array of time-values wrapped in a context tag
|
||||
* @param apdu - output buffer, NULL to just measure length
|
||||
* @param max_apdu_len
|
||||
* @param tag_number - number to use for the context tag; 0 used for DailySchedule
|
||||
* @param time_values
|
||||
* @param max_time_values - number of time values to encode
|
||||
* @return used bytes, <=0 if encoding failed
|
||||
*/
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_values_context_encode(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_TIME_VALUE * time_values,
|
||||
unsigned int max_time_values);
|
||||
/**
|
||||
* Encode array of time-values wrapped in a context tag
|
||||
* @param apdu - output buffer, NULL to just measure length
|
||||
* @param max_apdu_len
|
||||
* @param tag_number - number to use for the context tag; 0 used for
|
||||
* DailySchedule
|
||||
* @param time_values
|
||||
* @param max_time_values - number of time values to encode
|
||||
* @return used bytes, <=0 if encoding failed
|
||||
*/
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_time_values_context_encode(
|
||||
uint8_t *apdu,
|
||||
uint8_t tag_number,
|
||||
const BACNET_TIME_VALUE *time_values,
|
||||
unsigned int max_time_values);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ static uint16_t Remote_BBMD_TTL_Seconds;
|
||||
static uint8_t BVLC_Buffer[BIP_MPDU_MAX];
|
||||
static uint16_t BVLC_Buffer_Len;
|
||||
#endif
|
||||
#if BBMD_ENABLED/* Broadcast Distribution Table */
|
||||
#if BBMD_ENABLED /* Broadcast Distribution Table */
|
||||
#ifndef MAX_BBMD_ENTRIES
|
||||
#define MAX_BBMD_ENTRIES 128
|
||||
#endif
|
||||
@@ -93,7 +93,8 @@ static void debug_print_bip(const char *str, const BACNET_IP_ADDRESS *addr)
|
||||
{
|
||||
#if PRINT_ENABLED
|
||||
if (BVLC_Debug) {
|
||||
printf("BVLC: %s %u.%u.%u.%u:%u\n", str, (unsigned)addr->address[0],
|
||||
printf(
|
||||
"BVLC: %s %u.%u.%u.%u:%u\n", str, (unsigned)addr->address[0],
|
||||
(unsigned)addr->address[1], (unsigned)addr->address[2],
|
||||
(unsigned)addr->address[3], (unsigned)addr->port);
|
||||
}
|
||||
@@ -187,7 +188,8 @@ void bvlc_bdt_backup_local(void)
|
||||
}
|
||||
|
||||
fseek(bdt_file_ptr, 0, SEEK_SET);
|
||||
fwrite(BBMD_Table, sizeof(BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY),
|
||||
fwrite(
|
||||
BBMD_Table, sizeof(BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY),
|
||||
MAX_BBMD_ENTRIES, bdt_file_ptr);
|
||||
fflush(bdt_file_ptr);
|
||||
}
|
||||
@@ -212,12 +214,14 @@ void bvlc_bdt_restore_local(void)
|
||||
BBMD_Table_tmp[MAX_BBMD_ENTRIES];
|
||||
size_t entries = 0;
|
||||
|
||||
entries = fread(BBMD_Table_tmp,
|
||||
entries = fread(
|
||||
BBMD_Table_tmp,
|
||||
sizeof(BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY),
|
||||
MAX_BBMD_ENTRIES, bdt_file_ptr);
|
||||
if (entries == MAX_BBMD_ENTRIES) {
|
||||
/* success reading the BDT table. */
|
||||
memcpy(BBMD_Table, BBMD_Table_tmp,
|
||||
memcpy(
|
||||
BBMD_Table, BBMD_Table_tmp,
|
||||
sizeof(BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY) *
|
||||
MAX_BBMD_ENTRIES);
|
||||
}
|
||||
@@ -312,9 +316,7 @@ static bool bbmd_bdt_member_mask_is_unicast(const BACNET_IP_ADDRESS *addr)
|
||||
* @return number of bytes encoded in the Forwarded NPDU
|
||||
*/
|
||||
static uint16_t bbmd_forward_npdu(
|
||||
const BACNET_IP_ADDRESS *bip_src,
|
||||
const uint8_t *npdu,
|
||||
uint16_t npdu_length)
|
||||
const BACNET_IP_ADDRESS *bip_src, const uint8_t *npdu, uint16_t npdu_length)
|
||||
{
|
||||
BACNET_IP_ADDRESS broadcast_address = { 0 };
|
||||
uint8_t mtu[BIP_MPDU_MAX] = { 0 };
|
||||
@@ -340,7 +342,8 @@ static uint16_t bbmd_forward_npdu(
|
||||
* @param original - was the message an original (not forwarded)
|
||||
* @return number of bytes encoded in the Forwarded NPDU
|
||||
*/
|
||||
static uint16_t bbmd_bdt_forward_npdu(const BACNET_IP_ADDRESS *bip_src,
|
||||
static uint16_t bbmd_bdt_forward_npdu(
|
||||
const BACNET_IP_ADDRESS *bip_src,
|
||||
const uint8_t *npdu,
|
||||
uint16_t npdu_length,
|
||||
bool original)
|
||||
@@ -361,8 +364,9 @@ static uint16_t bbmd_bdt_forward_npdu(const BACNET_IP_ADDRESS *bip_src,
|
||||
* or the NAT handling is disabled, leave the source address as is.
|
||||
*/
|
||||
if (BVLC_NAT_Handling && original) {
|
||||
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0],
|
||||
(uint16_t)sizeof(mtu), &BVLC_Global_Address, npdu, npdu_length);
|
||||
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(
|
||||
&mtu[0], (uint16_t)sizeof(mtu), &BVLC_Global_Address, npdu,
|
||||
npdu_length);
|
||||
} else {
|
||||
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(
|
||||
&mtu[0], (uint16_t)sizeof(mtu), bip_src, npdu, npdu_length);
|
||||
@@ -405,7 +409,8 @@ static uint16_t bbmd_bdt_forward_npdu(const BACNET_IP_ADDRESS *bip_src,
|
||||
* @param original - was the message an original (not forwarded)
|
||||
* @return number of bytes encoded in the Forwarded NPDU
|
||||
*/
|
||||
static uint16_t bbmd_fdt_forward_npdu(const BACNET_IP_ADDRESS *bip_src,
|
||||
static uint16_t bbmd_fdt_forward_npdu(
|
||||
const BACNET_IP_ADDRESS *bip_src,
|
||||
const uint8_t *npdu,
|
||||
uint16_t npdu_length,
|
||||
bool original)
|
||||
@@ -426,8 +431,9 @@ static uint16_t bbmd_fdt_forward_npdu(const BACNET_IP_ADDRESS *bip_src,
|
||||
* or the NAT handling is disabled, leave the source address as is.
|
||||
*/
|
||||
if (BVLC_NAT_Handling && original) {
|
||||
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0],
|
||||
(uint16_t)sizeof(mtu), &BVLC_Global_Address, npdu, npdu_length);
|
||||
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(
|
||||
&mtu[0], (uint16_t)sizeof(mtu), &BVLC_Global_Address, npdu,
|
||||
npdu_length);
|
||||
} else {
|
||||
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(
|
||||
&mtu[0], (uint16_t)sizeof(mtu), bip_src, npdu, npdu_length);
|
||||
@@ -478,14 +484,16 @@ static void bbmd_read_bdt_ack_handler(
|
||||
unsigned count = 1;
|
||||
int len = 0;
|
||||
|
||||
printf("BBMD: %u.%u.%u.%u:%u\n", (unsigned)addr->address[0],
|
||||
printf(
|
||||
"BBMD: %u.%u.%u.%u:%u\n", (unsigned)addr->address[0],
|
||||
(unsigned)addr->address[1], (unsigned)addr->address[2],
|
||||
(unsigned)addr->address[3], (unsigned)addr->port);
|
||||
while (npdu_length >= BACNET_IP_BDT_ENTRY_SIZE) {
|
||||
len = bvlc_decode_broadcast_distribution_table_entry(
|
||||
&npdu[offset], npdu_length, &bdt_entry);
|
||||
if (len > 0) {
|
||||
printf("BDT-%03u: %u.%u.%u.%u:%u %u.%u.%u.%u\n", count,
|
||||
printf(
|
||||
"BDT-%03u: %u.%u.%u.%u:%u %u.%u.%u.%u\n", count,
|
||||
(unsigned)bdt_entry.dest_address.address[0],
|
||||
(unsigned)bdt_entry.dest_address.address[1],
|
||||
(unsigned)bdt_entry.dest_address.address[2],
|
||||
@@ -526,14 +534,16 @@ static void bbmd_read_fdt_ack_handler(
|
||||
unsigned count = 1;
|
||||
int len = 0;
|
||||
|
||||
printf("BBMD: %u.%u.%u.%u:%u\n", (unsigned)addr->address[0],
|
||||
printf(
|
||||
"BBMD: %u.%u.%u.%u:%u\n", (unsigned)addr->address[0],
|
||||
(unsigned)addr->address[1], (unsigned)addr->address[2],
|
||||
(unsigned)addr->address[3], (unsigned)addr->port);
|
||||
while (npdu_length >= BACNET_IP_FDT_ENTRY_SIZE) {
|
||||
len = bvlc_decode_foreign_device_table_entry(
|
||||
&npdu[offset], npdu_length, &fdt_entry);
|
||||
if (len > 0) {
|
||||
printf("FDT-%03u: %u.%u.%u.%u:%u %us %us\n", count,
|
||||
printf(
|
||||
"FDT-%03u: %u.%u.%u.%u:%u %us %us\n", count,
|
||||
(unsigned)fdt_entry.dest_address.address[0],
|
||||
(unsigned)fdt_entry.dest_address.address[1],
|
||||
(unsigned)fdt_entry.dest_address.address[2],
|
||||
@@ -568,7 +578,8 @@ static void bbmd_read_fdt_ack_handler(
|
||||
* @return Upon successful completion, returns the number of bytes sent.
|
||||
* Otherwise, -1 shall be returned and errno set to indicate the error.
|
||||
*/
|
||||
int bvlc_send_pdu(const BACNET_ADDRESS *dest,
|
||||
int bvlc_send_pdu(
|
||||
const BACNET_ADDRESS *dest,
|
||||
const BACNET_NPDU_DATA *npdu_data,
|
||||
const uint8_t *pdu,
|
||||
unsigned pdu_len)
|
||||
@@ -639,8 +650,8 @@ int bvlc_send_pdu(const BACNET_ADDRESS *dest,
|
||||
* @return Upon successful completion, returns the number of bytes sent.
|
||||
* Otherwise, -1 shall be returned and errno set to indicate the error.
|
||||
*/
|
||||
static int bvlc_send_result(
|
||||
const BACNET_IP_ADDRESS *dest_addr, uint16_t result_code)
|
||||
static int
|
||||
bvlc_send_result(const BACNET_IP_ADDRESS *dest_addr, uint16_t result_code)
|
||||
{
|
||||
uint8_t mtu[BIP_MPDU_MAX] = { 0 };
|
||||
uint16_t mtu_len = 0;
|
||||
@@ -661,7 +672,8 @@ static int bvlc_send_result(
|
||||
*
|
||||
* @return number of bytes offset into the NPDU for APDU, or 0 if handled
|
||||
*/
|
||||
int bvlc_bbmd_disabled_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_bbmd_disabled_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len)
|
||||
@@ -822,7 +834,8 @@ int bvlc_bbmd_disabled_handler(BACNET_IP_ADDRESS *addr,
|
||||
*
|
||||
* @return number of bytes offset into the NPDU for APDU, or 0 if handled
|
||||
*/
|
||||
int bvlc_bbmd_enabled_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_bbmd_enabled_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len)
|
||||
@@ -940,7 +953,8 @@ int bvlc_bbmd_enabled_handler(BACNET_IP_ADDRESS *addr,
|
||||
the BBMD's FDT. */
|
||||
offset = header_len + function_len - npdu_len;
|
||||
npdu = &mtu[offset];
|
||||
(void)bbmd_fdt_forward_npdu(&fwd_address, npdu, npdu_len, false);
|
||||
(void)bbmd_fdt_forward_npdu(
|
||||
&fwd_address, npdu, npdu_len, false);
|
||||
/* prepare the message for me! */
|
||||
bvlc_ip_address_to_bacnet_local(src, &fwd_address);
|
||||
debug_print_npdu("Forwarded-NPDU", offset, npdu_len);
|
||||
@@ -1145,7 +1159,8 @@ int bvlc_bbmd_enabled_handler(BACNET_IP_ADDRESS *addr,
|
||||
*
|
||||
* @return number of bytes offset into the NPDU for APDU, or 0 if handled
|
||||
*/
|
||||
int bvlc_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len)
|
||||
@@ -1159,7 +1174,8 @@ int bvlc_handler(BACNET_IP_ADDRESS *addr,
|
||||
#endif
|
||||
}
|
||||
|
||||
int bvlc_broadcast_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_broadcast_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len)
|
||||
@@ -1249,7 +1265,8 @@ int bvlc_bbmd_read_bdt(const BACNET_IP_ADDRESS *bbmd_addr)
|
||||
* @param bbmd_addr - IPv4 address of BBMD with which to read
|
||||
* @return Positive number (of bytes sent) on success
|
||||
*/
|
||||
int bvlc_bbmd_write_bdt(const BACNET_IP_ADDRESS *bbmd_addr,
|
||||
int bvlc_bbmd_write_bdt(
|
||||
const BACNET_IP_ADDRESS *bbmd_addr,
|
||||
BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY *bdt_list)
|
||||
{
|
||||
BVLC_Buffer_Len = bvlc_encode_write_broadcast_distribution_table(
|
||||
|
||||
@@ -22,32 +22,36 @@ extern "C" {
|
||||
|
||||
/* user application function prototypes */
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc_broadcast_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_broadcast_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc_bbmd_enabled_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_bbmd_enabled_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc_bbmd_disabled_handler(BACNET_IP_ADDRESS *addr,
|
||||
int bvlc_bbmd_disabled_handler(
|
||||
BACNET_IP_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len);
|
||||
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc_send_pdu(const BACNET_ADDRESS *dest,
|
||||
int bvlc_send_pdu(
|
||||
const BACNET_ADDRESS *dest,
|
||||
const BACNET_NPDU_DATA *npdu_data,
|
||||
const uint8_t *pdu,
|
||||
unsigned pdu_len);
|
||||
@@ -78,7 +82,8 @@ void bvlc_debug_disable(void);
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc_bbmd_read_bdt(const BACNET_IP_ADDRESS *bbmd_addr);
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc_bbmd_write_bdt(const BACNET_IP_ADDRESS *bbmd_addr,
|
||||
int bvlc_bbmd_write_bdt(
|
||||
const BACNET_IP_ADDRESS *bbmd_addr,
|
||||
BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY *bdt_list);
|
||||
/* send a Read FDT request */
|
||||
BACNET_STACK_EXPORT
|
||||
@@ -89,11 +94,9 @@ BACNET_STACK_EXPORT
|
||||
int bvlc_register_with_bbmd(
|
||||
const BACNET_IP_ADDRESS *address, uint16_t time_to_live_seconds);
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc_remote_bbmd_address(
|
||||
BACNET_IP_ADDRESS *address);
|
||||
void bvlc_remote_bbmd_address(BACNET_IP_ADDRESS *address);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t bvlc_remote_bbmd_lifetime(
|
||||
void);
|
||||
uint16_t bvlc_remote_bbmd_lifetime(void);
|
||||
|
||||
/* Local interface to manage BBMD.
|
||||
* The interface user needs to handle mutual exclusion if needed i.e.
|
||||
|
||||
@@ -36,7 +36,8 @@ static int printf_stderr(const char *format, ...)
|
||||
return length;
|
||||
}
|
||||
#else
|
||||
static int printf_stderr(const char *format, ...) {
|
||||
static int printf_stderr(const char *format, ...)
|
||||
{
|
||||
(void)format;
|
||||
return 0;
|
||||
}
|
||||
@@ -113,8 +114,8 @@ void bvlc6_maintenance_timer(uint16_t seconds)
|
||||
*
|
||||
* @return true if the address was set
|
||||
*/
|
||||
static bool bbmd6_address_from_vmac(
|
||||
BACNET_IP6_ADDRESS *addr, const struct vmac_data *vmac)
|
||||
static bool
|
||||
bbmd6_address_from_vmac(BACNET_IP6_ADDRESS *addr, const struct vmac_data *vmac)
|
||||
{
|
||||
bool status = false;
|
||||
unsigned int i = 0;
|
||||
@@ -138,8 +139,8 @@ static bool bbmd6_address_from_vmac(
|
||||
*
|
||||
* @return true if the address was set
|
||||
*/
|
||||
static bool bbmd6_address_to_vmac(
|
||||
struct vmac_data *vmac, const BACNET_IP6_ADDRESS *addr)
|
||||
static bool
|
||||
bbmd6_address_to_vmac(struct vmac_data *vmac, const BACNET_IP6_ADDRESS *addr)
|
||||
{
|
||||
bool status = false;
|
||||
unsigned int i = 0;
|
||||
@@ -178,13 +179,15 @@ static void bbmd6_add_vmac(uint32_t device_id, const BACNET_IP6_ADDRESS *addr)
|
||||
} else {
|
||||
/* VMAC exists, but device ID changed */
|
||||
VMAC_Delete(list_device_id);
|
||||
PRINTF("BVLC6: VMAC existed for %u [",
|
||||
PRINTF(
|
||||
"BVLC6: VMAC existed for %u [",
|
||||
(unsigned int)list_device_id);
|
||||
for (i = 0; i < new_vmac.mac_len; i++) {
|
||||
PRINTF("%02X", new_vmac.mac[i]);
|
||||
}
|
||||
PRINTF("]\n");
|
||||
PRINTF("BVLC6: Removed VMAC for %lu.\n",
|
||||
PRINTF(
|
||||
"BVLC6: Removed VMAC for %lu.\n",
|
||||
(unsigned long)list_device_id);
|
||||
}
|
||||
}
|
||||
@@ -193,25 +196,23 @@ static void bbmd6_add_vmac(uint32_t device_id, const BACNET_IP6_ADDRESS *addr)
|
||||
if (vmac) {
|
||||
/* device ID already exists. Update MAC. */
|
||||
memmove(vmac, &new_vmac, sizeof(struct vmac_data));
|
||||
PRINTF("BVLC6: VMAC for %u [",
|
||||
(unsigned int)device_id);
|
||||
PRINTF("BVLC6: VMAC for %u [", (unsigned int)device_id);
|
||||
for (i = 0; i < new_vmac.mac_len; i++) {
|
||||
PRINTF("%02X", new_vmac.mac[i]);
|
||||
}
|
||||
PRINTF("]\n");
|
||||
PRINTF("BVLC6: Updated VMAC for %lu.\n",
|
||||
(unsigned long)device_id);
|
||||
PRINTF(
|
||||
"BVLC6: Updated VMAC for %lu.\n", (unsigned long)device_id);
|
||||
} else {
|
||||
/* new entry - add it! */
|
||||
VMAC_Add(device_id, &new_vmac);
|
||||
PRINTF("BVLC6: VMAC for %u [",
|
||||
(unsigned int)device_id);
|
||||
PRINTF("BVLC6: VMAC for %u [", (unsigned int)device_id);
|
||||
for (i = 0; i < new_vmac.mac_len; i++) {
|
||||
PRINTF("%02X", new_vmac.mac[i]);
|
||||
}
|
||||
PRINTF("]\n");
|
||||
PRINTF("BVLC6: Added VMAC for %lu.\n",
|
||||
(unsigned long)device_id);
|
||||
PRINTF(
|
||||
"BVLC6: Added VMAC for %lu.\n", (unsigned long)device_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,7 +261,8 @@ static bool bbmd6_address_from_bacnet_address(
|
||||
if (status) {
|
||||
vmac = VMAC_Find_By_Key(device_id);
|
||||
if (vmac) {
|
||||
PRINTF("BVLC6: Found VMAC %lu (len=%u).\n",
|
||||
PRINTF(
|
||||
"BVLC6: Found VMAC %lu (len=%u).\n",
|
||||
(unsigned long)device_id, (unsigned)vmac->mac_len);
|
||||
status = bbmd6_address_from_vmac(addr, vmac);
|
||||
if (vmac_src) {
|
||||
@@ -285,7 +287,8 @@ static bool bbmd6_address_from_bacnet_address(
|
||||
* @return Upon successful completion, returns the number of bytes sent.
|
||||
* Otherwise, -1 shall be returned and errno set to indicate the error.
|
||||
*/
|
||||
int bvlc6_send_pdu(const BACNET_ADDRESS *dest,
|
||||
int bvlc6_send_pdu(
|
||||
const BACNET_ADDRESS *dest,
|
||||
const BACNET_NPDU_DATA *npdu_data,
|
||||
const uint8_t *pdu,
|
||||
unsigned pdu_len)
|
||||
@@ -408,7 +411,8 @@ static void bbmd6_send_pdu_fdt(uint8_t *mtu, unsigned int mtu_len)
|
||||
* @param npdu - the bytes of NPDU+APDU data to send
|
||||
* @param npdu_len - the number of bytes of NPDU+APDU data to send
|
||||
*/
|
||||
static void bbmd6_send_forward_npdu(BACNET_IP6_ADDRESS *address,
|
||||
static void bbmd6_send_forward_npdu(
|
||||
BACNET_IP6_ADDRESS *address,
|
||||
uint32_t vmac_src,
|
||||
uint8_t *npdu,
|
||||
unsigned int npdu_len)
|
||||
@@ -647,7 +651,8 @@ static void bbmd6_address_resolution_ack_handler(
|
||||
*
|
||||
* @return number of bytes offset into the NPDU for APDU, or 0 if handled
|
||||
*/
|
||||
int bvlc6_bbmd_disabled_handler(BACNET_IP6_ADDRESS *addr,
|
||||
int bvlc6_bbmd_disabled_handler(
|
||||
BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len)
|
||||
@@ -766,8 +771,9 @@ int bvlc6_bbmd_disabled_handler(BACNET_IP6_ADDRESS *addr,
|
||||
/* ignore messages from my IPv6 address */
|
||||
PRINTF("BIP6: Forwarded-NPDU is me!\n");
|
||||
} else {
|
||||
function_len = bvlc6_decode_forwarded_npdu(pdu, pdu_len,
|
||||
&vmac_src, &fwd_address, NULL, 0, &npdu_len);
|
||||
function_len = bvlc6_decode_forwarded_npdu(
|
||||
pdu, pdu_len, &vmac_src, &fwd_address, NULL, 0,
|
||||
&npdu_len);
|
||||
if (function_len) {
|
||||
/* The Virtual MAC address table shall be updated
|
||||
using the respective parameter values of the
|
||||
@@ -825,7 +831,8 @@ int bvlc6_bbmd_disabled_handler(BACNET_IP6_ADDRESS *addr,
|
||||
*
|
||||
* @return number of bytes offset into the NPDU for APDU, or 0 if handled
|
||||
*/
|
||||
int bvlc6_bbmd_enabled_handler(BACNET_IP6_ADDRESS *addr,
|
||||
int bvlc6_bbmd_enabled_handler(
|
||||
BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len)
|
||||
@@ -1020,7 +1027,8 @@ int bvlc6_bbmd_enabled_handler(BACNET_IP6_ADDRESS *addr,
|
||||
*
|
||||
* @return number of bytes offset into the NPDU for APDU, or 0 if handled
|
||||
*/
|
||||
int bvlc6_handler(BACNET_IP6_ADDRESS *addr,
|
||||
int bvlc6_handler(
|
||||
BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len)
|
||||
@@ -1041,8 +1049,8 @@ int bvlc6_handler(BACNET_IP6_ADDRESS *addr,
|
||||
* 0 if no registration request is sent, or
|
||||
* -1 if registration fails.
|
||||
*/
|
||||
int bvlc6_register_with_bbmd(const BACNET_IP6_ADDRESS *bbmd_addr,
|
||||
uint16_t ttl_seconds)
|
||||
int bvlc6_register_with_bbmd(
|
||||
const BACNET_IP6_ADDRESS *bbmd_addr, uint16_t ttl_seconds)
|
||||
{
|
||||
uint8_t mtu[BIP6_MPDU_MAX] = { 0 };
|
||||
uint16_t mtu_len = 0;
|
||||
|
||||
@@ -20,66 +20,62 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* user application function prototypes */
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_handler(
|
||||
BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t * npdu,
|
||||
uint16_t npdu_len);
|
||||
/* user application function prototypes */
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_handler(
|
||||
BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *npdu,
|
||||
uint16_t npdu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_bbmd_enabled_handler(BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_bbmd_enabled_handler(
|
||||
BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_bbmd_disabled_handler(BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_bbmd_disabled_handler(
|
||||
BACNET_IP6_ADDRESS *addr,
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t *mtu,
|
||||
uint16_t mtu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_send_pdu(const BACNET_ADDRESS *dest,
|
||||
const BACNET_NPDU_DATA *npdu_data,
|
||||
const uint8_t *pdu,
|
||||
unsigned pdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_send_pdu(
|
||||
const BACNET_ADDRESS *dest,
|
||||
const BACNET_NPDU_DATA *npdu_data,
|
||||
const uint8_t *pdu,
|
||||
unsigned pdu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_register_with_bbmd(
|
||||
const BACNET_IP6_ADDRESS *bbmd_addr,
|
||||
uint16_t time_to_live_seconds);
|
||||
BACNET_STACK_EXPORT
|
||||
int bvlc6_register_with_bbmd(
|
||||
const BACNET_IP6_ADDRESS *bbmd_addr, uint16_t time_to_live_seconds);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_remote_bbmd_address(
|
||||
BACNET_IP6_ADDRESS *bbmd_addr);
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_remote_bbmd_address(BACNET_IP6_ADDRESS *bbmd_addr);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t bvlc6_remote_bbmd_lifetime(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t bvlc6_remote_bbmd_lifetime(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t bvlc6_get_last_result(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t bvlc6_get_last_result(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t bvlc6_get_function_code(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint8_t bvlc6_get_function_code(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_maintenance_timer(
|
||||
uint16_t seconds);
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_maintenance_timer(uint16_t seconds);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_debug_enable(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_debug_enable(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_cleanup(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_init(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void bvlc6_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -127,8 +127,7 @@ struct vmac_data *VMAC_Find_By_Key(uint32_t device_id)
|
||||
* @return true if the addresses are different
|
||||
*/
|
||||
bool VMAC_Different(
|
||||
const struct vmac_data *vmac1,
|
||||
const struct vmac_data *vmac2)
|
||||
const struct vmac_data *vmac1, const struct vmac_data *vmac2)
|
||||
{
|
||||
bool status = false;
|
||||
unsigned int i = 0;
|
||||
@@ -159,9 +158,7 @@ bool VMAC_Different(
|
||||
*
|
||||
* @return true if the addresses are the same
|
||||
*/
|
||||
bool VMAC_Match(
|
||||
const struct vmac_data *vmac1,
|
||||
const struct vmac_data *vmac2)
|
||||
bool VMAC_Match(const struct vmac_data *vmac1, const struct vmac_data *vmac2)
|
||||
{
|
||||
bool status = false;
|
||||
unsigned int i = 0;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
/* define the max MAC as big as IPv6 + port number */
|
||||
#define VMAC_MAC_MAX 18
|
||||
/**
|
||||
* VMAC data structure
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
* VMAC data structure
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
struct vmac_data {
|
||||
uint8_t mac[VMAC_MAC_MAX];
|
||||
uint8_t mac_len;
|
||||
@@ -30,30 +30,27 @@ struct vmac_data {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned int VMAC_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
struct vmac_data *VMAC_Find_By_Key(uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Find_By_Data(const struct vmac_data *vmac, uint32_t *device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Add(uint32_t device_id, const struct vmac_data *pVMAC);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Delete(uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Different(
|
||||
const struct vmac_data *vmac1,
|
||||
const struct vmac_data *vmac2);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Match(
|
||||
const struct vmac_data *vmac1,
|
||||
const struct vmac_data *vmac2);
|
||||
BACNET_STACK_EXPORT
|
||||
void VMAC_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void VMAC_Init(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void VMAC_Debug_Enable(void);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned int VMAC_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
struct vmac_data *VMAC_Find_By_Key(uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Find_By_Data(const struct vmac_data *vmac, uint32_t *device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Add(uint32_t device_id, const struct vmac_data *pVMAC);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Delete(uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Different(
|
||||
const struct vmac_data *vmac1, const struct vmac_data *vmac2);
|
||||
BACNET_STACK_EXPORT
|
||||
bool VMAC_Match(const struct vmac_data *vmac1, const struct vmac_data *vmac2);
|
||||
BACNET_STACK_EXPORT
|
||||
void VMAC_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void VMAC_Init(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void VMAC_Debug_Enable(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ static struct Address_Cache_Entry *address_remove_oldest(void)
|
||||
for (index = Top_Protected_Entry; index < MAX_ADDRESS_CACHE; index++) {
|
||||
pMatch = &Address_Cache[index];
|
||||
if ((pMatch->Flags &
|
||||
(BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ | BAC_ADDR_STATIC)) ==
|
||||
(BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ | BAC_ADDR_STATIC)) ==
|
||||
BAC_ADDR_IN_USE) {
|
||||
if (pMatch->TimeToLive <= ulTime) {
|
||||
/* Shorter lived entry found */
|
||||
@@ -166,7 +166,7 @@ static struct Address_Cache_Entry *address_remove_oldest(void)
|
||||
for (index = 0; index < MAX_ADDRESS_CACHE; index++) {
|
||||
pMatch = &Address_Cache[index];
|
||||
if ((pMatch->Flags &
|
||||
(BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ | BAC_ADDR_STATIC)) ==
|
||||
(BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ | BAC_ADDR_STATIC)) ==
|
||||
((uint8_t)(BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ))) {
|
||||
if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */
|
||||
ulTime = pMatch->TimeToLive;
|
||||
@@ -211,7 +211,8 @@ static void address_file_init(const char *pFilename)
|
||||
while (fgets(line, (int)sizeof(line), pFile) != NULL) {
|
||||
/* ignore comments */
|
||||
if (line[0] != ';') {
|
||||
if (sscanf(line, "%7ld %79s %5u %79s %4u", &device_id,
|
||||
if (sscanf(
|
||||
line, "%7ld %79s %5u %79s %4u", &device_id,
|
||||
&mac_string[0], &snet, &sadr_string[0],
|
||||
&max_apdu) == 5) {
|
||||
if (bacnet_address_mac_from_ascii(&mac, mac_string)) {
|
||||
@@ -503,7 +504,8 @@ void address_add(
|
||||
*
|
||||
* @return true if device is already bound
|
||||
*/
|
||||
bool address_device_bind_request(uint32_t device_id,
|
||||
bool address_device_bind_request(
|
||||
uint32_t device_id,
|
||||
uint32_t *device_ttl,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS *src)
|
||||
@@ -633,7 +635,8 @@ void address_add_binding(
|
||||
*
|
||||
* @return true/false
|
||||
*/
|
||||
bool address_device_get_by_index(unsigned index,
|
||||
bool address_device_get_by_index(
|
||||
unsigned index,
|
||||
uint32_t *device_id,
|
||||
uint32_t *device_ttl,
|
||||
unsigned *max_apdu,
|
||||
@@ -676,7 +679,8 @@ bool address_device_get_by_index(unsigned index,
|
||||
*
|
||||
* @return true/false
|
||||
*/
|
||||
bool address_get_by_index(unsigned index,
|
||||
bool address_get_by_index(
|
||||
unsigned index,
|
||||
uint32_t *device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS *src)
|
||||
@@ -880,7 +884,7 @@ int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
|
||||
pMatch = Address_Cache;
|
||||
uiIndex = 1;
|
||||
while ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ)) !=
|
||||
BAC_ADDR_IN_USE) { /* Find first bound entry */
|
||||
BAC_ADDR_IN_USE) { /* Find first bound entry */
|
||||
pMatch++;
|
||||
/* Shall not happen as the count has been checked first. */
|
||||
if (pMatch > &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
|
||||
@@ -947,7 +951,7 @@ int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
|
||||
pRequest->ItemCount++;
|
||||
|
||||
while ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ)) !=
|
||||
BAC_ADDR_IN_USE) {
|
||||
BAC_ADDR_IN_USE) {
|
||||
/* Find next bound entry */
|
||||
pMatch++;
|
||||
/* Can normally not happen. */
|
||||
@@ -987,8 +991,8 @@ void address_cache_timer(uint16_t uSeconds)
|
||||
pMatch = &Address_Cache[index];
|
||||
if (((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_RESERVED)) != 0) &&
|
||||
((pMatch->Flags & BAC_ADDR_STATIC) ==
|
||||
0)) { /* Check all entries holding a slot except statics
|
||||
*/
|
||||
0)) { /* Check all entries holding a slot except statics
|
||||
*/
|
||||
if (pMatch->TimeToLive >= uSeconds) {
|
||||
pMatch->TimeToLive -= uSeconds;
|
||||
} else {
|
||||
|
||||
@@ -18,105 +18,84 @@
|
||||
#include "bacnet/readrange.h"
|
||||
|
||||
/* refactored utility functions - see bacaddr.c module */
|
||||
#define address_mac_init(m,a,l) bacnet_address_mac_init(m,a,l)
|
||||
#define address_mac_from_ascii(m,a) bacnet_address_mac_from_ascii(m,a)
|
||||
#define address_match(d,s) bacnet_address_same(d,s)
|
||||
#define address_mac_init(m, a, l) bacnet_address_mac_init(m, a, l)
|
||||
#define address_mac_from_ascii(m, a) bacnet_address_mac_from_ascii(m, a)
|
||||
#define address_match(d, s) bacnet_address_same(d, s)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_init(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_init_partial(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_init_partial(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_add(
|
||||
uint32_t device_id,
|
||||
unsigned max_apdu,
|
||||
const BACNET_ADDRESS * src);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_add(
|
||||
uint32_t device_id, unsigned max_apdu, const BACNET_ADDRESS *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_remove_device(
|
||||
uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_remove_device(uint32_t device_id);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_get_by_device(
|
||||
uint32_t device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_get_by_device(
|
||||
uint32_t device_id, unsigned *max_apdu, BACNET_ADDRESS *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_get_by_index(
|
||||
unsigned index,
|
||||
uint32_t * device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_get_by_index(
|
||||
unsigned index,
|
||||
uint32_t *device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_device_get_by_index(
|
||||
unsigned index,
|
||||
uint32_t * device_id,
|
||||
uint32_t * device_ttl,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_device_get_by_index(
|
||||
unsigned index,
|
||||
uint32_t *device_id,
|
||||
uint32_t *device_ttl,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_get_device_id(
|
||||
const BACNET_ADDRESS * src,
|
||||
uint32_t * device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_get_device_id(const BACNET_ADDRESS *src, uint32_t *device_id);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned address_count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned address_count(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_bind_request(
|
||||
uint32_t device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_bind_request(
|
||||
uint32_t device_id, unsigned *max_apdu, BACNET_ADDRESS *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_device_bind_request(
|
||||
uint32_t device_id,
|
||||
uint32_t * device_ttl,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
BACNET_STACK_EXPORT
|
||||
bool address_device_bind_request(
|
||||
uint32_t device_id,
|
||||
uint32_t *device_ttl,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_add_binding(
|
||||
uint32_t device_id,
|
||||
unsigned max_apdu,
|
||||
const BACNET_ADDRESS * src);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_add_binding(
|
||||
uint32_t device_id, unsigned max_apdu, const BACNET_ADDRESS *src);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int address_list_encode(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
int address_list_encode(uint8_t *apdu, unsigned apdu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int rr_address_list_encode(
|
||||
uint8_t * apdu,
|
||||
BACNET_READ_RANGE_DATA * pRequest);
|
||||
BACNET_STACK_EXPORT
|
||||
int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_set_device_TTL(
|
||||
uint32_t device_id,
|
||||
uint32_t TimeOut,
|
||||
bool StaticFlag);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_set_device_TTL(
|
||||
uint32_t device_id, uint32_t TimeOut, bool StaticFlag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_cache_timer(
|
||||
uint16_t uSeconds);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_cache_timer(uint16_t uSeconds);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void address_protected_entry_index_set(uint32_t top_protected_entry_index);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_own_device_id_set(uint32_t own_id);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_protected_entry_index_set(uint32_t top_protected_entry_index);
|
||||
BACNET_STACK_EXPORT
|
||||
void address_own_device_id_set(uint32_t own_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -108,7 +108,8 @@ static void bacnet_data_object_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void bacnet_data_object_store(int index,
|
||||
static void bacnet_data_object_store(
|
||||
int index,
|
||||
const BACNET_READ_PROPERTY_DATA *rp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
@@ -149,7 +150,8 @@ static void bacnet_data_object_store(int index,
|
||||
* @param value [in] pointer to the BACNET_APPLICATION_DATA_VALUE structure
|
||||
* which is packed with the decoded value from the ReadProperty request.
|
||||
*/
|
||||
void bacnet_data_value_save(uint32_t device_instance,
|
||||
void bacnet_data_value_save(
|
||||
uint32_t device_instance,
|
||||
BACNET_READ_PROPERTY_DATA *rp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
@@ -172,8 +174,9 @@ void bacnet_data_value_save(uint32_t device_instance,
|
||||
case OBJECT_MULTI_STATE_INPUT:
|
||||
case OBJECT_MULTI_STATE_OUTPUT:
|
||||
case OBJECT_MULTI_STATE_VALUE:
|
||||
index = bacnet_data_object_index_find(device_instance,
|
||||
rp_data->object_type, rp_data->object_instance);
|
||||
index = bacnet_data_object_index_find(
|
||||
device_instance, rp_data->object_type,
|
||||
rp_data->object_instance);
|
||||
if (index != BACNET_STATUS_ERROR) {
|
||||
bacnet_data_object_store(index, rp_data, value);
|
||||
}
|
||||
@@ -193,9 +196,9 @@ static void bacnet_data_object_process(const BACNET_DATA_OBJECT *object)
|
||||
{
|
||||
if (object && (object->Device_ID < BACNET_MAX_INSTANCE) &&
|
||||
(object->Object_ID < BACNET_MAX_INSTANCE)) {
|
||||
bacnet_read_property_queue(object->Device_ID,
|
||||
(BACNET_OBJECT_TYPE)object->Object_Type, object->Object_ID,
|
||||
PROP_PRESENT_VALUE, BACNET_ARRAY_ALL);
|
||||
bacnet_read_property_queue(
|
||||
object->Device_ID, (BACNET_OBJECT_TYPE)object->Object_Type,
|
||||
object->Object_ID, PROP_PRESENT_VALUE, BACNET_ARRAY_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +209,8 @@ static void bacnet_data_object_process(const BACNET_DATA_OBJECT *object)
|
||||
* @param object_instance - Instance # of the object to be read.
|
||||
* @return true if added or existing, false if not added or existing
|
||||
*/
|
||||
bool bacnet_data_object_add(uint32_t device_id,
|
||||
bool bacnet_data_object_add(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance)
|
||||
{
|
||||
@@ -258,7 +262,8 @@ bool bacnet_data_object_add(uint32_t device_id,
|
||||
* @param float_value [out] property value stored if available
|
||||
* @return true if found and value loaded
|
||||
*/
|
||||
bool bacnet_data_analog_present_value(uint32_t device_id,
|
||||
bool bacnet_data_analog_present_value(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
float *float_value)
|
||||
@@ -291,7 +296,8 @@ bool bacnet_data_analog_present_value(uint32_t device_id,
|
||||
* @param bool_value [out] property value stored if available
|
||||
* @return true if found and value loaded
|
||||
*/
|
||||
bool bacnet_data_binary_present_value(uint32_t device_id,
|
||||
bool bacnet_data_binary_present_value(
|
||||
uint32_t device_id,
|
||||
uint16_t object_type,
|
||||
uint32_t object_instance,
|
||||
bool *bool_value)
|
||||
@@ -329,7 +335,8 @@ bool bacnet_data_binary_present_value(uint32_t device_id,
|
||||
* @param bool_value [out] property value stored if available
|
||||
* @return true if found and value loaded
|
||||
*/
|
||||
bool bacnet_data_multistate_present_value(uint32_t device_id,
|
||||
bool bacnet_data_multistate_present_value(
|
||||
uint32_t device_id,
|
||||
uint16_t object_type,
|
||||
uint32_t object_instance,
|
||||
uint32_t *unsigned_value)
|
||||
|
||||
@@ -35,25 +35,30 @@ void bacnet_data_poll_seconds_set(unsigned int seconds);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned int bacnet_data_poll_seconds(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacnet_data_value_save(uint32_t device_instance,
|
||||
void bacnet_data_value_save(
|
||||
uint32_t device_instance,
|
||||
BACNET_READ_PROPERTY_DATA *rp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_data_object_add(uint32_t device_id,
|
||||
bool bacnet_data_object_add(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_data_analog_present_value(uint32_t device_id,
|
||||
bool bacnet_data_analog_present_value(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
float *float_value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_data_multistate_present_value(uint32_t device_id,
|
||||
bool bacnet_data_multistate_present_value(
|
||||
uint32_t device_id,
|
||||
uint16_t object_type,
|
||||
uint32_t object_instance,
|
||||
uint32_t *unsigned_value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_data_binary_present_value(uint32_t device_id,
|
||||
bool bacnet_data_binary_present_value(
|
||||
uint32_t device_id,
|
||||
uint16_t object_type,
|
||||
uint32_t object_instance,
|
||||
bool *bool_value);
|
||||
|
||||
@@ -224,8 +224,8 @@ static BACNET_DEVICE_DATA *bacnet_device_data_add(uint32_t device_instance)
|
||||
* @param device_id - BACnet device instance
|
||||
* @return Pointer to the device data structure
|
||||
*/
|
||||
static BACNET_DEVICE_DATA *bacnet_device_data(
|
||||
OS_Keylist list, uint32_t device_id)
|
||||
static BACNET_DEVICE_DATA *
|
||||
bacnet_device_data(OS_Keylist list, uint32_t device_id)
|
||||
{
|
||||
KEY key = device_id;
|
||||
BACNET_DEVICE_DATA *device_data;
|
||||
@@ -395,7 +395,8 @@ unsigned long bacnet_discover_device_elapsed_milliseconds(uint32_t device_id)
|
||||
* @param value property value stored if available (see tag for type)
|
||||
* @return true if found and value loaded
|
||||
*/
|
||||
bool bacnet_discover_property_value(uint32_t device_id,
|
||||
bool bacnet_discover_property_value(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -420,10 +421,10 @@ bool bacnet_discover_property_value(uint32_t device_id,
|
||||
property = Keylist_Data(object->Property_List, key);
|
||||
if (property) {
|
||||
if (property->application_data_len > 0) {
|
||||
len =
|
||||
bacapp_decode_known_property(property->application_data,
|
||||
property->application_data_len, value, object_type,
|
||||
object_property);
|
||||
len = bacapp_decode_known_property(
|
||||
property->application_data,
|
||||
property->application_data_len, value, object_type,
|
||||
object_property);
|
||||
if (len > 0) {
|
||||
status = true;
|
||||
}
|
||||
@@ -449,7 +450,8 @@ bool bacnet_discover_property_value(uint32_t device_id,
|
||||
* @param default_string [in] String to use if the property is not found.
|
||||
* @return true if found and value copied, else false and default_string copied.
|
||||
*/
|
||||
bool bacnet_discover_property_name(uint32_t device_id,
|
||||
bool bacnet_discover_property_name(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -465,8 +467,8 @@ bool bacnet_discover_property_name(uint32_t device_id,
|
||||
device_id, object_type, object_instance, object_property, &value);
|
||||
if (status && value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) {
|
||||
if (characterstring_valid(&value.type.Character_String)) {
|
||||
strncpy(buffer,
|
||||
characterstring_value(&value.type.Character_String),
|
||||
strncpy(
|
||||
buffer, characterstring_value(&value.type.Character_String),
|
||||
buffer_len - 1);
|
||||
} else {
|
||||
status = false;
|
||||
@@ -487,7 +489,8 @@ bool bacnet_discover_property_name(uint32_t device_id,
|
||||
* @param object_instance - Instance number of the object to be read.
|
||||
* @return number of object properties
|
||||
*/
|
||||
unsigned int bacnet_discover_object_property_count(uint32_t device_id,
|
||||
unsigned int bacnet_discover_object_property_count(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance)
|
||||
{
|
||||
@@ -517,7 +520,8 @@ unsigned int bacnet_discover_object_property_count(uint32_t device_id,
|
||||
* @param property_id - property identifier if object exists
|
||||
* @return true if an object property ID was found at this index
|
||||
*/
|
||||
bool bacnet_discover_object_property_identifier(uint32_t device_id,
|
||||
bool bacnet_discover_object_property_identifier(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
unsigned index,
|
||||
@@ -554,7 +558,8 @@ bool bacnet_discover_object_property_identifier(uint32_t device_id,
|
||||
* which is packed with the decoded value from the ReadProperty request.
|
||||
* @param device_data [in] Pointer to the device data structure
|
||||
*/
|
||||
static void bacnet_device_object_property_add(uint32_t device_id,
|
||||
static void bacnet_device_object_property_add(
|
||||
uint32_t device_id,
|
||||
const BACNET_READ_PROPERTY_DATA *rp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_DEVICE_DATA *device_data)
|
||||
@@ -578,9 +583,11 @@ static void bacnet_device_object_property_add(uint32_t device_id,
|
||||
}
|
||||
} else if (value->tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
|
||||
if (rp_data->array_index <= device_data->Object_List_Size) {
|
||||
object_data = bacnet_object_data_add(device_data->Object_List,
|
||||
value->type.Object_Id.type, value->type.Object_Id.instance);
|
||||
debug_printf("add %u object-list[%u] %s-%lu %s.\n", device_id,
|
||||
object_data = bacnet_object_data_add(
|
||||
device_data->Object_List, value->type.Object_Id.type,
|
||||
value->type.Object_Id.instance);
|
||||
debug_printf(
|
||||
"add %u object-list[%u] %s-%lu %s.\n", device_id,
|
||||
device_data->Object_List_Index,
|
||||
bactext_object_type_name(value->type.Object_Id.type),
|
||||
(unsigned long)value->type.Object_Id.instance,
|
||||
@@ -599,10 +606,12 @@ static void bacnet_device_object_property_add(uint32_t device_id,
|
||||
device_data->Discovery_State =
|
||||
BACNET_DISCOVER_STATE_OBJECT_GET_PROPERTY_RESPONSE;
|
||||
}
|
||||
object_data = bacnet_object_data_add(device_data->Object_List,
|
||||
rp_data->object_type, rp_data->object_instance);
|
||||
object_data = bacnet_object_data_add(
|
||||
device_data->Object_List, rp_data->object_type,
|
||||
rp_data->object_instance);
|
||||
if (!object_data) {
|
||||
debug_perror("%s-%u object fail to add!\n",
|
||||
debug_perror(
|
||||
"%s-%u object fail to add!\n",
|
||||
bactext_object_type_name(rp_data->object_type),
|
||||
rp_data->object_instance);
|
||||
return;
|
||||
@@ -610,7 +619,8 @@ static void bacnet_device_object_property_add(uint32_t device_id,
|
||||
property_data = bacnet_property_data_add(
|
||||
object_data->Property_List, rp_data->object_property);
|
||||
if (!property_data) {
|
||||
debug_perror("%s-%u %s property fail to add!\n",
|
||||
debug_perror(
|
||||
"%s-%u %s property fail to add!\n",
|
||||
bactext_object_type_name(rp_data->object_type),
|
||||
rp_data->object_instance,
|
||||
bactext_property_name(rp_data->object_property));
|
||||
@@ -626,10 +636,12 @@ static void bacnet_device_object_property_add(uint32_t device_id,
|
||||
if (property_data->application_data) {
|
||||
property_data->application_data_len =
|
||||
rp_data->application_data_len;
|
||||
memcpy(property_data->application_data,
|
||||
rp_data->application_data, rp_data->application_data_len);
|
||||
memcpy(
|
||||
property_data->application_data, rp_data->application_data,
|
||||
rp_data->application_data_len);
|
||||
} else {
|
||||
debug_perror("%s-%u %s property fail to allocate!\n",
|
||||
debug_perror(
|
||||
"%s-%u %s property fail to allocate!\n",
|
||||
bactext_object_type_name(rp_data->object_type),
|
||||
rp_data->object_instance,
|
||||
bactext_property_name(rp_data->object_property));
|
||||
@@ -640,17 +652,20 @@ static void bacnet_device_object_property_add(uint32_t device_id,
|
||||
property_data->application_data_len = 0;
|
||||
}
|
||||
if (rp_data->array_index == BACNET_ARRAY_ALL) {
|
||||
debug_printf("%u object-list[%d] %s-%lu %s added.\n", device_id,
|
||||
bacnet_object_list_index(device_data->Object_List,
|
||||
rp_data->object_type, rp_data->object_instance),
|
||||
debug_printf(
|
||||
"%u object-list[%d] %s-%lu %s added.\n", device_id,
|
||||
bacnet_object_list_index(
|
||||
device_data->Object_List, rp_data->object_type,
|
||||
rp_data->object_instance),
|
||||
bactext_object_type_name(rp_data->object_type),
|
||||
(unsigned long)rp_data->object_instance,
|
||||
bactext_property_name(rp_data->object_property));
|
||||
} else {
|
||||
debug_printf("%u object-list[%d] %s-%lu %s[%lu] added.\n",
|
||||
device_id,
|
||||
bacnet_object_list_index(device_data->Object_List,
|
||||
rp_data->object_type, rp_data->object_instance),
|
||||
debug_printf(
|
||||
"%u object-list[%d] %s-%lu %s[%lu] added.\n", device_id,
|
||||
bacnet_object_list_index(
|
||||
device_data->Object_List, rp_data->object_type,
|
||||
rp_data->object_instance),
|
||||
bactext_object_type_name(rp_data->object_type),
|
||||
(unsigned long)rp_data->object_instance,
|
||||
bactext_property_name(rp_data->object_property),
|
||||
@@ -664,7 +679,8 @@ static void bacnet_device_object_property_add(uint32_t device_id,
|
||||
* @param device_id - device instance number where data originated
|
||||
* @param error_code - BACnet Error code
|
||||
*/
|
||||
static void Device_Error_Handler(uint32_t device_id,
|
||||
static void Device_Error_Handler(
|
||||
uint32_t device_id,
|
||||
BACNET_ERROR_CODE error_code,
|
||||
BACNET_DEVICE_DATA *device_data)
|
||||
{
|
||||
@@ -702,7 +718,8 @@ static void Device_Error_Handler(uint32_t device_id,
|
||||
* @param value [in] pointer to the BACNET_APPLICATION_DATA_VALUE structure
|
||||
* which is packed with the decoded value from the ReadProperty request.
|
||||
*/
|
||||
static void bacnet_read_property_reply(uint32_t device_id,
|
||||
static void bacnet_read_property_reply(
|
||||
uint32_t device_id,
|
||||
BACNET_READ_PROPERTY_DATA *rp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
@@ -728,8 +745,8 @@ static void bacnet_read_property_reply(uint32_t device_id,
|
||||
* @param device_id - Device ID from discovered device
|
||||
* @param device_data - Pointer to the device data structure
|
||||
*/
|
||||
static void bacnet_discover_device_fsm(
|
||||
uint32_t device_id, BACNET_DEVICE_DATA *device_data)
|
||||
static void
|
||||
bacnet_discover_device_fsm(uint32_t device_id, BACNET_DEVICE_DATA *device_data)
|
||||
{
|
||||
KEY key = 0;
|
||||
BACNET_OBJECT_TYPE object_type = 0;
|
||||
@@ -765,19 +782,21 @@ static void bacnet_discover_device_fsm(
|
||||
device_data->Object_List_Index++;
|
||||
if (device_data->Object_List_Index <=
|
||||
device_data->Object_List_Size) {
|
||||
debug_printf("%u object-list[%u] size=%u.\n", device_id,
|
||||
debug_printf(
|
||||
"%u object-list[%u] size=%u.\n", device_id,
|
||||
device_data->Object_List_Index,
|
||||
device_data->Object_List_Size);
|
||||
status = bacnet_read_property_queue(device_id, OBJECT_DEVICE,
|
||||
device_id, PROP_OBJECT_LIST,
|
||||
status = bacnet_read_property_queue(
|
||||
device_id, OBJECT_DEVICE, device_id, PROP_OBJECT_LIST,
|
||||
device_data->Object_List_Index);
|
||||
if (status) {
|
||||
device_data->Discovery_State =
|
||||
BACNET_DISCOVER_STATE_OBJECT_LIST_REQUEST;
|
||||
return;
|
||||
} else {
|
||||
debug_perror("%u object-list[%u] %s-%u fail to queue!\n",
|
||||
device_id, device_data->Object_List_Index,
|
||||
debug_perror(
|
||||
"%u object-list[%u] %s-%u fail to queue!\n", device_id,
|
||||
device_data->Object_List_Index,
|
||||
bactext_object_type_name(object_type),
|
||||
(unsigned)object_instance);
|
||||
device_data->Object_List_Index--;
|
||||
@@ -794,24 +813,28 @@ static void bacnet_discover_device_fsm(
|
||||
case BACNET_DISCOVER_STATE_OBJECT_GET_PROPERTY_RESPONSE:
|
||||
if (device_data->Object_List_Index <
|
||||
device_data->Object_List_Size) {
|
||||
if (Keylist_Index_Key(device_data->Object_List,
|
||||
if (Keylist_Index_Key(
|
||||
device_data->Object_List,
|
||||
device_data->Object_List_Index, &key)) {
|
||||
object_type = KEY_DECODE_TYPE(key);
|
||||
object_instance = KEY_DECODE_ID(key);
|
||||
debug_printf("%u object-list[%u] %s-%u read ALL.\n",
|
||||
device_id, device_data->Object_List_Index,
|
||||
debug_printf(
|
||||
"%u object-list[%u] %s-%u read ALL.\n", device_id,
|
||||
device_data->Object_List_Index,
|
||||
bactext_object_type_name(object_type),
|
||||
(unsigned)object_instance);
|
||||
status = bacnet_read_property_queue(device_id, object_type,
|
||||
object_instance, PROP_ALL, BACNET_ARRAY_ALL);
|
||||
status = bacnet_read_property_queue(
|
||||
device_id, object_type, object_instance, PROP_ALL,
|
||||
BACNET_ARRAY_ALL);
|
||||
}
|
||||
if (status) {
|
||||
device_data->Discovery_State =
|
||||
BACNET_DISCOVER_STATE_OBJECT_GET_PROPERTY_REQUEST;
|
||||
device_data->Object_List_Index++;
|
||||
} else {
|
||||
debug_perror("%u object-list[%u] %s-%u fail to queue!\n",
|
||||
device_id, device_data->Object_List_Index,
|
||||
debug_perror(
|
||||
"%u object-list[%u] %s-%u fail to queue!\n", device_id,
|
||||
device_data->Object_List_Index,
|
||||
bactext_object_type_name(object_type),
|
||||
(unsigned)object_instance);
|
||||
}
|
||||
@@ -833,7 +856,8 @@ static void bacnet_discover_device_fsm(
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debug_perror("%u unknown state %u!\n", device_id,
|
||||
debug_perror(
|
||||
"%u unknown state %u!\n", device_id,
|
||||
device_data->Discovery_State);
|
||||
break;
|
||||
}
|
||||
@@ -873,7 +897,8 @@ static void bacnet_discover_devices_task(void)
|
||||
* @param context - pointer to user data
|
||||
* @return true if the iteration completed, false if it stopped early
|
||||
*/
|
||||
bool bacnet_discover_device_object_property_iterate(uint32_t device_id,
|
||||
bool bacnet_discover_device_object_property_iterate(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
bacnet_discover_device_callback callback,
|
||||
@@ -918,8 +943,9 @@ bool bacnet_discover_device_object_property_iterate(uint32_t device_id,
|
||||
rp_data.error_code = ERROR_CODE_SUCCESS;
|
||||
rp_data.application_data = property->application_data;
|
||||
rp_data.application_data_len = property->application_data_len;
|
||||
status = callback(device_id, device_index, object_index,
|
||||
property_index, &rp_data, context);
|
||||
status = callback(
|
||||
device_id, device_index, object_index, property_index, &rp_data,
|
||||
context);
|
||||
/* callback returns true if the iteration
|
||||
should continue, false if it should stop */
|
||||
if (!status) {
|
||||
@@ -930,8 +956,9 @@ bool bacnet_discover_device_object_property_iterate(uint32_t device_id,
|
||||
rp_data.application_data_len = 0;
|
||||
rp_data.error_class = ERROR_CLASS_PROPERTY;
|
||||
rp_data.error_code = ERROR_CODE_UNKNOWN_PROPERTY;
|
||||
status = callback(device_id, device_index, object_index,
|
||||
property_index, &rp_data, context);
|
||||
status = callback(
|
||||
device_id, device_index, object_index, property_index, &rp_data,
|
||||
context);
|
||||
/* callback returns true if the iteration
|
||||
should continue, false if it should stop */
|
||||
if (!status) {
|
||||
@@ -1118,7 +1145,8 @@ unsigned long bacnet_discover_read_process_milliseconds(void)
|
||||
* @param segmentation [in] segmentation flag
|
||||
* @param vendor_id [in] vendor identifier
|
||||
*/
|
||||
void bacnet_discover_device_add(uint32_t device_instance,
|
||||
void bacnet_discover_device_add(
|
||||
uint32_t device_instance,
|
||||
unsigned max_apdu,
|
||||
int segmentation,
|
||||
uint16_t vendor_id)
|
||||
@@ -1128,7 +1156,8 @@ void bacnet_discover_device_add(uint32_t device_instance,
|
||||
(void)max_apdu;
|
||||
(void)segmentation;
|
||||
device_data = bacnet_device_data_add(device_instance);
|
||||
debug_printf("device[%d] %lu - vendor=%u %s.\n",
|
||||
debug_printf(
|
||||
"device[%d] %lu - vendor=%u %s.\n",
|
||||
Keylist_Index(Device_List, device_instance), device_instance, vendor_id,
|
||||
device_data ? "success" : "fail");
|
||||
}
|
||||
|
||||
@@ -18,19 +18,22 @@
|
||||
/**
|
||||
* @brief Callback function for iterating the results of the device discovery.
|
||||
* @param device_id [in] The device ID of the data
|
||||
* @param device_index [in] The index of the device in the list of discovered devices
|
||||
* @param object_index [in] The index of the object in the list of discovered objects in the device
|
||||
* @param property_index [in] The index of the property in the list of discovered properties in the object in the device
|
||||
* @param device_index [in] The index of the device in the list of discovered
|
||||
* devices
|
||||
* @param object_index [in] The index of the object in the list of discovered
|
||||
* objects in the device
|
||||
* @param property_index [in] The index of the property in the list of
|
||||
* discovered properties in the object in the device
|
||||
* @param rp_data [in] The contents of the device object property
|
||||
* @param context_data [in] The context data passed to the discover function
|
||||
* @return true if the iteration should continue, false if it should stop
|
||||
*/
|
||||
typedef bool (*bacnet_discover_device_callback) (
|
||||
*/
|
||||
typedef bool (*bacnet_discover_device_callback)(
|
||||
uint32_t device_id,
|
||||
unsigned device_index,
|
||||
unsigned object_index,
|
||||
unsigned property_index,
|
||||
BACNET_READ_PROPERTY_DATA * rp_data,
|
||||
BACNET_READ_PROPERTY_DATA *rp_data,
|
||||
void *context_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -47,14 +50,12 @@ uint32_t bacnet_discover_device_instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
int bacnet_discover_device_object_count(uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_discover_device_object_identifier(uint32_t device_id,
|
||||
unsigned index, BACNET_OBJECT_ID *object_id);
|
||||
bool bacnet_discover_device_object_identifier(
|
||||
uint32_t device_id, unsigned index, BACNET_OBJECT_ID *object_id);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned long bacnet_discover_device_elapsed_milliseconds(
|
||||
uint32_t device_id);
|
||||
unsigned long bacnet_discover_device_elapsed_milliseconds(uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
size_t bacnet_discover_device_memory(
|
||||
uint32_t device_id);
|
||||
size_t bacnet_discover_device_memory(uint32_t device_id);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned int bacnet_discover_object_property_count(
|
||||
uint32_t device_id,
|
||||
@@ -68,13 +69,15 @@ bool bacnet_discover_object_property_identifier(
|
||||
unsigned index,
|
||||
uint32_t *property_id);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_discover_property_value(uint32_t device_id,
|
||||
bool bacnet_discover_property_value(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_discover_property_name(uint32_t device_id,
|
||||
bool bacnet_discover_property_name(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -87,11 +90,13 @@ bool bacnet_discover_device_object_property_iterate(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
bacnet_discover_device_callback callback, void *context);
|
||||
bacnet_discover_device_callback callback,
|
||||
void *context);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_discover_device_object_iterate(
|
||||
uint32_t device_id,
|
||||
bacnet_discover_device_callback callback, void *context);
|
||||
bacnet_discover_device_callback callback,
|
||||
void *context);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_discover_device_iterate(
|
||||
bacnet_discover_device_callback callback, void *context);
|
||||
|
||||
@@ -89,7 +89,8 @@ static BACNET_CLIENT_STATE RW_State = BACNET_CLIENT_IDLE;
|
||||
* @param error_class [in] the error class
|
||||
* @param error_code [in] the error code
|
||||
*/
|
||||
static void MyErrorHandler(BACNET_ADDRESS *src,
|
||||
static void MyErrorHandler(
|
||||
BACNET_ADDRESS *src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code)
|
||||
@@ -127,8 +128,8 @@ static void MyAbortHandler(
|
||||
* @param invoke_id [in] the invokeID from the rejected message
|
||||
* @param reject_reason [in] the reason for the rejection
|
||||
*/
|
||||
static void MyRejectHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
static void
|
||||
MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -187,8 +188,8 @@ static void My_I_Am_Bind(
|
||||
* @param src [in] BACNET_ADDRESS of the source of the message
|
||||
* @param invoke_id [in] the invokeID from the rejected message
|
||||
*/
|
||||
static void MyWritePropertySimpleAckHandler(
|
||||
BACNET_ADDRESS *src, uint8_t invoke_id)
|
||||
static void
|
||||
MyWritePropertySimpleAckHandler(BACNET_ADDRESS *src, uint8_t invoke_id)
|
||||
{
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(invoke_id == Request_Invoke_ID)) {
|
||||
@@ -219,8 +220,9 @@ static void bacnet_read_property_ack_process(
|
||||
apdu_len = rp_data->application_data_len;
|
||||
while (apdu_len) {
|
||||
value = &Target_Decoded_Property_Value;
|
||||
len = bacapp_decode_known_property(apdu, (unsigned)apdu_len, value,
|
||||
rp_data->object_type, rp_data->object_property);
|
||||
len = bacapp_decode_known_property(
|
||||
apdu, (unsigned)apdu_len, value, rp_data->object_type,
|
||||
rp_data->object_property);
|
||||
if (len > 0) {
|
||||
if ((len < apdu_len) &&
|
||||
(rp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
@@ -268,7 +270,8 @@ static void bacnet_read_property_ack_process(
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
static void My_Read_Property_Ack_Handler(uint8_t *service_request,
|
||||
static void My_Read_Property_Ack_Handler(
|
||||
uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
@@ -303,7 +306,8 @@ static void My_Read_Property_Ack_Handler(uint8_t *service_request,
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
static void My_Read_Property_Multiple_Ack_Handler(uint8_t *apdu,
|
||||
static void My_Read_Property_Multiple_Ack_Handler(
|
||||
uint8_t *apdu,
|
||||
uint16_t apdu_len,
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
|
||||
@@ -315,8 +319,8 @@ static void My_Read_Property_Multiple_Ack_Handler(uint8_t *apdu,
|
||||
if (address_match(&Target_Address, src) &&
|
||||
(service_data->invoke_id == Request_Invoke_ID)) {
|
||||
rp_data.error_code = ERROR_CODE_SUCCESS;
|
||||
rpm_ack_object_property_process(apdu, apdu_len,
|
||||
device_id, &rp_data,
|
||||
rpm_ack_object_property_process(
|
||||
apdu, apdu_len, device_id, &rp_data,
|
||||
bacnet_read_property_ack_process);
|
||||
}
|
||||
}
|
||||
@@ -328,7 +332,8 @@ static void My_Read_Property_Multiple_Ack_Handler(uint8_t *apdu,
|
||||
* @param object_instance [in] The contents of the service request.
|
||||
* @return invoke_id of request
|
||||
*/
|
||||
static uint8_t Send_RPM_All_Request(uint32_t device_id,
|
||||
static uint8_t Send_RPM_All_Request(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance)
|
||||
{
|
||||
@@ -450,13 +455,14 @@ static bool bacnet_read_write_process(const TARGET_DATA *target)
|
||||
}
|
||||
} else {
|
||||
if (target->object_property == PROP_ALL) {
|
||||
Request_Invoke_ID = Send_RPM_All_Request(target->device_id,
|
||||
target->object_type, target->object_instance);
|
||||
Request_Invoke_ID = Send_RPM_All_Request(
|
||||
target->device_id, target->object_type,
|
||||
target->object_instance);
|
||||
} else {
|
||||
Request_Invoke_ID =
|
||||
Send_Read_Property_Request(target->device_id,
|
||||
target->object_type, target->object_instance,
|
||||
target->object_property, target->array_index);
|
||||
Request_Invoke_ID = Send_Read_Property_Request(
|
||||
target->device_id, target->object_type,
|
||||
target->object_instance, target->object_property,
|
||||
target->array_index);
|
||||
}
|
||||
}
|
||||
if (Request_Invoke_ID == 0) {
|
||||
@@ -564,7 +570,8 @@ void bacnet_read_write_task(void)
|
||||
* - BACNET_ARRAY_ALL (~0) for the full array to be read.
|
||||
* @return true if added, false if not added
|
||||
*/
|
||||
bool bacnet_read_property_queue(uint32_t device_id,
|
||||
bool bacnet_read_property_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -599,7 +606,8 @@ bool bacnet_read_property_queue(uint32_t device_id,
|
||||
* - BACNET_ARRAY_ALL (~0) for the full array to be read.
|
||||
* @return true if added, false if not added
|
||||
*/
|
||||
bool bacnet_write_property_real_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_real_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -639,7 +647,8 @@ bool bacnet_write_property_real_queue(uint32_t device_id,
|
||||
* - BACNET_ARRAY_ALL (~0) for the full array to be read.
|
||||
* @return true if added, false if not added
|
||||
*/
|
||||
bool bacnet_write_property_null_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_null_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -677,7 +686,8 @@ bool bacnet_write_property_null_queue(uint32_t device_id,
|
||||
* - BACNET_ARRAY_ALL (~0) for the full array to be read.
|
||||
* @return true if added, false if not added
|
||||
*/
|
||||
bool bacnet_write_property_enumerated_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_enumerated_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -717,7 +727,8 @@ bool bacnet_write_property_enumerated_queue(uint32_t device_id,
|
||||
* - BACNET_ARRAY_ALL (~0) for the full array to be read.
|
||||
* @return true if added, false if not added
|
||||
*/
|
||||
bool bacnet_write_property_unsigned_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_unsigned_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -757,7 +768,8 @@ bool bacnet_write_property_unsigned_queue(uint32_t device_id,
|
||||
* - BACNET_ARRAY_ALL (~0) for the full array to be read.
|
||||
* @return true if added, false if not added
|
||||
*/
|
||||
bool bacnet_write_property_signed_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_signed_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -797,7 +809,8 @@ bool bacnet_write_property_signed_queue(uint32_t device_id,
|
||||
* - BACNET_ARRAY_ALL (~0) for the full array to be read.
|
||||
* @return true if added, false if not added
|
||||
*/
|
||||
bool bacnet_write_property_boolean_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_boolean_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -865,14 +878,16 @@ uint16_t bacnet_read_write_vendor_id_filter(void)
|
||||
*/
|
||||
void bacnet_read_write_init(void)
|
||||
{
|
||||
Ringbuf_Init(&Target_Data_Queue, (uint8_t *)&Target_Data_Buffer,
|
||||
Ringbuf_Init(
|
||||
&Target_Data_Queue, (uint8_t *)&Target_Data_Buffer,
|
||||
TARGET_DATA_QUEUE_SIZE, TARGET_DATA_QUEUE_COUNT);
|
||||
/* handle i-am to support binding to other devices */
|
||||
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, My_I_Am_Bind);
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, My_Read_Property_Ack_Handler);
|
||||
apdu_set_confirmed_ack_handler(SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
|
||||
My_Read_Property_Multiple_Ack_Handler);
|
||||
/* handle the Simple ACK coming back */
|
||||
apdu_set_confirmed_simple_ack_handler(
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
* @param value [in] pointer to the BACNET_APPLICATION_DATA_VALUE structure
|
||||
* which is packed with the decoded value from the ReadProperty request.
|
||||
*/
|
||||
typedef void (*bacnet_read_write_value_callback_t)(uint32_t device_instance,
|
||||
typedef void (*bacnet_read_write_value_callback_t)(
|
||||
uint32_t device_instance,
|
||||
BACNET_READ_PROPERTY_DATA *rp_data,
|
||||
BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
@@ -35,7 +36,8 @@ typedef void (*bacnet_read_write_value_callback_t)(uint32_t device_instance,
|
||||
* @param segmentation [in] segmentation flag
|
||||
* @param vendor_id [in] vendor identifier
|
||||
*/
|
||||
typedef void (*bacnet_read_write_device_callback_t)(uint32_t device_instance,
|
||||
typedef void (*bacnet_read_write_device_callback_t)(
|
||||
uint32_t device_instance,
|
||||
unsigned max_apdu,
|
||||
int segmentation,
|
||||
uint16_t vendor_id);
|
||||
@@ -53,13 +55,15 @@ bool bacnet_read_write_idle(void);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_read_write_busy(void);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_read_property_queue(uint32_t device_id,
|
||||
bool bacnet_read_property_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
uint32_t array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_write_property_real_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_real_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -67,14 +71,16 @@ bool bacnet_write_property_real_queue(uint32_t device_id,
|
||||
uint8_t priority,
|
||||
uint32_t array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_write_property_null_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_null_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
uint8_t priority,
|
||||
uint32_t array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_write_property_enumerated_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_enumerated_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -82,7 +88,8 @@ bool bacnet_write_property_enumerated_queue(uint32_t device_id,
|
||||
uint8_t priority,
|
||||
uint32_t array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_write_property_unsigned_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_unsigned_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -90,7 +97,8 @@ bool bacnet_write_property_unsigned_queue(uint32_t device_id,
|
||||
uint8_t priority,
|
||||
uint32_t array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_write_property_signed_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_signed_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -98,7 +106,8 @@ bool bacnet_write_property_signed_queue(uint32_t device_id,
|
||||
uint8_t priority,
|
||||
uint32_t array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacnet_write_property_boolean_queue(uint32_t device_id,
|
||||
bool bacnet_write_property_boolean_queue(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
|
||||
@@ -100,7 +100,8 @@ void bacnet_task_init(void)
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_PROP_MULTIPLE, handler_read_property_multiple);
|
||||
/* handle communication so we can shutup when asked */
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
handler_device_communication_control);
|
||||
bacnet_data_init();
|
||||
mstimer_set(&BACnet_Task_Timer, 1000);
|
||||
|
||||
@@ -21,52 +21,37 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_handler(
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t * pdu,
|
||||
uint16_t pdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_handler(BACNET_ADDRESS *src, uint8_t *pdu, uint16_t pdu_len);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t npdu_network_number(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_network_number_set(uint16_t net);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_send_network_number_is(
|
||||
BACNET_ADDRESS *dst,
|
||||
uint16_t net,
|
||||
uint8_t status);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_send_what_is_network_number(
|
||||
BACNET_ADDRESS *dst);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t npdu_network_number(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_network_number_set(uint16_t net);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_send_network_number_is(
|
||||
BACNET_ADDRESS *dst, uint16_t net, uint8_t status);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_send_what_is_network_number(BACNET_ADDRESS *dst);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_handler_cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_handler_init(
|
||||
uint16_t bip_net,
|
||||
uint16_t mstp_net);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_router_handler(
|
||||
uint16_t snet,
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t * pdu,
|
||||
uint16_t pdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_router_send_pdu(
|
||||
uint16_t dnet,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * npdu_data,
|
||||
uint8_t * pdu,
|
||||
unsigned int pdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_router_get_my_address(
|
||||
uint16_t dnet,
|
||||
BACNET_ADDRESS * my_address);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_send_reject_message_to_network(
|
||||
BACNET_ADDRESS *dst,
|
||||
uint16_t net);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_handler_cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_handler_init(uint16_t bip_net, uint16_t mstp_net);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_router_handler(
|
||||
uint16_t snet, BACNET_ADDRESS *src, uint8_t *pdu, uint16_t pdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_router_send_pdu(
|
||||
uint16_t dnet,
|
||||
BACNET_ADDRESS *dest,
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
uint8_t *pdu,
|
||||
unsigned int pdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
void npdu_router_get_my_address(uint16_t dnet, BACNET_ADDRESS *my_address);
|
||||
BACNET_STACK_EXPORT
|
||||
int npdu_send_reject_message_to_network(BACNET_ADDRESS *dst, uint16_t net);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
* bytes that have already been decoded.
|
||||
* @param npdu_len [in] The length of the remaining NPDU message in npdu[].
|
||||
*/
|
||||
static void network_control_handler(BACNET_ADDRESS *src,
|
||||
static void network_control_handler(
|
||||
BACNET_ADDRESS *src,
|
||||
int *DNET_list,
|
||||
BACNET_NPDU_DATA *npdu_data,
|
||||
uint8_t *npdu,
|
||||
@@ -86,7 +87,8 @@ static void network_control_handler(BACNET_ADDRESS *src,
|
||||
* -- Unless we act upon NETWORK_MESSAGE_ROUTER_BUSY_TO_NETWORK
|
||||
* later for congestion control - then it could matter.
|
||||
*/
|
||||
debug_printf("%s for Networks: ",
|
||||
debug_printf(
|
||||
"%s for Networks: ",
|
||||
bactext_network_layer_msg_name(
|
||||
NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK));
|
||||
while (npdu_len >= 2) {
|
||||
@@ -106,7 +108,8 @@ static void network_control_handler(BACNET_ADDRESS *src,
|
||||
case NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK:
|
||||
if (npdu_len >= 3) {
|
||||
decode_unsigned16(&npdu[1], &dnet);
|
||||
debug_printf("Received %s for Network: ",
|
||||
debug_printf(
|
||||
"Received %s for Network: ",
|
||||
bactext_network_layer_msg_name(
|
||||
NETWORK_MESSAGE_I_COULD_BE_ROUTER_TO_NETWORK));
|
||||
debug_printf("%hu, Reason code: %d \n", dnet, npdu[0]);
|
||||
@@ -175,7 +178,8 @@ static void network_control_handler(BACNET_ADDRESS *src,
|
||||
* @param apdu [in] The apdu portion of the request, to be processed.
|
||||
* @param apdu_len [in] The total (remaining) length of the apdu.
|
||||
*/
|
||||
static void routed_apdu_handler(BACNET_ADDRESS *src,
|
||||
static void routed_apdu_handler(
|
||||
BACNET_ADDRESS *src,
|
||||
BACNET_ADDRESS *dest,
|
||||
int *DNET_list,
|
||||
uint8_t *apdu,
|
||||
@@ -269,8 +273,9 @@ void routing_npdu_handler(
|
||||
debug_printf("NPDU: Decoding failed; Discarded!\n");
|
||||
} else if (npdu_data.network_layer_message) {
|
||||
if ((dest.net == 0) || (dest.net == BACNET_BROADCAST_NETWORK)) {
|
||||
network_control_handler(src, DNET_list, &npdu_data,
|
||||
&pdu[apdu_offset], (uint16_t)(pdu_len - apdu_offset));
|
||||
network_control_handler(
|
||||
src, DNET_list, &npdu_data, &pdu[apdu_offset],
|
||||
(uint16_t)(pdu_len - apdu_offset));
|
||||
} else {
|
||||
debug_printf("NPDU: message for our router? Discarded!\n");
|
||||
/* The DNET is set, but we don't support downstream routers,
|
||||
@@ -279,7 +284,8 @@ void routing_npdu_handler(
|
||||
}
|
||||
} else if (apdu_offset <= pdu_len) {
|
||||
if ((dest.net == 0) || (npdu_data.hop_count > 1)) {
|
||||
routed_apdu_handler(src, &dest, DNET_list, &pdu[apdu_offset],
|
||||
routed_apdu_handler(
|
||||
src, &dest, DNET_list, &pdu[apdu_offset],
|
||||
(uint16_t)(pdu_len - apdu_offset));
|
||||
}
|
||||
/* Else, hop_count bottomed out and we discard this one. */
|
||||
|
||||
@@ -20,12 +20,9 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void routing_npdu_handler(
|
||||
BACNET_ADDRESS * src,
|
||||
int *DNET_list,
|
||||
uint8_t * pdu,
|
||||
uint16_t pdu_len);
|
||||
BACNET_STACK_EXPORT
|
||||
void routing_npdu_handler(
|
||||
BACNET_ADDRESS *src, int *DNET_list, uint8_t *pdu, uint16_t pdu_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
* the type of message.
|
||||
* @return Number of bytes sent, or <=0 if no message was sent.
|
||||
*/
|
||||
int Send_Network_Layer_Message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
int Send_Network_Layer_Message(
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
BACNET_ADDRESS *dst,
|
||||
const int *iArgs)
|
||||
{
|
||||
@@ -69,8 +70,9 @@ int Send_Network_Layer_Message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
if (network_message_type == NETWORK_MESSAGE_INIT_RT_TABLE) {
|
||||
data_expecting_reply = true; /* DER in this one case */
|
||||
}
|
||||
npdu_encode_npdu_network(&npdu_data, network_message_type,
|
||||
data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
|
||||
npdu_encode_npdu_network(
|
||||
&npdu_data, network_message_type, data_expecting_reply,
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
/* We don't need src information, since a message can't originate from
|
||||
* our downstream BACnet network.
|
||||
@@ -152,16 +154,19 @@ int Send_Network_Layer_Message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
break;
|
||||
|
||||
default:
|
||||
debug_printf("Not sent: %s message unsupported \n",
|
||||
debug_printf(
|
||||
"Not sent: %s message unsupported \n",
|
||||
bactext_network_layer_msg_name(network_message_type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dst != NULL) {
|
||||
debug_printf("Sending %s message to BACnet network %u \n",
|
||||
debug_printf(
|
||||
"Sending %s message to BACnet network %u \n",
|
||||
bactext_network_layer_msg_name(network_message_type), dst->net);
|
||||
} else {
|
||||
debug_printf("Sending %s message to local BACnet network \n",
|
||||
debug_printf(
|
||||
"Sending %s message to local BACnet network \n",
|
||||
bactext_network_layer_msg_name(network_message_type));
|
||||
}
|
||||
|
||||
@@ -171,7 +176,8 @@ int Send_Network_Layer_Message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
#if PRINT_ENABLED
|
||||
if (bytes_sent <= 0) {
|
||||
int wasErrno = errno; /* preserve the errno */
|
||||
debug_printf("Failed to send %s message (%s)!\n",
|
||||
debug_printf(
|
||||
"Failed to send %s message (%s)!\n",
|
||||
bactext_network_layer_msg_name(network_message_type),
|
||||
strerror(wasErrno));
|
||||
}
|
||||
@@ -252,8 +258,7 @@ void Send_Reject_Message_To_Network(
|
||||
void Send_Initialize_Routing_Table(BACNET_ADDRESS *dst, const int DNET_list[])
|
||||
{
|
||||
/* Use a NULL dst here since we want a broadcast MAC address. */
|
||||
Send_Network_Layer_Message(
|
||||
NETWORK_MESSAGE_INIT_RT_TABLE, dst, DNET_list);
|
||||
Send_Network_Layer_Message(NETWORK_MESSAGE_INIT_RT_TABLE, dst, DNET_list);
|
||||
}
|
||||
|
||||
/** Sends our Routing Table, built from our DNET[] array, as an ACK.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
* @author Steve Karg
|
||||
* @date October 2019
|
||||
* @brief Header file for a basic WritePropertyMultiple service send
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
*/
|
||||
* @file
|
||||
* @author Steve Karg
|
||||
* @date October 2019
|
||||
* @brief Header file for a basic WritePropertyMultiple service send
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#ifndef BACNET_BASIC_NPDU_SEND_ROUTER_H
|
||||
#define BACNET_BASIC_NPDU_SEND_ROUTER_H
|
||||
#include <stddef.h>
|
||||
@@ -21,36 +21,25 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Send_Network_Layer_Message(
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
BACNET_ADDRESS * dst,
|
||||
const int *iArgs);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Who_Is_Router_To_Network(
|
||||
BACNET_ADDRESS * dst,
|
||||
int dnet);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_I_Am_Router_To_Network(
|
||||
const int DNET_list[]);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Reject_Message_To_Network(
|
||||
BACNET_ADDRESS * dst,
|
||||
uint8_t reject_reason,
|
||||
int dnet);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Initialize_Routing_Table(
|
||||
BACNET_ADDRESS * dst,
|
||||
const int DNET_list[]);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Initialize_Routing_Table_Ack(
|
||||
BACNET_ADDRESS * dst,
|
||||
const int DNET_list[]);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Network_Number_Is(
|
||||
BACNET_ADDRESS *dst,
|
||||
int dnet,
|
||||
int status);
|
||||
BACNET_STACK_EXPORT
|
||||
int Send_Network_Layer_Message(
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type,
|
||||
BACNET_ADDRESS *dst,
|
||||
const int *iArgs);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Who_Is_Router_To_Network(BACNET_ADDRESS *dst, int dnet);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_I_Am_Router_To_Network(const int DNET_list[]);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Reject_Message_To_Network(
|
||||
BACNET_ADDRESS *dst, uint8_t reject_reason, int dnet);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Initialize_Routing_Table(BACNET_ADDRESS *dst, const int DNET_list[]);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Initialize_Routing_Table_Ack(
|
||||
BACNET_ADDRESS *dst, const int DNET_list[]);
|
||||
BACNET_STACK_EXPORT
|
||||
void Send_Network_Number_Is(BACNET_ADDRESS *dst, int dnet, int status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -27,9 +27,16 @@ static struct object_data Object_List[MAX_ACCUMULATORS];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_OUT_OF_SERVICE, PROP_SCALE, PROP_UNITS,
|
||||
PROP_MAX_PRES_VALUE, -1 };
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_SCALE,
|
||||
PROP_UNITS,
|
||||
PROP_MAX_PRES_VALUE,
|
||||
-1 };
|
||||
|
||||
static const int Properties_Optional[] = { PROP_DESCRIPTION, -1 };
|
||||
|
||||
@@ -138,8 +145,9 @@ bool Accumulator_Object_Name(
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCUMULATORS) {
|
||||
snprintf(text, sizeof(text),
|
||||
"ACCUMULATOR-%lu", (unsigned long)object_instance);
|
||||
snprintf(
|
||||
text, sizeof(text), "ACCUMULATOR-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
|
||||
@@ -314,7 +322,8 @@ int Accumulator_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
break;
|
||||
case PROP_SCALE:
|
||||
/* context tagged choice: [0]=REAL, [1]=INTEGER */
|
||||
apdu_len = encode_context_signed(&apdu[apdu_len], 1,
|
||||
apdu_len = encode_context_signed(
|
||||
&apdu[apdu_len], 1,
|
||||
Accumulator_Scale_Integer(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_MAX_PRES_VALUE:
|
||||
|
||||
@@ -20,95 +20,71 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
BACNET_STACK_EXPORT
|
||||
void Accumulator_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Accumulator_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Accumulator_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Accumulator_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Accumulator_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Accumulator_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Accumulator_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Accumulator_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Accumulator_Name(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
char *Accumulator_Name(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Accumulator_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Description_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
char *Accumulator_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Units_Set(uint32_t instance, uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Accumulator_Units(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Units_Set(
|
||||
uint32_t instance,
|
||||
uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Accumulator_Units(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
int Accumulator_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Accumulator_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_UNSIGNED_INTEGER Accumulator_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Present_Value_Set(
|
||||
uint32_t object_instance, BACNET_UNSIGNED_INTEGER value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_UNSIGNED_INTEGER Accumulator_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_UNSIGNED_INTEGER Accumulator_Max_Pres_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Max_Pres_Value_Set(
|
||||
uint32_t object_instance, BACNET_UNSIGNED_INTEGER value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_UNSIGNED_INTEGER Accumulator_Max_Pres_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Max_Pres_Value_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER value);
|
||||
BACNET_STACK_EXPORT
|
||||
int32_t Accumulator_Scale_Integer(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Scale_Integer_Set(uint32_t object_instance, int32_t);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int32_t Accumulator_Scale_Integer(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Accumulator_Scale_Integer_Set(uint32_t object_instance, int32_t);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Accumulator_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Accumulator_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#define ACCUMULATOR_OBJ_FUNCTIONS \
|
||||
OBJECT_ACCUMULATOR, Accumulator_Init, Accumulator_Count, \
|
||||
Accumulator_Index_To_Instance, Accumulator_Valid_Instance, \
|
||||
Accumulator_Name, Accumulator_Read_Property, Accumulator_Write_Property, \
|
||||
Accumulator_Property_Lists, NULL, NULL
|
||||
#define ACCUMULATOR_OBJ_FUNCTIONS \
|
||||
OBJECT_ACCUMULATOR, Accumulator_Init, Accumulator_Count, \
|
||||
Accumulator_Index_To_Instance, Accumulator_Valid_Instance, \
|
||||
Accumulator_Name, Accumulator_Read_Property, \
|
||||
Accumulator_Write_Property, Accumulator_Property_Lists, NULL, NULL
|
||||
#endif
|
||||
|
||||
@@ -24,11 +24,19 @@ static ACCESS_CREDENTIAL_DESCR ac_descr[MAX_ACCESS_CREDENTIALS];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_GLOBAL_IDENTIFIER,
|
||||
PROP_STATUS_FLAGS, PROP_RELIABILITY, PROP_CREDENTIAL_STATUS,
|
||||
PROP_REASON_FOR_DISABLE, PROP_AUTHENTICATION_FACTORS, PROP_ACTIVATION_TIME,
|
||||
PROP_EXPIRATION_TIME, PROP_CREDENTIAL_DISABLE, PROP_ASSIGNED_ACCESS_RIGHTS,
|
||||
-1 };
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_GLOBAL_IDENTIFIER,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_RELIABILITY,
|
||||
PROP_CREDENTIAL_STATUS,
|
||||
PROP_REASON_FOR_DISABLE,
|
||||
PROP_AUTHENTICATION_FACTORS,
|
||||
PROP_ACTIVATION_TIME,
|
||||
PROP_EXPIRATION_TIME,
|
||||
PROP_CREDENTIAL_DISABLE,
|
||||
PROP_ASSIGNED_ACCESS_RIGHTS,
|
||||
-1 };
|
||||
|
||||
static const int Properties_Optional[] = { -1 };
|
||||
|
||||
@@ -123,7 +131,8 @@ bool Access_Credential_Object_Name(
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_CREDENTIALS) {
|
||||
snprintf(text, sizeof(text), "ACCESS CREDENTIAL %lu",
|
||||
snprintf(
|
||||
text, sizeof(text), "ACCESS CREDENTIAL %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
@@ -250,8 +259,8 @@ int Access_Credential_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
}
|
||||
break;
|
||||
case PROP_AUTHENTICATION_FACTORS:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index,
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Access_Credential_Authentication_Factor_Array_Encode,
|
||||
ac_descr[object_index].auth_factors_count, apdu, apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
@@ -275,10 +284,11 @@ int Access_Credential_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
&apdu[0], ac_descr[object_index].credential_disable);
|
||||
break;
|
||||
case PROP_ASSIGNED_ACCESS_RIGHTS:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index,
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Access_Credential_Assigned_Access_Rights_Array_Encode,
|
||||
ac_descr[object_index].assigned_access_rights_count, apdu, apdu_size);
|
||||
ac_descr[object_index].assigned_access_rights_count, apdu,
|
||||
apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
rpdata->error_code =
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/wp.h"
|
||||
|
||||
|
||||
#ifndef MAX_ACCESS_CREDENTIALS
|
||||
#define MAX_ACCESS_CREDENTIALS 4
|
||||
#endif
|
||||
@@ -42,73 +41,56 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool credential_status;
|
||||
uint32_t reasons_count;
|
||||
BACNET_ACCESS_CREDENTIAL_DISABLE_REASON
|
||||
reason_for_disable[MAX_REASONS_FOR_DISABLE];
|
||||
uint32_t auth_factors_count;
|
||||
BACNET_CREDENTIAL_AUTHENTICATION_FACTOR
|
||||
auth_factors[MAX_AUTHENTICATION_FACTORS];
|
||||
BACNET_DATE_TIME activation_time, expiration_time;
|
||||
BACNET_ACCESS_CREDENTIAL_DISABLE credential_disable;
|
||||
uint32_t assigned_access_rights_count;
|
||||
BACNET_ASSIGNED_ACCESS_RIGHTS
|
||||
assigned_access_rights[MAX_ASSIGNED_ACCESS_RIGHTS];
|
||||
} ACCESS_CREDENTIAL_DESCR;
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool credential_status;
|
||||
uint32_t reasons_count;
|
||||
BACNET_ACCESS_CREDENTIAL_DISABLE_REASON
|
||||
reason_for_disable[MAX_REASONS_FOR_DISABLE];
|
||||
uint32_t auth_factors_count;
|
||||
BACNET_CREDENTIAL_AUTHENTICATION_FACTOR
|
||||
auth_factors[MAX_AUTHENTICATION_FACTORS];
|
||||
BACNET_DATE_TIME activation_time, expiration_time;
|
||||
BACNET_ACCESS_CREDENTIAL_DISABLE credential_disable;
|
||||
uint32_t assigned_access_rights_count;
|
||||
BACNET_ASSIGNED_ACCESS_RIGHTS
|
||||
assigned_access_rights[MAX_ASSIGNED_ACCESS_RIGHTS];
|
||||
} ACCESS_CREDENTIAL_DESCR;
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Credential_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Credential_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Credential_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Credential_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Credential_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Credential_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Credential_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Credential_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Credential_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Credential_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Credential_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Credential_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Credential_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Credential_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Credential_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Credential_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Credential_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -23,14 +23,25 @@ static ACCESS_DOOR_DESCR ad_descr[MAX_ACCESS_DOORS];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_RELIABILITY, PROP_OUT_OF_SERVICE,
|
||||
PROP_PRIORITY_ARRAY, PROP_RELINQUISH_DEFAULT, PROP_DOOR_PULSE_TIME,
|
||||
PROP_DOOR_EXTENDED_PULSE_TIME, PROP_DOOR_OPEN_TOO_LONG_TIME, -1 };
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE,
|
||||
PROP_RELIABILITY,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_PRIORITY_ARRAY,
|
||||
PROP_RELINQUISH_DEFAULT,
|
||||
PROP_DOOR_PULSE_TIME,
|
||||
PROP_DOOR_EXTENDED_PULSE_TIME,
|
||||
PROP_DOOR_OPEN_TOO_LONG_TIME,
|
||||
-1 };
|
||||
|
||||
static const int Properties_Optional[] = { PROP_DOOR_STATUS, PROP_LOCK_STATUS,
|
||||
PROP_SECURED_STATUS, PROP_DOOR_UNLOCK_DELAY_TIME, PROP_DOOR_ALARM_STATE,
|
||||
-1 };
|
||||
static const int Properties_Optional[] = {
|
||||
PROP_DOOR_STATUS, PROP_LOCK_STATUS,
|
||||
PROP_SECURED_STATUS, PROP_DOOR_UNLOCK_DELAY_TIME,
|
||||
PROP_DOOR_ALARM_STATE, -1
|
||||
};
|
||||
|
||||
static const int Properties_Proprietary[] = { -1 };
|
||||
|
||||
@@ -260,7 +271,8 @@ bool Access_Door_Object_Name(
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_DOORS) {
|
||||
snprintf(text, sizeof(text), "ACCESS DOOR %lu",
|
||||
snprintf(
|
||||
text, sizeof(text), "ACCESS DOOR %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
@@ -349,9 +361,10 @@ int Access_Door_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_boolean(&apdu[0], state);
|
||||
break;
|
||||
case PROP_PRIORITY_ARRAY:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index, Access_Door_Priority_Array_Encode,
|
||||
BACNET_MAX_PRIORITY, apdu, apdu_size);
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Access_Door_Priority_Array_Encode, BACNET_MAX_PRIORITY, apdu,
|
||||
apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
rpdata->error_code =
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||
@@ -361,7 +374,8 @@ int Access_Door_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
}
|
||||
break;
|
||||
case PROP_RELINQUISH_DEFAULT:
|
||||
apdu_len = encode_application_enumerated(&apdu[0],
|
||||
apdu_len = encode_application_enumerated(
|
||||
&apdu[0],
|
||||
Access_Door_Relinquish_Default(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_DOOR_STATUS:
|
||||
@@ -447,7 +461,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||
algorithm and may not be used for other purposes in any
|
||||
object. */
|
||||
status = Access_Door_Present_Value_Set(wp_data->object_instance,
|
||||
status = Access_Door_Present_Value_Set(
|
||||
wp_data->object_instance,
|
||||
(BACNET_DOOR_VALUE)value.type.Enumerated,
|
||||
wp_data->priority);
|
||||
if (wp_data->priority == 6) {
|
||||
|
||||
@@ -17,131 +17,96 @@
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/wp.h"
|
||||
|
||||
|
||||
#ifndef MAX_ACCESS_DOORS
|
||||
#define MAX_ACCESS_DOORS 4
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
bool value_active[BACNET_MAX_PRIORITY];
|
||||
BACNET_DOOR_VALUE priority_array[BACNET_MAX_PRIORITY];
|
||||
BACNET_DOOR_VALUE relinquish_default;
|
||||
BACNET_EVENT_STATE event_state;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool out_of_service;
|
||||
BACNET_DOOR_STATUS door_status;
|
||||
BACNET_LOCK_STATUS lock_status;
|
||||
BACNET_DOOR_SECURED_STATUS secured_status;
|
||||
uint32_t door_pulse_time, door_extended_pulse_time,
|
||||
door_unlock_delay_time, door_open_too_long_time;
|
||||
BACNET_DOOR_ALARM_STATE door_alarm_state;
|
||||
} ACCESS_DOOR_DESCR;
|
||||
typedef struct {
|
||||
bool value_active[BACNET_MAX_PRIORITY];
|
||||
BACNET_DOOR_VALUE priority_array[BACNET_MAX_PRIORITY];
|
||||
BACNET_DOOR_VALUE relinquish_default;
|
||||
BACNET_EVENT_STATE event_state;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool out_of_service;
|
||||
BACNET_DOOR_STATUS door_status;
|
||||
BACNET_LOCK_STATUS lock_status;
|
||||
BACNET_DOOR_SECURED_STATUS secured_status;
|
||||
uint32_t door_pulse_time, door_extended_pulse_time, door_unlock_delay_time,
|
||||
door_open_too_long_time;
|
||||
BACNET_DOOR_ALARM_STATE door_alarm_state;
|
||||
} ACCESS_DOOR_DESCR;
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Door_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Door_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Door_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Door_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Door_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Door_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_DOOR_VALUE Access_Door_Present_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Door_Present_Value_Priority(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_DOOR_VALUE value,
|
||||
unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Present_Value_Relinquish(
|
||||
uint32_t object_instance,
|
||||
unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_DOOR_VALUE Access_Door_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Door_Present_Value_Priority(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Present_Value_Set(
|
||||
uint32_t object_instance, BACNET_DOOR_VALUE value, unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Present_Value_Relinquish(
|
||||
uint32_t object_instance, unsigned priority);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_DOOR_VALUE Access_Door_Relinquish_Default(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Relinquish_Default_Set(
|
||||
uint32_t object_instance,
|
||||
float value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_DOOR_VALUE Access_Door_Relinquish_Default(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Relinquish_Default_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Change_Of_Value_Clear(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Access_Door_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Description_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
char *Access_Door_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Out_Of_Service_Set(
|
||||
uint32_t instance,
|
||||
bool oos_flag);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Out_Of_Service_Set(uint32_t instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Door_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Door_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Door_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Door_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Door_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Door_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -22,13 +22,26 @@ static bool Access_Point_Initialized = false;
|
||||
static ACCESS_POINT_DESCR ap_descr[MAX_ACCESS_POINTS];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_STATUS_FLAGS, PROP_EVENT_STATE,
|
||||
PROP_RELIABILITY, PROP_OUT_OF_SERVICE, PROP_AUTHENTICATION_STATUS,
|
||||
PROP_ACTIVE_AUTHENTICATION_POLICY, PROP_NUMBER_OF_AUTHENTICATION_POLICIES,
|
||||
PROP_AUTHORIZATION_MODE, PROP_ACCESS_EVENT, PROP_ACCESS_EVENT_TAG,
|
||||
PROP_ACCESS_EVENT_TIME, PROP_ACCESS_EVENT_CREDENTIAL, PROP_ACCESS_DOORS,
|
||||
PROP_PRIORITY_FOR_WRITING, -1 };
|
||||
static const int Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE,
|
||||
PROP_RELIABILITY,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_AUTHENTICATION_STATUS,
|
||||
PROP_ACTIVE_AUTHENTICATION_POLICY,
|
||||
PROP_NUMBER_OF_AUTHENTICATION_POLICIES,
|
||||
PROP_AUTHORIZATION_MODE,
|
||||
PROP_ACCESS_EVENT,
|
||||
PROP_ACCESS_EVENT_TAG,
|
||||
PROP_ACCESS_EVENT_TIME,
|
||||
PROP_ACCESS_EVENT_CREDENTIAL,
|
||||
PROP_ACCESS_DOORS,
|
||||
PROP_PRIORITY_FOR_WRITING,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Properties_Optional[] = { -1 };
|
||||
|
||||
@@ -126,7 +139,8 @@ bool Access_Point_Object_Name(
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_POINTS) {
|
||||
snprintf(text, sizeof(text), "ACCESS POINT %lu",
|
||||
snprintf(
|
||||
text, sizeof(text), "ACCESS POINT %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
@@ -219,7 +233,8 @@ int Access_Point_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
&apdu[0], ap_descr[object_index].active_authentication_policy);
|
||||
break;
|
||||
case PROP_NUMBER_OF_AUTHENTICATION_POLICIES:
|
||||
apdu_len = encode_application_unsigned(&apdu[0],
|
||||
apdu_len = encode_application_unsigned(
|
||||
&apdu[0],
|
||||
ap_descr[object_index].number_of_authentication_policies);
|
||||
break;
|
||||
case PROP_AUTHORIZATION_MODE:
|
||||
@@ -261,7 +276,8 @@ int Access_Point_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
}
|
||||
} else {
|
||||
if (rpdata->array_index <= ap_descr[object_index].num_doors) {
|
||||
apdu_len = bacapp_encode_device_obj_ref(&apdu[0],
|
||||
apdu_len = bacapp_encode_device_obj_ref(
|
||||
&apdu[0],
|
||||
&ap_descr[object_index]
|
||||
.access_doors[rpdata->array_index - 1]);
|
||||
} else {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/wp.h"
|
||||
|
||||
|
||||
#ifndef MAX_ACCESS_POINTS
|
||||
#define MAX_ACCESS_POINTS 4
|
||||
#endif
|
||||
@@ -32,81 +31,59 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
BACNET_EVENT_STATE event_state;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool out_of_service;
|
||||
BACNET_AUTHENTICATION_STATUS authentication_status;
|
||||
uint32_t active_authentication_policy,
|
||||
number_of_authentication_policies;
|
||||
BACNET_AUTHORIZATION_MODE authorization_mode;
|
||||
BACNET_ACCESS_EVENT access_event;
|
||||
uint32_t access_event_tag;
|
||||
BACNET_TIMESTAMP access_event_time;
|
||||
BACNET_DEVICE_OBJECT_REFERENCE access_event_credential;
|
||||
uint32_t num_doors; /* helper value, not a property */
|
||||
BACNET_DEVICE_OBJECT_REFERENCE access_doors[MAX_ACCESS_DOORS_COUNT];
|
||||
uint8_t priority_for_writing;
|
||||
} ACCESS_POINT_DESCR;
|
||||
typedef struct {
|
||||
BACNET_EVENT_STATE event_state;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool out_of_service;
|
||||
BACNET_AUTHENTICATION_STATUS authentication_status;
|
||||
uint32_t active_authentication_policy, number_of_authentication_policies;
|
||||
BACNET_AUTHORIZATION_MODE authorization_mode;
|
||||
BACNET_ACCESS_EVENT access_event;
|
||||
uint32_t access_event_tag;
|
||||
BACNET_TIMESTAMP access_event_time;
|
||||
BACNET_DEVICE_OBJECT_REFERENCE access_event_credential;
|
||||
uint32_t num_doors; /* helper value, not a property */
|
||||
BACNET_DEVICE_OBJECT_REFERENCE access_doors[MAX_ACCESS_DOORS_COUNT];
|
||||
uint8_t priority_for_writing;
|
||||
} ACCESS_POINT_DESCR;
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Access_Point_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Point_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Point_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Access_Point_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Point_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Point_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Out_Of_Service_Set(uint32_t instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Point_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Out_Of_Service_Set(
|
||||
uint32_t instance,
|
||||
bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Point_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Point_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Point_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Point_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Point_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -24,9 +24,15 @@ static ACCESS_RIGHTS_DESCR ar_descr[MAX_ACCESS_RIGHTSS];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_GLOBAL_IDENTIFIER,
|
||||
PROP_STATUS_FLAGS, PROP_RELIABILITY, PROP_ENABLE,
|
||||
PROP_NEGATIVE_ACCESS_RULES, PROP_POSITIVE_ACCESS_RULES, -1 };
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_GLOBAL_IDENTIFIER,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_RELIABILITY,
|
||||
PROP_ENABLE,
|
||||
PROP_NEGATIVE_ACCESS_RULES,
|
||||
PROP_POSITIVE_ACCESS_RULES,
|
||||
-1 };
|
||||
|
||||
static const int Properties_Optional[] = { -1 };
|
||||
|
||||
@@ -118,7 +124,8 @@ bool Access_Rights_Object_Name(
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_RIGHTSS) {
|
||||
snprintf(text, sizeof(text), "ACCESS RIGHTS %lu",
|
||||
snprintf(
|
||||
text, sizeof(text), "ACCESS RIGHTS %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
@@ -179,13 +186,15 @@ int Access_Rights_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
break;
|
||||
case PROP_NEGATIVE_ACCESS_RULES:
|
||||
if (rpdata->array_index == 0) {
|
||||
apdu_len = encode_application_unsigned(&apdu[0],
|
||||
apdu_len = encode_application_unsigned(
|
||||
&apdu[0],
|
||||
ar_descr[object_index].negative_access_rules_count);
|
||||
} else if (rpdata->array_index == BACNET_ARRAY_ALL) {
|
||||
for (i = 0;
|
||||
i < ar_descr[object_index].negative_access_rules_count;
|
||||
i++) {
|
||||
len = bacapp_encode_access_rule(&apdu[0],
|
||||
len = bacapp_encode_access_rule(
|
||||
&apdu[0],
|
||||
&ar_descr[object_index].negative_access_rules[i]);
|
||||
if (apdu_len + len < MAX_APDU) {
|
||||
apdu_len += len;
|
||||
@@ -199,7 +208,8 @@ int Access_Rights_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
} else {
|
||||
if (rpdata->array_index <=
|
||||
ar_descr[object_index].negative_access_rules_count) {
|
||||
apdu_len = bacapp_encode_access_rule(&apdu[0],
|
||||
apdu_len = bacapp_encode_access_rule(
|
||||
&apdu[0],
|
||||
&ar_descr[object_index]
|
||||
.negative_access_rules[rpdata->array_index - 1]);
|
||||
} else {
|
||||
@@ -211,13 +221,15 @@ int Access_Rights_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
break;
|
||||
case PROP_POSITIVE_ACCESS_RULES:
|
||||
if (rpdata->array_index == 0) {
|
||||
apdu_len = encode_application_unsigned(&apdu[0],
|
||||
apdu_len = encode_application_unsigned(
|
||||
&apdu[0],
|
||||
ar_descr[object_index].positive_access_rules_count);
|
||||
} else if (rpdata->array_index == BACNET_ARRAY_ALL) {
|
||||
for (i = 0;
|
||||
i < ar_descr[object_index].positive_access_rules_count;
|
||||
i++) {
|
||||
len = bacapp_encode_access_rule(&apdu[0],
|
||||
len = bacapp_encode_access_rule(
|
||||
&apdu[0],
|
||||
&ar_descr[object_index].positive_access_rules[i]);
|
||||
if (apdu_len + len < MAX_APDU) {
|
||||
apdu_len += len;
|
||||
@@ -231,7 +243,8 @@ int Access_Rights_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
} else {
|
||||
if (rpdata->array_index <=
|
||||
ar_descr[object_index].positive_access_rules_count) {
|
||||
apdu_len = bacapp_encode_access_rule(&apdu[0],
|
||||
apdu_len = bacapp_encode_access_rule(
|
||||
&apdu[0],
|
||||
&ar_descr[object_index]
|
||||
.positive_access_rules[rpdata->array_index - 1]);
|
||||
} else {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/wp.h"
|
||||
|
||||
|
||||
#ifndef MAX_ACCESS_RIGHTSS
|
||||
#define MAX_ACCESS_RIGHTSS 4
|
||||
#endif
|
||||
@@ -36,65 +35,49 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool enable;
|
||||
uint32_t negative_access_rules_count, positive_access_rules_count;
|
||||
BACNET_ACCESS_RULE
|
||||
negative_access_rules[MAX_NEGATIVE_ACCESS_RIGHTS_RULES];
|
||||
BACNET_ACCESS_RULE
|
||||
positive_access_rules[MAX_POSITIVE_ACCESS_RIGHTS_RULES];
|
||||
} ACCESS_RIGHTS_DESCR;
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool enable;
|
||||
uint32_t negative_access_rules_count, positive_access_rules_count;
|
||||
BACNET_ACCESS_RULE
|
||||
negative_access_rules[MAX_NEGATIVE_ACCESS_RIGHTS_RULES];
|
||||
BACNET_ACCESS_RULE
|
||||
positive_access_rules[MAX_POSITIVE_ACCESS_RIGHTS_RULES];
|
||||
} ACCESS_RIGHTS_DESCR;
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Rights_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Access_Rights_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Rights_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Rights_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Rights_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Access_Rights_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Rights_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Rights_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Rights_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Rights_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Rights_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Rights_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Rights_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Rights_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Rights_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Rights_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Rights_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -22,9 +22,11 @@ static bool Access_User_Initialized = false;
|
||||
static ACCESS_USER_DESCR au_descr[MAX_ACCESS_USERS];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_GLOBAL_IDENTIFIER,
|
||||
PROP_STATUS_FLAGS, PROP_RELIABILITY, PROP_USER_TYPE, PROP_CREDENTIALS, -1 };
|
||||
static const int Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||
PROP_GLOBAL_IDENTIFIER, PROP_STATUS_FLAGS, PROP_RELIABILITY,
|
||||
PROP_USER_TYPE, PROP_CREDENTIALS, -1
|
||||
};
|
||||
|
||||
static const int Properties_Optional[] = { -1 };
|
||||
|
||||
@@ -115,7 +117,8 @@ bool Access_User_Object_Name(
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_USERS) {
|
||||
snprintf(text, sizeof(text), "ACCESS USER %lu",
|
||||
snprintf(
|
||||
text, sizeof(text), "ACCESS USER %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/wp.h"
|
||||
|
||||
|
||||
#ifndef MAX_ACCESS_USERS
|
||||
#define MAX_ACCESS_USERS 4
|
||||
#endif
|
||||
@@ -31,63 +30,47 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_RELIABILITY reliability;
|
||||
BACNET_ACCESS_USER_TYPE user_type;
|
||||
uint32_t credentials_count;
|
||||
BACNET_DEVICE_OBJECT_REFERENCE
|
||||
credentials[MAX_ACCESS_USER_CREDENTIALS_COUNT];
|
||||
} ACCESS_USER_DESCR;
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_RELIABILITY reliability;
|
||||
BACNET_ACCESS_USER_TYPE user_type;
|
||||
uint32_t credentials_count;
|
||||
BACNET_DEVICE_OBJECT_REFERENCE
|
||||
credentials[MAX_ACCESS_USER_CREDENTIALS_COUNT];
|
||||
} ACCESS_USER_DESCR;
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_User_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Access_User_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_User_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_User_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_User_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Access_User_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_User_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_User_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_User_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_User_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_User_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_User_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_User_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_User_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_User_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_User_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_User_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -23,10 +23,12 @@ static bool Access_Zone_Initialized = false;
|
||||
static ACCESS_ZONE_DESCR az_descr[MAX_ACCESS_ZONES];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_GLOBAL_IDENTIFIER,
|
||||
PROP_OCCUPANCY_STATE, PROP_STATUS_FLAGS, PROP_EVENT_STATE, PROP_RELIABILITY,
|
||||
PROP_OUT_OF_SERVICE, PROP_ENTRY_POINTS, PROP_EXIT_POINTS, -1 };
|
||||
static const int Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||
PROP_GLOBAL_IDENTIFIER, PROP_OCCUPANCY_STATE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_RELIABILITY, PROP_OUT_OF_SERVICE,
|
||||
PROP_ENTRY_POINTS, PROP_EXIT_POINTS, -1
|
||||
};
|
||||
|
||||
static const int Properties_Optional[] = { -1 };
|
||||
|
||||
@@ -120,7 +122,8 @@ bool Access_Zone_Object_Name(
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_ZONES) {
|
||||
snprintf(text, sizeof(text), "ACCESS ZONE %lu",
|
||||
snprintf(
|
||||
text, sizeof(text), "ACCESS ZONE %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
|
||||
@@ -34,75 +34,56 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_ACCESS_ZONE_OCCUPANCY_STATE occupancy_state;
|
||||
BACNET_EVENT_STATE event_state;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool out_of_service;
|
||||
uint32_t entry_points_count, exit_points_count;
|
||||
BACNET_DEVICE_OBJECT_REFERENCE
|
||||
entry_points[MAX_ACCESS_ZONE_ENTRY_POINTS];
|
||||
BACNET_DEVICE_OBJECT_REFERENCE
|
||||
exit_points[MAX_ACCESS_ZONE_EXIT_POINTS];
|
||||
} ACCESS_ZONE_DESCR;
|
||||
typedef struct {
|
||||
uint32_t global_identifier;
|
||||
BACNET_ACCESS_ZONE_OCCUPANCY_STATE occupancy_state;
|
||||
BACNET_EVENT_STATE event_state;
|
||||
BACNET_RELIABILITY reliability;
|
||||
bool out_of_service;
|
||||
uint32_t entry_points_count, exit_points_count;
|
||||
BACNET_DEVICE_OBJECT_REFERENCE
|
||||
entry_points[MAX_ACCESS_ZONE_ENTRY_POINTS];
|
||||
BACNET_DEVICE_OBJECT_REFERENCE
|
||||
exit_points[MAX_ACCESS_ZONE_EXIT_POINTS];
|
||||
} ACCESS_ZONE_DESCR;
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Access_Zone_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Zone_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Zone_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Access_Zone_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Zone_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Access_Zone_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Out_Of_Service_Set(
|
||||
uint32_t instance,
|
||||
bool oos_flag);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Out_Of_Service_Set(uint32_t instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Zone_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Access_Zone_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Zone_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Access_Zone_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Access_Zone_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Access_Zone_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1044,10 +1044,11 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
EVENT_HIGH_LIMIT_ENABLE) &&
|
||||
((CurrentAI->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ==
|
||||
EVENT_ENABLE_TO_OFFNORMAL)) {
|
||||
if (!CurrentAI->Remaining_Time_Delay)
|
||||
if (!CurrentAI->Remaining_Time_Delay) {
|
||||
CurrentAI->Event_State = EVENT_STATE_HIGH_LIMIT;
|
||||
else
|
||||
} else {
|
||||
CurrentAI->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* A TO-OFFNORMAL event is generated under these conditions:
|
||||
@@ -1062,10 +1063,11 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
EVENT_LOW_LIMIT_ENABLE) &&
|
||||
((CurrentAI->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ==
|
||||
EVENT_ENABLE_TO_OFFNORMAL)) {
|
||||
if (!CurrentAI->Remaining_Time_Delay)
|
||||
if (!CurrentAI->Remaining_Time_Delay) {
|
||||
CurrentAI->Event_State = EVENT_STATE_LOW_LIMIT;
|
||||
else
|
||||
} else {
|
||||
CurrentAI->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* value of the object is still in the same event state */
|
||||
@@ -1091,10 +1093,12 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
* indicate a transition to the NORMAL event state. */
|
||||
(!(CurrentAI->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE))) {
|
||||
if ((!CurrentAI->Remaining_Time_Delay) ||
|
||||
(!(CurrentAI->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE)))
|
||||
(!(CurrentAI->Limit_Enable &
|
||||
EVENT_HIGH_LIMIT_ENABLE))) {
|
||||
CurrentAI->Event_State = EVENT_STATE_NORMAL;
|
||||
else
|
||||
} else {
|
||||
CurrentAI->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* value of the object is still in the same event state */
|
||||
@@ -1121,10 +1125,11 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
* indicate a transition to the NORMAL event state. */
|
||||
(!(CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE))) {
|
||||
if ((!CurrentAI->Remaining_Time_Delay) ||
|
||||
(!(CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE)))
|
||||
(!(CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE))) {
|
||||
CurrentAI->Event_State = EVENT_STATE_NORMAL;
|
||||
else
|
||||
} else {
|
||||
CurrentAI->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* value of the object is still in the same event state */
|
||||
@@ -1239,8 +1244,9 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
/* Notify Type */
|
||||
/* filled before */
|
||||
/* From State */
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION)
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION) {
|
||||
event_data.fromState = FromState;
|
||||
}
|
||||
/* To State */
|
||||
event_data.toState = CurrentAI->Event_State;
|
||||
/* Event Values */
|
||||
@@ -1395,8 +1401,9 @@ int Analog_Input_Event_Information(
|
||||
pObject->Notification_Class, getevent_data->eventPriorities);
|
||||
|
||||
return 1; /* active event */
|
||||
} else
|
||||
} else {
|
||||
return 0; /* no active event at this index */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+86
-127
@@ -24,7 +24,7 @@
|
||||
#endif
|
||||
|
||||
typedef struct analog_input_descr {
|
||||
unsigned Event_State:3;
|
||||
unsigned Event_State : 3;
|
||||
float Present_Value;
|
||||
BACNET_RELIABILITY Reliability;
|
||||
bool Out_Of_Service;
|
||||
@@ -32,17 +32,17 @@ typedef struct analog_input_descr {
|
||||
float Prior_Value;
|
||||
float COV_Increment;
|
||||
bool Changed;
|
||||
const char* Object_Name;
|
||||
const char* Description;
|
||||
const char *Object_Name;
|
||||
const char *Description;
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
uint32_t Time_Delay;
|
||||
uint32_t Notification_Class;
|
||||
float High_Limit;
|
||||
float Low_Limit;
|
||||
float Deadband;
|
||||
unsigned Limit_Enable:2;
|
||||
unsigned Event_Enable:3;
|
||||
unsigned Notify_Type:1;
|
||||
unsigned Limit_Enable : 2;
|
||||
unsigned Event_Enable : 3;
|
||||
unsigned Notify_Type : 1;
|
||||
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
||||
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
||||
/* time to generate event notification */
|
||||
@@ -56,144 +56,103 @@ typedef struct analog_input_descr {
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Input_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Input_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Input_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Input_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Input_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Input_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char * Analog_Input_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Input_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Input_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Description_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Input_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Analog_Input_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Reliability_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Analog_Input_Reliability(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Units_Set(
|
||||
uint32_t instance,
|
||||
uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Analog_Input_Units(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Units_Set(uint32_t instance, uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Analog_Input_Units(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Input_Present_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
float value);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Input_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Present_Value_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Out_Of_Service(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Out_Of_Service_Set(
|
||||
uint32_t object_instance,
|
||||
bool oos_flag);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Out_Of_Service(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Out_Of_Service_Set(uint32_t object_instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Input_Event_State(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Event_State_Set(uint32_t object_instance, unsigned state);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Input_Event_State(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Event_State_Set(uint32_t object_instance, unsigned state);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
float Analog_Input_COV_Increment(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_COV_Increment_Set(
|
||||
uint32_t instance,
|
||||
float value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Change_Of_Value_Clear(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
float Analog_Input_COV_Increment(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_COV_Increment_Set(uint32_t instance, float value);
|
||||
|
||||
/* note: header of Intrinsic_Reporting function is required
|
||||
even when INTRINSIC_REPORTING is not defined */
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Intrinsic_Reporting(
|
||||
uint32_t object_instance);
|
||||
/* note: header of Intrinsic_Reporting function is required
|
||||
even when INTRINSIC_REPORTING is not defined */
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Intrinsic_Reporting(uint32_t object_instance);
|
||||
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Event_Information(
|
||||
unsigned index,
|
||||
BACNET_GET_EVENT_INFORMATION_DATA * getevent_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Event_Information(
|
||||
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA * alarmack_data,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA *alarmack_data, BACNET_ERROR_CODE *error_code);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Alarm_Summary(
|
||||
unsigned index,
|
||||
BACNET_GET_ALARM_SUMMARY_DATA * getalarm_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Input_Alarm_Summary(
|
||||
unsigned index, BACNET_GET_ALARM_SUMMARY_DATA *getalarm_data);
|
||||
#endif
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Input_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Input_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Input_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -57,18 +57,27 @@ static analog_output_write_present_value_callback
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
|
||||
static const int Analog_Output_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_OUT_OF_SERVICE, PROP_UNITS, PROP_PRIORITY_ARRAY,
|
||||
static const int Analog_Output_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_UNITS,
|
||||
PROP_PRIORITY_ARRAY,
|
||||
PROP_RELINQUISH_DEFAULT,
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
PROP_CURRENT_COMMAND_PRIORITY,
|
||||
#endif
|
||||
-1 };
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Analog_Output_Properties_Optional[] = { PROP_RELIABILITY,
|
||||
PROP_DESCRIPTION, PROP_COV_INCREMENT, PROP_MIN_PRES_VALUE,
|
||||
PROP_MAX_PRES_VALUE, -1 };
|
||||
static const int Analog_Output_Properties_Optional[] = {
|
||||
PROP_RELIABILITY, PROP_DESCRIPTION, PROP_COV_INCREMENT,
|
||||
PROP_MIN_PRES_VALUE, PROP_MAX_PRES_VALUE, -1
|
||||
};
|
||||
|
||||
static const int Analog_Output_Properties_Proprietary[] = { -1 };
|
||||
|
||||
@@ -278,8 +287,8 @@ bool Analog_Output_Relinquish_Default_Set(uint32_t object_instance, float value)
|
||||
* @param pObject - specific object with valid data
|
||||
* @param value - floating point analog value
|
||||
*/
|
||||
static void Analog_Output_Present_Value_COV_Detect(
|
||||
struct object_data *pObject, float value)
|
||||
static void
|
||||
Analog_Output_Present_Value_COV_Detect(struct object_data *pObject, float value)
|
||||
{
|
||||
float prior_value = 0.0;
|
||||
float cov_increment = 0.0;
|
||||
@@ -366,7 +375,8 @@ bool Analog_Output_Present_Value_Relinquish(
|
||||
* @param error_code - BACnet Error code
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Analog_Output_Present_Value_Write(uint32_t object_instance,
|
||||
static bool Analog_Output_Present_Value_Write(
|
||||
uint32_t object_instance,
|
||||
float value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -380,7 +390,8 @@ static bool Analog_Output_Present_Value_Write(uint32_t object_instance,
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
if ((priority >= 1) && (priority <= BACNET_MAX_PRIORITY) &&
|
||||
(value >= pObject->Min_Pres_Value) && (value <= pObject->Max_Pres_Value)) {
|
||||
(value >= pObject->Min_Pres_Value) &&
|
||||
(value <= pObject->Max_Pres_Value)) {
|
||||
if (priority != 6) {
|
||||
old_value = Analog_Output_Present_Value(object_instance);
|
||||
Analog_Output_Present_Value_Set(
|
||||
@@ -491,7 +502,8 @@ bool Analog_Output_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "ANALOG OUTPUT %lu",
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "ANALOG OUTPUT %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
@@ -907,8 +919,9 @@ bool Analog_Output_Encode_Value_List(
|
||||
if (pObject->Reliability != RELIABILITY_NO_FAULT_DETECTED) {
|
||||
fault = true;
|
||||
}
|
||||
status = cov_value_list_encode_real(value_list, pObject->Prior_Value,
|
||||
in_alarm, fault, overridden, pObject->Out_Of_Service);
|
||||
status = cov_value_list_encode_real(
|
||||
value_list, pObject->Prior_Value, in_alarm, fault, overridden,
|
||||
pObject->Out_Of_Service);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -1028,9 +1041,10 @@ int Analog_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_enumerated(&apdu[0], units);
|
||||
break;
|
||||
case PROP_PRIORITY_ARRAY:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index, Analog_Output_Priority_Array_Encode,
|
||||
BACNET_MAX_PRIORITY, apdu, apdu_size);
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Analog_Output_Priority_Array_Encode, BACNET_MAX_PRIORITY, apdu,
|
||||
apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
rpdata->error_code =
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||
@@ -1045,7 +1059,8 @@ int Analog_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_real(&apdu[0], real_value);
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
characterstring_init_ansi(&char_string,
|
||||
characterstring_init_ansi(
|
||||
&char_string,
|
||||
Analog_Output_Description(rpdata->object_instance));
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
@@ -1118,10 +1133,10 @@ bool Analog_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||
if (status) {
|
||||
status =
|
||||
Analog_Output_Present_Value_Write(wp_data->object_instance,
|
||||
value.type.Real, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Analog_Output_Present_Value_Write(
|
||||
wp_data->object_instance, value.type.Real,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
} else {
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||
|
||||
+91
-138
@@ -13,7 +13,7 @@
|
||||
#define BACNET_BASIC_OBJECT_ANALOG_OUTPUT_H
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "bacnet/bacdef.h" /* Must be before all other bacnet *.h files */
|
||||
#include "bacnet/bacdef.h" /* Must be before all other bacnet *.h files */
|
||||
#include "bacnet/bacerror.h"
|
||||
#include "bacnet/rp.h"
|
||||
#include "bacnet/wp.h"
|
||||
@@ -31,155 +31,108 @@ typedef void (*analog_output_write_present_value_callback)(
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Output_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Output_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Output_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Output_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Output_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Present_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
float value,
|
||||
unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Present_Value_Relinquish(
|
||||
uint32_t object_instance,
|
||||
unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Output_Present_Value_Priority(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Write_Present_Value_Callback_Set(
|
||||
analog_output_write_present_value_callback cb);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Present_Value_Set(
|
||||
uint32_t object_instance, float value, unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Present_Value_Relinquish(
|
||||
uint32_t object_instance, unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Output_Present_Value_Priority(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Write_Present_Value_Callback_Set(
|
||||
analog_output_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Relinquish_Default(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Relinquish_Default_Set(
|
||||
uint32_t object_instance,
|
||||
float value);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Relinquish_Default(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Relinquish_Default_Set(
|
||||
uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_COV_Increment(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_COV_Increment_Set(
|
||||
uint32_t instance,
|
||||
float value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Change_Of_Value_Clear(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_COV_Increment(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_COV_Increment_Set(uint32_t instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char * Analog_Output_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Output_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Output_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Description_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Output_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Units_Set(
|
||||
uint32_t instance,
|
||||
uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Analog_Output_Units(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Units_Set(uint32_t instance, uint16_t units);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Analog_Output_Units(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Out_Of_Service_Set(
|
||||
uint32_t instance,
|
||||
bool oos_flag);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Out_Of_Service_Set(uint32_t instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Overridden(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Overridden_Set(
|
||||
uint32_t instance,
|
||||
bool oos_flag);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Overridden(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Overridden_Set(uint32_t instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Analog_Output_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Analog_Output_Reliability(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Min_Pres_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Min_Pres_Value_Set(
|
||||
uint32_t object_instance, float value);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Max_Pres_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Max_Pres_Value_Set(
|
||||
uint32_t object_instance, float value);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Min_Pres_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Min_Pres_Value_Set(uint32_t object_instance, float value);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Output_Max_Pres_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Max_Pres_Value_Set(uint32_t object_instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Output_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Output_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Output_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Output_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Output_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1082,10 +1082,11 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
EVENT_HIGH_LIMIT_ENABLE) &&
|
||||
((CurrentAV->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ==
|
||||
EVENT_ENABLE_TO_OFFNORMAL)) {
|
||||
if (!CurrentAV->Remaining_Time_Delay)
|
||||
if (!CurrentAV->Remaining_Time_Delay) {
|
||||
CurrentAV->Event_State = EVENT_STATE_HIGH_LIMIT;
|
||||
else
|
||||
} else {
|
||||
CurrentAV->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1101,10 +1102,11 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
EVENT_LOW_LIMIT_ENABLE) &&
|
||||
((CurrentAV->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ==
|
||||
EVENT_ENABLE_TO_OFFNORMAL)) {
|
||||
if (!CurrentAV->Remaining_Time_Delay)
|
||||
if (!CurrentAV->Remaining_Time_Delay) {
|
||||
CurrentAV->Event_State = EVENT_STATE_LOW_LIMIT;
|
||||
else
|
||||
} else {
|
||||
CurrentAV->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* value of the object is still in the same event state */
|
||||
@@ -1131,10 +1133,12 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
* indicate a transition to the NORMAL event state. */
|
||||
(!(CurrentAV->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE))) {
|
||||
if ((!CurrentAV->Remaining_Time_Delay) ||
|
||||
(!(CurrentAV->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE)))
|
||||
(!(CurrentAV->Limit_Enable &
|
||||
EVENT_HIGH_LIMIT_ENABLE))) {
|
||||
CurrentAV->Event_State = EVENT_STATE_NORMAL;
|
||||
else
|
||||
} else {
|
||||
CurrentAV->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* value of the object is still in the same event state */
|
||||
@@ -1162,10 +1166,11 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
* indicate a transition to the NORMAL event state. */
|
||||
(!(CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE))) {
|
||||
if ((!CurrentAV->Remaining_Time_Delay) ||
|
||||
(!(CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE)))
|
||||
(!(CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE))) {
|
||||
CurrentAV->Event_State = EVENT_STATE_NORMAL;
|
||||
else
|
||||
} else {
|
||||
CurrentAV->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* value of the object is still in the same event state */
|
||||
@@ -1288,8 +1293,9 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
/* filled before */
|
||||
|
||||
/* From State */
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION)
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION) {
|
||||
event_data.fromState = FromState;
|
||||
}
|
||||
|
||||
/* To State */
|
||||
event_data.toState = CurrentAV->Event_State;
|
||||
@@ -1447,8 +1453,9 @@ int Analog_Value_Event_Information(
|
||||
pObject->Notification_Class, getevent_data->eventPriorities);
|
||||
|
||||
return 1; /* active event */
|
||||
} else
|
||||
} else {
|
||||
return 0; /* no active event at this index */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1601,10 +1608,12 @@ int Analog_Value_Alarm_Summary(
|
||||
pObject->Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked);
|
||||
|
||||
return 1; /* active alarm */
|
||||
} else
|
||||
} else {
|
||||
return 0; /* no active alarm at this index */
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
return -1; /* end of list */
|
||||
}
|
||||
}
|
||||
#endif /* defined(INTRINSIC_REPORTING) */
|
||||
|
||||
|
||||
+86
-129
@@ -26,15 +26,15 @@
|
||||
#endif
|
||||
|
||||
typedef struct analog_value_descr {
|
||||
unsigned Event_State:3;
|
||||
unsigned Event_State : 3;
|
||||
bool Out_Of_Service;
|
||||
uint16_t Units;
|
||||
float Present_Value;
|
||||
float Prior_Value;
|
||||
float COV_Increment;
|
||||
bool Changed;
|
||||
const char* Object_Name;
|
||||
const char* Description;
|
||||
const char *Object_Name;
|
||||
const char *Description;
|
||||
BACNET_RELIABILITY Reliability;
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
uint32_t Time_Delay;
|
||||
@@ -42,9 +42,9 @@ typedef struct analog_value_descr {
|
||||
float High_Limit;
|
||||
float Low_Limit;
|
||||
float Deadband;
|
||||
unsigned Limit_Enable:2;
|
||||
unsigned Event_Enable:3;
|
||||
unsigned Notify_Type:1;
|
||||
unsigned Limit_Enable : 2;
|
||||
unsigned Event_Enable : 3;
|
||||
unsigned Notify_Type : 1;
|
||||
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
||||
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
||||
/* time to generate event notification */
|
||||
@@ -57,146 +57,103 @@ typedef struct analog_value_descr {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Value_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Value_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Value_Instance_To_Index(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Value_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Value_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Value_Instance_To_Index(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Value_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
float value,
|
||||
uint8_t priority);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Value_Present_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Present_Value_Set(
|
||||
uint32_t object_instance, float value, uint8_t priority);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Value_Present_Value(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Value_Event_State(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Event_State_Set(
|
||||
uint32_t object_instance,
|
||||
unsigned state);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Analog_Value_Event_State(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Event_State_Set(uint32_t object_instance, unsigned state);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Value_COV_Increment(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_COV_Increment_Set(
|
||||
uint32_t instance,
|
||||
float value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Change_Of_Value_Clear(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
float Analog_Value_COV_Increment(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_COV_Increment_Set(uint32_t instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Value_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Description_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Value_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Analog_Value_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Reliability_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Analog_Value_Reliability(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Analog_Value_Units(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Units_Set(
|
||||
uint32_t instance,
|
||||
uint16_t unit);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Analog_Value_Units(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Units_Set(uint32_t instance, uint16_t unit);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Out_Of_Service_Set(
|
||||
uint32_t instance,
|
||||
bool oos_flag);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Out_Of_Service_Set(uint32_t instance, bool oos_flag);
|
||||
|
||||
/* note: header of Intrinsic_Reporting function is required
|
||||
even when INTRINSIC_REPORTING is not defined */
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Intrinsic_Reporting(
|
||||
uint32_t object_instance);
|
||||
/* note: header of Intrinsic_Reporting function is required
|
||||
even when INTRINSIC_REPORTING is not defined */
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Intrinsic_Reporting(uint32_t object_instance);
|
||||
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Event_Information(
|
||||
unsigned index,
|
||||
BACNET_GET_EVENT_INFORMATION_DATA * getevent_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Event_Information(
|
||||
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA * alarmack_data,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA *alarmack_data, BACNET_ERROR_CODE *error_code);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Alarm_Summary(
|
||||
unsigned index,
|
||||
BACNET_GET_ALARM_SUMMARY_DATA * getalarm_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Analog_Value_Alarm_Summary(
|
||||
unsigned index, BACNET_GET_ALARM_SUMMARY_DATA *getalarm_data);
|
||||
#endif
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Value_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Analog_Value_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Value_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Analog_Value_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ struct object_data {
|
||||
char *Pathname;
|
||||
BACNET_DATE_TIME Modification_Date;
|
||||
char *File_Type;
|
||||
bool File_Access_Stream:1;
|
||||
bool File_Access_Stream : 1;
|
||||
bool Read_Only : 1;
|
||||
bool Archive : 1;
|
||||
};
|
||||
@@ -47,9 +47,15 @@ static OS_Keylist Object_List;
|
||||
static const BACNET_OBJECT_TYPE Object_Type = OBJECT_FILE;
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int bacfile_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_FILE_TYPE, PROP_FILE_SIZE,
|
||||
PROP_MODIFICATION_DATE, PROP_ARCHIVE, PROP_READ_ONLY,
|
||||
PROP_FILE_ACCESS_METHOD, -1 };
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_FILE_TYPE,
|
||||
PROP_FILE_SIZE,
|
||||
PROP_MODIFICATION_DATE,
|
||||
PROP_ARCHIVE,
|
||||
PROP_READ_ONLY,
|
||||
PROP_FILE_ACCESS_METHOD,
|
||||
-1 };
|
||||
|
||||
static const int bacfile_Properties_Optional[] = { PROP_DESCRIPTION, -1 };
|
||||
|
||||
@@ -86,7 +92,8 @@ void BACfile_Property_Lists(
|
||||
* @param s - string to duplicate
|
||||
* @return a pointer to a new string on success, or a null pointer
|
||||
*/
|
||||
static char *bacfile_strdup(const char *s) {
|
||||
static char *bacfile_strdup(const char *s)
|
||||
{
|
||||
size_t size = strlen(s) + 1;
|
||||
char *p = malloc(size);
|
||||
if (p != NULL) {
|
||||
@@ -137,8 +144,7 @@ void bacfile_pathname_set(uint32_t object_instance, const char *pathname)
|
||||
* @return object-instance number of the object,
|
||||
* or #BACNET_MAX_INSTANCE if not found
|
||||
*/
|
||||
uint32_t bacfile_pathname_instance(
|
||||
const char *pathname)
|
||||
uint32_t bacfile_pathname_instance(const char *pathname)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
int count = 0;
|
||||
@@ -179,11 +185,10 @@ bool bacfile_object_name(
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
if (pObject->Object_Name) {
|
||||
status = characterstring_init_ansi(object_name,
|
||||
pObject->Object_Name);
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "FILE %u",
|
||||
object_instance);
|
||||
snprintf(name_text, sizeof(name_text), "FILE %u", object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
@@ -232,7 +237,6 @@ const char *bacfile_name_ansi(uint32_t object_instance)
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Determines if a given object instance is valid
|
||||
* @param object_instance - object-instance number of the object
|
||||
@@ -300,8 +304,8 @@ static long fsize(FILE *pFile)
|
||||
* @param buffer_size - in bytes
|
||||
* @return file size in bytes
|
||||
*/
|
||||
uint32_t bacfile_read(uint32_t object_instance, uint8_t *buffer,
|
||||
uint32_t buffer_size)
|
||||
uint32_t
|
||||
bacfile_read(uint32_t object_instance, uint8_t *buffer, uint32_t buffer_size)
|
||||
{
|
||||
const char *pFilename = NULL;
|
||||
FILE *pFile = NULL;
|
||||
@@ -331,8 +335,8 @@ uint32_t bacfile_read(uint32_t object_instance, uint8_t *buffer,
|
||||
* @param buffer_size - in bytes
|
||||
* @return file size in bytes
|
||||
*/
|
||||
uint32_t bacfile_write(uint32_t object_instance, const uint8_t *buffer,
|
||||
uint32_t buffer_size)
|
||||
uint32_t bacfile_write(
|
||||
uint32_t object_instance, const uint8_t *buffer, uint32_t buffer_size)
|
||||
{
|
||||
const char *pFilename = NULL;
|
||||
FILE *pFile = NULL;
|
||||
@@ -387,8 +391,7 @@ BACNET_UNSIGNED_INTEGER bacfile_file_size(uint32_t object_instance)
|
||||
* @return true if file size is writable
|
||||
*/
|
||||
bool bacfile_file_size_set(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER file_size)
|
||||
uint32_t object_instance, BACNET_UNSIGNED_INTEGER file_size)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -404,17 +407,15 @@ bool bacfile_file_size_set(
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Determines the file size property value
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return value of the file size property
|
||||
*/
|
||||
const char * bacfile_file_type(
|
||||
uint32_t object_instance)
|
||||
const char *bacfile_file_type(uint32_t object_instance)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
const char * mime_type = "application/octet-stream";
|
||||
const char *mime_type = "application/octet-stream";
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
@@ -431,9 +432,7 @@ const char * bacfile_file_type(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param mime_type - value of the file type property
|
||||
*/
|
||||
void bacfile_file_type_set(
|
||||
uint32_t object_instance,
|
||||
const char *mime_type)
|
||||
void bacfile_file_type_set(uint32_t object_instance, const char *mime_type)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -461,8 +460,7 @@ void bacfile_file_type_set(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return true if the property is true
|
||||
*/
|
||||
bool bacfile_archive(
|
||||
uint32_t object_instance)
|
||||
bool bacfile_archive(uint32_t object_instance)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -486,8 +484,7 @@ bool bacfile_archive(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return true if the property is true
|
||||
*/
|
||||
bool bacfile_archive_set(
|
||||
uint32_t object_instance, bool archive)
|
||||
bool bacfile_archive_set(uint32_t object_instance, bool archive)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -506,8 +503,7 @@ bool bacfile_archive_set(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return true if the property is true
|
||||
*/
|
||||
bool bacfile_read_only(
|
||||
uint32_t object_instance)
|
||||
bool bacfile_read_only(uint32_t object_instance)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -526,9 +522,7 @@ bool bacfile_read_only(
|
||||
* @param archive - value of the file archive property
|
||||
* @return true if the file exists and read-only is writeable
|
||||
*/
|
||||
bool bacfile_read_only_set(
|
||||
uint32_t object_instance,
|
||||
bool read_only)
|
||||
bool bacfile_read_only_set(uint32_t object_instance, bool read_only)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -547,8 +541,8 @@ bool bacfile_read_only_set(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param bdatetime
|
||||
*/
|
||||
static void bacfile_modification_date(
|
||||
uint32_t object_instance, BACNET_DATE_TIME *bdatetime)
|
||||
static void
|
||||
bacfile_modification_date(uint32_t object_instance, BACNET_DATE_TIME *bdatetime)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -563,8 +557,7 @@ static void bacfile_modification_date(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return true if the property is true
|
||||
*/
|
||||
bool bacfile_file_access_stream(
|
||||
uint32_t object_instance)
|
||||
bool bacfile_file_access_stream(uint32_t object_instance)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -583,9 +576,7 @@ bool bacfile_file_access_stream(
|
||||
* @param access - value of the property
|
||||
* @return true if the file exists and property is writeable
|
||||
*/
|
||||
bool bacfile_file_access_stream_set(
|
||||
uint32_t object_instance,
|
||||
bool access)
|
||||
bool bacfile_file_access_stream_set(uint32_t object_instance, bool access)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -630,8 +621,7 @@ int bacfile_read_property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0], Object_Type);
|
||||
apdu_len = encode_application_enumerated(&apdu[0], Object_Type);
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
characterstring_init_ansi(
|
||||
@@ -640,8 +630,8 @@ int bacfile_read_property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_FILE_TYPE:
|
||||
characterstring_init_ansi(&char_string,
|
||||
bacfile_file_type(rpdata->object_instance));
|
||||
characterstring_init_ansi(
|
||||
&char_string, bacfile_file_type(rpdata->object_instance));
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
@@ -654,20 +644,20 @@ int bacfile_read_property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = bacapp_encode_datetime(apdu, &bdatetime);
|
||||
break;
|
||||
case PROP_ARCHIVE:
|
||||
apdu_len = encode_application_boolean(&apdu[0],
|
||||
bacfile_archive(rpdata->object_instance));
|
||||
apdu_len = encode_application_boolean(
|
||||
&apdu[0], bacfile_archive(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_READ_ONLY:
|
||||
apdu_len = encode_application_boolean(&apdu[0],
|
||||
bacfile_read_only(rpdata->object_instance));
|
||||
apdu_len = encode_application_boolean(
|
||||
&apdu[0], bacfile_read_only(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_FILE_ACCESS_METHOD:
|
||||
if (bacfile_file_access_stream(rpdata->object_instance)) {
|
||||
apdu_len = encode_application_enumerated(
|
||||
&apdu[0], FILE_STREAM_ACCESS);
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0], FILE_STREAM_ACCESS);
|
||||
} else {
|
||||
apdu_len = encode_application_enumerated(
|
||||
&apdu[0], FILE_RECORD_ACCESS);
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0], FILE_RECORD_ACCESS);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -730,9 +720,8 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||
if (status) {
|
||||
status =
|
||||
bacfile_file_size_set(wp_data->object_instance,
|
||||
value.type.Unsigned_Int);
|
||||
status = bacfile_file_size_set(
|
||||
wp_data->object_instance, value.type.Unsigned_Int);
|
||||
if (!status) {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
@@ -786,9 +775,9 @@ uint32_t bacfile_instance_from_tsm(uint8_t invokeID)
|
||||
if (!npdu_data.network_layer_message &&
|
||||
npdu_data.data_expecting_reply &&
|
||||
((apdu[0] & 0xF0) == PDU_TYPE_CONFIRMED_SERVICE_REQUEST)) {
|
||||
len = apdu_decode_confirmed_service_request(&apdu[0], apdu_len,
|
||||
&service_data, &service_choice, &service_request,
|
||||
&service_request_len);
|
||||
len = apdu_decode_confirmed_service_request(
|
||||
&apdu[0], apdu_len, &service_data, &service_choice,
|
||||
&service_request, &service_request_len);
|
||||
if ((len > 0) &&
|
||||
(service_choice == SERVICE_CONFIRMED_ATOMIC_READ_FILE)) {
|
||||
len = arf_decode_service_request(
|
||||
@@ -819,7 +808,8 @@ bool bacfile_read_stream_data(BACNET_ATOMIC_READ_FILE_DATA *data)
|
||||
pFile = fopen(pFilename, "rb");
|
||||
if (pFile) {
|
||||
(void)fseek(pFile, data->type.stream.fileStartPosition, SEEK_SET);
|
||||
len = fread(octetstring_value(&data->fileData[0]), 1,
|
||||
len = fread(
|
||||
octetstring_value(&data->fileData[0]), 1,
|
||||
data->type.stream.requestedOctetCount, pFile);
|
||||
if (len < data->type.stream.requestedOctetCount) {
|
||||
data->endOfFile = true;
|
||||
@@ -866,7 +856,8 @@ bool bacfile_write_stream_data(BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
(void)fseek(
|
||||
pFile, data->type.stream.fileStartPosition, SEEK_SET);
|
||||
}
|
||||
if (fwrite(octetstring_value(&data->fileData[0]),
|
||||
if (fwrite(
|
||||
octetstring_value(&data->fileData[0]),
|
||||
octetstring_length(&data->fileData[0]), 1, pFile) != 1) {
|
||||
/* do something if it fails? */
|
||||
}
|
||||
@@ -913,7 +904,9 @@ bool bacfile_write_record_data(const BACNET_ATOMIC_WRITE_FILE_DATA *data)
|
||||
}
|
||||
}
|
||||
for (i = 0; i < data->type.record.returnedRecordCount; i++) {
|
||||
if (fwrite(octetstring_value((BACNET_OCTET_STRING*)&data->fileData[i]),
|
||||
if (fwrite(
|
||||
octetstring_value(
|
||||
(BACNET_OCTET_STRING *)&data->fileData[i]),
|
||||
octetstring_length(&data->fileData[i]), 1,
|
||||
pFile) != 1) {
|
||||
/* do something if it fails? */
|
||||
@@ -939,10 +932,13 @@ bool bacfile_read_ack_stream_data(
|
||||
pFile = fopen(pFilename, "rb+");
|
||||
if (pFile) {
|
||||
(void)fseek(pFile, data->type.stream.fileStartPosition, SEEK_SET);
|
||||
if (fwrite(octetstring_value((BACNET_OCTET_STRING*)&data->fileData[0]),
|
||||
if (fwrite(
|
||||
octetstring_value(
|
||||
(BACNET_OCTET_STRING *)&data->fileData[0]),
|
||||
octetstring_length(&data->fileData[0]), 1, pFile) != 1) {
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "Failed to write to %s (%lu)!\n", pFilename,
|
||||
fprintf(
|
||||
stderr, "Failed to write to %s (%lu)!\n", pFilename,
|
||||
(unsigned long)instance);
|
||||
#endif
|
||||
}
|
||||
@@ -978,11 +974,14 @@ bool bacfile_read_ack_record_data(
|
||||
}
|
||||
}
|
||||
for (i = 0; i < data->type.record.RecordCount; i++) {
|
||||
if (fwrite(octetstring_value((BACNET_OCTET_STRING*)&data->fileData[i]),
|
||||
if (fwrite(
|
||||
octetstring_value(
|
||||
(BACNET_OCTET_STRING *)&data->fileData[i]),
|
||||
octetstring_length(&data->fileData[i]), 1,
|
||||
pFile) != 1) {
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "Failed to write to %s (%lu)!\n", pFilename,
|
||||
fprintf(
|
||||
stderr, "Failed to write to %s (%lu)!\n", pFilename,
|
||||
(unsigned long)instance);
|
||||
#endif
|
||||
}
|
||||
@@ -994,7 +993,6 @@ bool bacfile_read_ack_record_data(
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Creates a File object
|
||||
* @param object_instance - object-instance number of the object
|
||||
@@ -1022,8 +1020,8 @@ uint32_t bacfile_create(uint32_t object_instance)
|
||||
pObject->Object_Name = NULL;
|
||||
pObject->Pathname = NULL;
|
||||
/* April Fool's Day */
|
||||
datetime_set_values(&pObject->Modification_Date,
|
||||
2006, 4, 1, 7, 0, 3, 1);
|
||||
datetime_set_values(
|
||||
&pObject->Modification_Date, 2006, 4, 1, 7, 0, 3, 1);
|
||||
pObject->Read_Only = false;
|
||||
pObject->Archive = false;
|
||||
pObject->File_Access_Stream = true;
|
||||
|
||||
@@ -24,152 +24,107 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void BACfile_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void BACfile_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_object_name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_object_name_set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char * bacfile_name_ansi(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_object_name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_object_name_set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bacfile_name_ansi(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_valid_instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_index_to_instance(
|
||||
unsigned find_index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned bacfile_instance_to_index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_valid_instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_index_to_instance(unsigned find_index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned bacfile_instance_to_index(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char * bacfile_file_type(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_file_type_set(
|
||||
uint32_t object_instance,
|
||||
const char *mime_type);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bacfile_file_type(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_file_type_set(uint32_t object_instance, const char *mime_type);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_archive(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_archive_set(
|
||||
uint32_t instance, bool status);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_archive(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_archive_set(uint32_t instance, bool status);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_only(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_only_set(
|
||||
uint32_t object_instance,
|
||||
bool read_only);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_only(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_only_set(uint32_t object_instance, bool read_only);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_file_access_stream(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_file_access_stream_set(
|
||||
uint32_t object_instance,
|
||||
bool access);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_file_access_stream(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_file_access_stream_set(uint32_t object_instance, bool access);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_UNSIGNED_INTEGER bacfile_file_size(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_file_size_set(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER file_size);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_UNSIGNED_INTEGER bacfile_file_size(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_file_size_set(
|
||||
uint32_t object_instance, BACNET_UNSIGNED_INTEGER file_size);
|
||||
|
||||
/* this is one way to match up the invoke ID with */
|
||||
/* the file ID from the AtomicReadFile request. */
|
||||
/* Another way would be to store the */
|
||||
/* invokeID and file instance in a list or table */
|
||||
/* when the request was sent */
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_instance_from_tsm(
|
||||
uint8_t invokeID);
|
||||
/* this is one way to match up the invoke ID with */
|
||||
/* the file ID from the AtomicReadFile request. */
|
||||
/* Another way would be to store the */
|
||||
/* invokeID and file instance in a list or table */
|
||||
/* when the request was sent */
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_instance_from_tsm(uint8_t invokeID);
|
||||
|
||||
/* handler ACK helper */
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_stream_data(
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_ack_stream_data(
|
||||
uint32_t instance,
|
||||
const BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_write_stream_data(
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_record_data(
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_ack_record_data(
|
||||
uint32_t instance,
|
||||
const BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_write_record_data(
|
||||
const BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
/* handler ACK helper */
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_stream_data(BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_ack_stream_data(
|
||||
uint32_t instance, const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_write_stream_data(BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_record_data(BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_read_ack_record_data(
|
||||
uint32_t instance, const BACNET_ATOMIC_READ_FILE_DATA *data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_write_record_data(const BACNET_ATOMIC_WRITE_FILE_DATA *data);
|
||||
|
||||
/* handling for read property service */
|
||||
BACNET_STACK_EXPORT
|
||||
int bacfile_read_property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
/* handling for read property service */
|
||||
BACNET_STACK_EXPORT
|
||||
int bacfile_read_property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
/* handling for write property service */
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_write_property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
/* handling for write property service */
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bacfile_pathname(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_pathname_set(
|
||||
uint32_t instance,
|
||||
const char *pathname);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_pathname_instance(
|
||||
const char *pathname);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *bacfile_pathname(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_pathname_set(uint32_t instance, const char *pathname);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_pathname_instance(const char *pathname);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_read(
|
||||
uint32_t object_instance,
|
||||
uint8_t *buffer,
|
||||
uint32_t buffer_size);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_write(
|
||||
uint32_t object_instance,
|
||||
const uint8_t *buffer,
|
||||
uint32_t buffer_size);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t
|
||||
bacfile_read(uint32_t object_instance, uint8_t *buffer, uint32_t buffer_size);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_write(
|
||||
uint32_t object_instance, const uint8_t *buffer, uint32_t buffer_size);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t bacfile_create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void bacfile_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1573,8 +1573,9 @@ int Binary_Input_Event_Information(
|
||||
false) |
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked ==
|
||||
false);
|
||||
} else
|
||||
} else {
|
||||
return -1; /* end of list */
|
||||
}
|
||||
|
||||
if ((IsActiveEvent) || (IsNotAckedTransitions)) {
|
||||
/* Object Identifier */
|
||||
@@ -1618,8 +1619,9 @@ int Binary_Input_Event_Information(
|
||||
pObject->Notification_Class, getevent_data->eventPriorities);
|
||||
|
||||
return 1; /* active event */
|
||||
} else
|
||||
} else {
|
||||
return 0; /* no active event at this index */
|
||||
}
|
||||
}
|
||||
|
||||
int Binary_Input_Alarm_Ack(
|
||||
@@ -1759,10 +1761,12 @@ int Binary_Input_Alarm_Summary(
|
||||
&getalarm_data->acknowledgedTransitions, TRANSITION_TO_NORMAL,
|
||||
pObject->Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked);
|
||||
return 1; /* active alarm */
|
||||
} else
|
||||
} else {
|
||||
return 0; /* no active alarm at this index */
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
return -1; /* end of list */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1935,10 +1939,11 @@ void Binary_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
if ((PresentVal == pObject->Alarm_Value) &&
|
||||
((pObject->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ==
|
||||
EVENT_ENABLE_TO_OFFNORMAL)) {
|
||||
if (!pObject->Remaining_Time_Delay)
|
||||
if (!pObject->Remaining_Time_Delay) {
|
||||
pObject->Event_State = EVENT_STATE_OFFNORMAL;
|
||||
else
|
||||
} else {
|
||||
pObject->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1955,10 +1960,11 @@ void Binary_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
if ((PresentVal != pObject->Alarm_Value) &&
|
||||
((pObject->Event_Enable & EVENT_ENABLE_TO_NORMAL) ==
|
||||
EVENT_ENABLE_TO_NORMAL)) {
|
||||
if (!pObject->Remaining_Time_Delay)
|
||||
if (!pObject->Remaining_Time_Delay) {
|
||||
pObject->Event_State = EVENT_STATE_NORMAL;
|
||||
else
|
||||
} else {
|
||||
pObject->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2070,8 +2076,9 @@ void Binary_Input_Intrinsic_Reporting(uint32_t object_instance)
|
||||
/* filled before */
|
||||
|
||||
/* From State */
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION)
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION) {
|
||||
event_data.fromState = FromState;
|
||||
}
|
||||
|
||||
/* To State */
|
||||
event_data.toState = pObject->Event_State;
|
||||
|
||||
+123
-178
@@ -32,221 +32,166 @@
|
||||
* @param value - binary preset-value of the write
|
||||
*/
|
||||
typedef void (*binary_input_write_present_value_callback)(
|
||||
uint32_t object_instance, BACNET_BINARY_PV old_value,
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_PV old_value,
|
||||
BACNET_BINARY_PV value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Input_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Input_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Input_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Input_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Input_Present_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_PV value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Input_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Present_Value_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_PV value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Description_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Binary_Input_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Reliability_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Binary_Input_Reliability(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Inactive_Text(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Inactive_Text_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Inactive_Text(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Inactive_Text_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Active_Text(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Active_Text_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Active_Text(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Active_Text_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_POLARITY Binary_Input_Polarity(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Polarity_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_POLARITY polarity);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_POLARITY Binary_Input_Polarity(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Polarity_Set(
|
||||
uint32_t object_instance, BACNET_POLARITY polarity);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Out_Of_Service(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Out_Of_Service_Set(
|
||||
uint32_t object_instance,
|
||||
bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Out_Of_Service(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Out_Of_Service_Set(uint32_t object_instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Input_Event_State(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Input_Event_State(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Change_Of_Value_Clear(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Present_Value_Callback_Set(
|
||||
binary_input_write_present_value_callback cb);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Present_Value_Callback_Set(
|
||||
binary_input_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Disable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Disable(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Init(void);
|
||||
|
||||
#if defined(INTRINSIC_REPORTING) && (BINARY_INPUT_INTRINSIC_REPORTING)
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Event_Detection_Enable(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Event_Detection_Enable_Set(
|
||||
uint32_t object_instance, bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Event_Detection_Enable(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Event_Detection_Enable_Set(
|
||||
uint32_t object_instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Event_Information(
|
||||
unsigned index,
|
||||
BACNET_GET_EVENT_INFORMATION_DATA * getevent_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Event_Information(
|
||||
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA * alarmack_data,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA *alarmack_data, BACNET_ERROR_CODE *error_code);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Alarm_Summary(
|
||||
unsigned index,
|
||||
BACNET_GET_ALARM_SUMMARY_DATA * getalarm_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Input_Alarm_Summary(
|
||||
unsigned index, BACNET_GET_ALARM_SUMMARY_DATA *getalarm_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Time_Delay(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Time_Delay(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Time_Delay_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t time_delay);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Time_Delay_Set(uint32_t object_instance, uint32_t time_delay);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Notification_Class(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Notification_Class(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Notification_Class_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t notification_class);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Notification_Class_Set(
|
||||
uint32_t object_instance, uint32_t notification_class);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Input_Alarm_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Input_Alarm_Value(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Alarm_Value_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_PV value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Alarm_Value_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_PV value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Event_Enable(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Event_Enable(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Event_Enable_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t event_enable);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Event_Enable_Set(
|
||||
uint32_t object_instance, uint32_t event_enable);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_NOTIFY_TYPE Binary_Input_Notify_Type(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_NOTIFY_TYPE Binary_Input_Notify_Type(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Notify_Type_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_NOTIFY_TYPE notify_type);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Notify_Type_Set(
|
||||
uint32_t object_instance, BACNET_NOTIFY_TYPE notify_type);
|
||||
#endif
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Intrinsic_Reporting(
|
||||
uint32_t object_instance);
|
||||
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Intrinsic_Reporting(uint32_t object_instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -41,12 +41,14 @@ static bitstring_value_write_present_value_callback
|
||||
BitString_Value_Write_Present_Value_Callback;
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
|
||||
-1 };
|
||||
static const int Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE, PROP_STATUS_FLAGS, -1
|
||||
};
|
||||
|
||||
static const int Properties_Optional[] = { PROP_RELIABILITY,
|
||||
PROP_OUT_OF_SERVICE, PROP_DESCRIPTION, -1 };
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_DESCRIPTION, -1 };
|
||||
|
||||
static const int Properties_Proprietary[] = { -1 };
|
||||
|
||||
@@ -265,8 +267,7 @@ bool BitString_Value_Out_Of_Service(uint32_t object_instance)
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param true/false
|
||||
*/
|
||||
void BitString_Value_Out_Of_Service_Set(
|
||||
uint32_t object_instance, bool value)
|
||||
void BitString_Value_Out_Of_Service_Set(uint32_t object_instance, bool value)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -286,8 +287,7 @@ void BitString_Value_Out_Of_Service_Set(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return BACNET_RELIABILITY value
|
||||
*/
|
||||
BACNET_RELIABILITY BitString_Value_Reliablity(
|
||||
uint32_t object_instance)
|
||||
BACNET_RELIABILITY BitString_Value_Reliablity(uint32_t object_instance)
|
||||
{
|
||||
BACNET_RELIABILITY value = RELIABILITY_NO_FAULT_DETECTED;
|
||||
struct object_data *pObject;
|
||||
@@ -298,7 +298,6 @@ BACNET_RELIABILITY BitString_Value_Reliablity(
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,8 +410,8 @@ bool BitString_Value_Encode_Value_List(
|
||||
|
||||
pObject = BitString_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
status = cov_value_list_encode_bit_string(value_list,
|
||||
&pObject->Present_Value, in_alarm, fault, overridden,
|
||||
status = cov_value_list_encode_bit_string(
|
||||
value_list, &pObject->Present_Value, in_alarm, fault, overridden,
|
||||
pObject->Out_Of_Service);
|
||||
}
|
||||
|
||||
@@ -442,7 +441,8 @@ bool BitString_Value_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "BITSTRING_VALUE-%u",
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "BITSTRING_VALUE-%u",
|
||||
object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
@@ -562,8 +562,8 @@ int BitString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu = rpdata->application_data;
|
||||
switch (rpdata->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len = encode_application_object_id(&apdu[0],
|
||||
OBJECT_BITSTRING_VALUE, rpdata->object_instance);
|
||||
apdu_len = encode_application_object_id(
|
||||
&apdu[0], OBJECT_BITSTRING_VALUE, rpdata->object_instance);
|
||||
break;
|
||||
case PROP_OBJECT_NAME:
|
||||
if (BitString_Value_Object_Name(
|
||||
@@ -574,13 +574,13 @@ int BitString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
characterstring_init_ansi(
|
||||
&char_string, BitString_Value_Description(
|
||||
rpdata->object_instance));
|
||||
&char_string,
|
||||
BitString_Value_Description(rpdata->object_instance));
|
||||
apdu_len = encode_application_character_string(apdu, &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len = encode_application_enumerated(
|
||||
&apdu[0], OBJECT_BITSTRING_VALUE);
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0], OBJECT_BITSTRING_VALUE);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
BitString_Value_Present_Value(rpdata->object_instance, &bit_string);
|
||||
@@ -602,9 +602,8 @@ int BitString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_boolean(&apdu[0], state);
|
||||
break;
|
||||
case PROP_RELIABILITY:
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0],
|
||||
BitString_Value_Reliablity(rpdata->object_instance));
|
||||
apdu_len = encode_application_enumerated(
|
||||
&apdu[0], BitString_Value_Reliablity(rpdata->object_instance));
|
||||
break;
|
||||
default:
|
||||
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
||||
@@ -684,8 +683,8 @@ bool BitString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
break;
|
||||
default:
|
||||
if (property_lists_member(
|
||||
Properties_Required, Properties_Optional,
|
||||
Properties_Proprietary, wp_data->object_property)) {
|
||||
Properties_Required, Properties_Optional,
|
||||
Properties_Proprietary, wp_data->object_property)) {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
} else {
|
||||
|
||||
@@ -33,113 +33,89 @@ typedef void (*bitstring_value_write_present_value_callback)(
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Write_Present_Value_Callback_Set(
|
||||
bitstring_value_write_present_value_callback cb);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Write_Present_Value_Callback_Set(
|
||||
bitstring_value_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned BitString_Value_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t BitString_Value_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned BitString_Value_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned BitString_Value_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t BitString_Value_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned BitString_Value_Instance_To_Index(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int BitString_Value_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
int BitString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
/* optional API */
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
/* optional API */
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *BitString_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *BitString_Value_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Present_Value(
|
||||
uint32_t object_instance,
|
||||
BACNET_BIT_STRING * value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
const BACNET_BIT_STRING * value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Present_Value(
|
||||
uint32_t object_instance, BACNET_BIT_STRING *value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Present_Value_Set(
|
||||
uint32_t object_instance, const BACNET_BIT_STRING *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *BitString_Value_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Description_Set(
|
||||
uint32_t object_instance,
|
||||
const char *text_string);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *BitString_Value_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Description_Set(
|
||||
uint32_t object_instance, const char *text_string);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Out_Of_Service(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Out_Of_Service_Set(
|
||||
uint32_t object_instance, bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Out_Of_Service(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Out_Of_Service_Set(uint32_t object_instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY BitString_Value_Reliablity(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Reliablity_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY BitString_Value_Reliablity(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Reliablity_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Change_Of_Value_Clear(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Write_Disable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Write_Disable(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t BitString_Value_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Cleanup(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t BitString_Value_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Cleanup(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void BitString_Value_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -61,10 +61,17 @@ static binary_lighting_output_blink_warn_callback
|
||||
/* These arrays are used by the ReadPropertyMultiple handler and
|
||||
property-list property (as of protocol-revision 14) */
|
||||
static const int Binary_Lighting_Output_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE, PROP_STATUS_FLAGS, PROP_OUT_OF_SERVICE,
|
||||
PROP_BLINK_WARN_ENABLE, PROP_EGRESS_TIME, PROP_EGRESS_ACTIVE,
|
||||
PROP_PRIORITY_ARRAY, PROP_RELINQUISH_DEFAULT,
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_BLINK_WARN_ENABLE,
|
||||
PROP_EGRESS_TIME,
|
||||
PROP_EGRESS_ACTIVE,
|
||||
PROP_PRIORITY_ARRAY,
|
||||
PROP_RELINQUISH_DEFAULT,
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
PROP_CURRENT_COMMAND_PRIORITY,
|
||||
#endif
|
||||
@@ -216,8 +223,8 @@ static BACNET_BINARY_LIGHTING_PV Priority_Array_Next_Value(
|
||||
*
|
||||
* @return present-value of the object
|
||||
*/
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Present_Value(
|
||||
uint32_t object_instance)
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Present_Value(uint32_t object_instance)
|
||||
{
|
||||
BACNET_BINARY_LIGHTING_PV value = BINARY_LIGHTING_PV_OFF;
|
||||
struct object_data *pObject;
|
||||
@@ -314,8 +321,8 @@ static unsigned Present_Value_Priority(const struct object_data *pObject)
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Present_Value_Relinquish(
|
||||
struct object_data *pObject, unsigned priority)
|
||||
static bool
|
||||
Present_Value_Relinquish(struct object_data *pObject, unsigned priority)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
@@ -340,7 +347,8 @@ static bool Present_Value_Relinquish(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Present_Value_Set(struct object_data *pObject,
|
||||
static bool Present_Value_Set(
|
||||
struct object_data *pObject,
|
||||
BACNET_BINARY_LIGHTING_PV value,
|
||||
unsigned priority)
|
||||
{
|
||||
@@ -391,7 +399,8 @@ unsigned Binary_Lighting_Output_Present_Value_Priority(uint32_t object_instance)
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
bool Binary_Lighting_Output_Present_Value_Set(uint32_t object_instance,
|
||||
bool Binary_Lighting_Output_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_LIGHTING_PV value,
|
||||
unsigned priority)
|
||||
{
|
||||
@@ -426,8 +435,9 @@ static void Present_Value_On_Off_Handler(uint32_t object_instance)
|
||||
if (pObject->Feedback_Value != pObject->Target_Value) {
|
||||
if ((!pObject->Out_Of_Service) &&
|
||||
(Binary_Lighting_Output_Write_Value_Callback)) {
|
||||
Binary_Lighting_Output_Write_Value_Callback(object_instance,
|
||||
pObject->Feedback_Value, pObject->Target_Value);
|
||||
Binary_Lighting_Output_Write_Value_Callback(
|
||||
object_instance, pObject->Feedback_Value,
|
||||
pObject->Target_Value);
|
||||
}
|
||||
pObject->Feedback_Value = pObject->Target_Value;
|
||||
}
|
||||
@@ -563,8 +573,7 @@ static void Present_Value_Warn_Handler(uint32_t object_instance)
|
||||
pObject->Target_Value = BINARY_LIGHTING_PV_ON;
|
||||
} else if (pObject->Target_Value == BINARY_LIGHTING_PV_WARN_OFF) {
|
||||
pObject->Target_Value = BINARY_LIGHTING_PV_OFF;
|
||||
} else if (pObject->Target_Value ==
|
||||
BINARY_LIGHTING_PV_WARN_RELINQUISH) {
|
||||
} else if (pObject->Target_Value == BINARY_LIGHTING_PV_WARN_RELINQUISH) {
|
||||
pObject->Target_Value = BINARY_LIGHTING_PV_OFF;
|
||||
}
|
||||
}
|
||||
@@ -629,7 +638,8 @@ void Binary_Lighting_Output_Timer(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Binary_Lighting_Output_Present_Value_Write(uint32_t object_instance,
|
||||
static bool Binary_Lighting_Output_Present_Value_Write(
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_LIGHTING_PV value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -656,7 +666,8 @@ static bool Binary_Lighting_Output_Present_Value_Write(uint32_t object_instance,
|
||||
Present_Value_On_Off_Handler(object_instance);
|
||||
}
|
||||
status = true;
|
||||
} else if ((value >= BINARY_LIGHTING_PV_PROPRIETARY_MIN) &&
|
||||
} else if (
|
||||
(value >= BINARY_LIGHTING_PV_PROPRIETARY_MIN) &&
|
||||
(value <= BINARY_LIGHTING_PV_PROPRIETARY_MAX)) {
|
||||
pObject->Target_Priority = priority;
|
||||
pObject->Target_Value = value;
|
||||
@@ -770,7 +781,8 @@ bool Binary_Lighting_Output_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "BINARY-LIGHTING-OUTPUT-%u",
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "BINARY-LIGHTING-OUTPUT-%u",
|
||||
object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
@@ -876,7 +888,8 @@ bool Binary_Lighting_Output_Description_Set(
|
||||
*
|
||||
* @return true if lighting target value was set
|
||||
*/
|
||||
bool Binary_Lighting_Output_Lighting_Command_Set(uint32_t object_instance,
|
||||
bool Binary_Lighting_Output_Lighting_Command_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_LIGHTING_PV value,
|
||||
unsigned priority)
|
||||
{
|
||||
@@ -898,8 +911,8 @@ bool Binary_Lighting_Output_Lighting_Command_Set(uint32_t object_instance,
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return lighting command target value
|
||||
*/
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Lighting_Command_Target_Value(
|
||||
uint32_t object_instance)
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Lighting_Command_Target_Value(uint32_t object_instance)
|
||||
{
|
||||
BACNET_BINARY_LIGHTING_PV value = BINARY_LIGHTING_PV_OFF;
|
||||
struct object_data *pObject;
|
||||
@@ -939,8 +952,8 @@ unsigned Binary_Lighting_Output_Lighting_Command_Target_Priority(
|
||||
*
|
||||
* @return the tracking-value of this object instance.
|
||||
*/
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Feedback_Value(
|
||||
uint32_t object_instance)
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Feedback_Value(uint32_t object_instance)
|
||||
{
|
||||
BACNET_BINARY_LIGHTING_PV value = BINARY_LIGHTING_PV_OFF;
|
||||
struct object_data *pObject;
|
||||
@@ -1142,8 +1155,8 @@ void Binary_Lighting_Output_Out_Of_Service_Set(
|
||||
*
|
||||
* @return relinquish-default property value
|
||||
*/
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Relinquish_Default(
|
||||
uint32_t object_instance)
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Relinquish_Default(uint32_t object_instance)
|
||||
{
|
||||
BACNET_BINARY_LIGHTING_PV value = BINARY_LIGHTING_PV_OFF;
|
||||
struct object_data *pObject;
|
||||
@@ -1310,8 +1323,8 @@ int Binary_Lighting_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_boolean(&apdu[0], state);
|
||||
break;
|
||||
case PROP_PRIORITY_ARRAY:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index,
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Binary_Lighting_Output_Priority_Array_Encode,
|
||||
BACNET_MAX_PRIORITY, apdu, apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
@@ -1339,7 +1352,8 @@ int Binary_Lighting_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
break;
|
||||
#endif
|
||||
case PROP_DESCRIPTION:
|
||||
characterstring_init_ansi(&char_string,
|
||||
characterstring_init_ansi(
|
||||
&char_string,
|
||||
Binary_Lighting_Output_Description(rpdata->object_instance));
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
|
||||
@@ -53,13 +53,14 @@ BACNET_STACK_EXPORT
|
||||
bool Binary_Lighting_Output_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Present_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Lighting_Output_Present_Value_Priority(
|
||||
uint32_t object_instance);
|
||||
unsigned
|
||||
Binary_Lighting_Output_Present_Value_Priority(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Lighting_Output_Present_Value_Set(uint32_t object_instance,
|
||||
bool Binary_Lighting_Output_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_LIGHTING_PV value,
|
||||
unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
@@ -67,15 +68,14 @@ bool Binary_Lighting_Output_Present_Value_Relinquish(
|
||||
uint32_t object_instance, unsigned priority);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Relinquish_Default(
|
||||
uint32_t object_instance);
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Relinquish_Default(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Lighting_Output_Relinquish_Default_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_LIGHTING_PV value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Binary_Lighting_Output_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_RELIABILITY Binary_Lighting_Output_Reliability(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Lighting_Output_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
@@ -102,18 +102,20 @@ void Binary_Lighting_Output_Out_Of_Service_Set(
|
||||
uint32_t instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Lighting_Command_Target_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Lighting_Command_Target_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Lighting_Output_Lighting_Command_Target_Priority(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Lighting_Output_Lighting_Command_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_LIGHTING_PV value, unsigned priority);
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_LIGHTING_PV value,
|
||||
unsigned priority);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_LIGHTING_PV Binary_Lighting_Output_Feedback_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_BINARY_LIGHTING_PV
|
||||
Binary_Lighting_Output_Feedback_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Lighting_Output_Feedback_Value_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_LIGHTING_PV value);
|
||||
|
||||
@@ -57,16 +57,23 @@ static binary_output_write_present_value_callback
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_OUT_OF_SERVICE, PROP_POLARITY, PROP_PRIORITY_ARRAY,
|
||||
PROP_RELINQUISH_DEFAULT,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_POLARITY,
|
||||
PROP_PRIORITY_ARRAY,
|
||||
PROP_RELINQUISH_DEFAULT,
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
PROP_CURRENT_COMMAND_PRIORITY,
|
||||
PROP_CURRENT_COMMAND_PRIORITY,
|
||||
#endif
|
||||
-1 };
|
||||
-1 };
|
||||
|
||||
static const int Properties_Optional[] = { PROP_RELIABILITY,
|
||||
PROP_DESCRIPTION, PROP_ACTIVE_TEXT, PROP_INACTIVE_TEXT, -1 };
|
||||
static const int Properties_Optional[] = { PROP_RELIABILITY, PROP_DESCRIPTION,
|
||||
PROP_ACTIVE_TEXT, PROP_INACTIVE_TEXT,
|
||||
-1 };
|
||||
|
||||
static const int Properties_Proprietary[] = { -1 };
|
||||
|
||||
@@ -162,8 +169,7 @@ unsigned Binary_Output_Instance_To_Index(uint32_t object_instance)
|
||||
* @param pObject - pointer to the object data
|
||||
* @return The present-value of the object
|
||||
*/
|
||||
static BACNET_BINARY_PV Object_Present_Value(
|
||||
struct object_data *pObject)
|
||||
static BACNET_BINARY_PV Object_Present_Value(struct object_data *pObject)
|
||||
{
|
||||
BACNET_BINARY_PV value = BINARY_INACTIVE;
|
||||
unsigned p = 0;
|
||||
@@ -352,7 +358,8 @@ bool Binary_Output_Present_Value_Relinquish(
|
||||
* @param error_code - BACnet Error code
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Binary_Output_Present_Value_Write(uint32_t object_instance,
|
||||
static bool Binary_Output_Present_Value_Write(
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_PV value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -519,7 +526,8 @@ bool Binary_Output_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "BINARY OUTPUT %lu",
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "BINARY OUTPUT %lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
@@ -942,14 +950,13 @@ bool Binary_Output_Encode_Value_List(
|
||||
const bool overridden = false;
|
||||
BACNET_BINARY_PV value;
|
||||
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
fault = Binary_Output_Object_Fault(pObject);
|
||||
value = Object_Present_Value(pObject);
|
||||
status =
|
||||
cov_value_list_encode_enumerated(value_list, value,
|
||||
in_alarm, fault, overridden, pObject->Out_Of_Service);
|
||||
status = cov_value_list_encode_enumerated(
|
||||
value_list, value, in_alarm, fault, overridden,
|
||||
pObject->Out_Of_Service);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -1028,9 +1035,10 @@ int Binary_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_enumerated(&apdu[0], polarity);
|
||||
break;
|
||||
case PROP_PRIORITY_ARRAY:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index, Binary_Output_Priority_Array_Encode,
|
||||
BACNET_MAX_PRIORITY, apdu, apdu_size);
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Binary_Output_Priority_Array_Encode, BACNET_MAX_PRIORITY, apdu,
|
||||
apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
rpdata->error_code =
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||
@@ -1045,19 +1053,22 @@ int Binary_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_enumerated(&apdu[0], present_value);
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
characterstring_init_ansi(&char_string,
|
||||
characterstring_init_ansi(
|
||||
&char_string,
|
||||
Binary_Output_Description(rpdata->object_instance));
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_ACTIVE_TEXT:
|
||||
characterstring_init_ansi(&char_string,
|
||||
characterstring_init_ansi(
|
||||
&char_string,
|
||||
Binary_Output_Active_Text(rpdata->object_instance));
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_INACTIVE_TEXT:
|
||||
characterstring_init_ansi(&char_string,
|
||||
characterstring_init_ansi(
|
||||
&char_string,
|
||||
Binary_Output_Inactive_Text(rpdata->object_instance));
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
@@ -1126,10 +1137,10 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||
if (status) {
|
||||
status =
|
||||
Binary_Output_Present_Value_Write(wp_data->object_instance,
|
||||
value.type.Enumerated, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Binary_Output_Present_Value_Write(
|
||||
wp_data->object_instance, value.type.Enumerated,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
} else {
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||
@@ -1149,7 +1160,8 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (property_lists_member(Properties_Required, Properties_Optional,
|
||||
if (property_lists_member(
|
||||
Properties_Required, Properties_Optional,
|
||||
Properties_Proprietary, wp_data->object_property)) {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
|
||||
+86
-126
@@ -26,152 +26,112 @@
|
||||
* @param value - binary preset-value of the write
|
||||
*/
|
||||
typedef void (*binary_output_write_present_value_callback)(
|
||||
uint32_t object_instance, BACNET_BINARY_PV old_value,
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_PV old_value,
|
||||
BACNET_BINARY_PV value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Init(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Output_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Output_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Output_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Output_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Output_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Inactive_Text(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Inactive_Text_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Active_Text(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Active_Text_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Inactive_Text(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Inactive_Text_Set(uint32_t instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Active_Text(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Active_Text_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Output_Present_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Present_Value_Set(
|
||||
uint32_t instance,
|
||||
BACNET_BINARY_PV binary_value,
|
||||
unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Present_Value_Relinquish(
|
||||
uint32_t instance,
|
||||
unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Output_Present_Value_Priority(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Output_Present_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Present_Value_Set(
|
||||
uint32_t instance, BACNET_BINARY_PV binary_value, unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Present_Value_Relinquish(
|
||||
uint32_t instance, unsigned priority);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Output_Present_Value_Priority(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Write_Present_Value_Callback_Set(
|
||||
binary_output_write_present_value_callback cb);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Write_Present_Value_Callback_Set(
|
||||
binary_output_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Out_Of_Service_Set(
|
||||
uint32_t object_instance,
|
||||
bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Out_Of_Service_Set(uint32_t object_instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Description_Set(
|
||||
uint32_t object_instance,
|
||||
const char *text_string);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Description_Set(
|
||||
uint32_t object_instance, const char *text_string);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_POLARITY Binary_Output_Polarity(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Polarity_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_POLARITY polarity);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_POLARITY Binary_Output_Polarity(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Polarity_Set(
|
||||
uint32_t object_instance, BACNET_POLARITY polarity);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Binary_Output_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Binary_Output_Reliability(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Output_Relinquish_Default(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Relinquish_Default_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_PV value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Output_Relinquish_Default(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Relinquish_Default_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_PV value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Change_Of_Value_Clear(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Output_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Output_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Output_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Output_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Output_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Output_Cleanup(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1588,8 +1588,9 @@ int Binary_Value_Event_Information(
|
||||
false) |
|
||||
(pObject->Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked ==
|
||||
false);
|
||||
} else
|
||||
} else {
|
||||
return -1; /* end of list */
|
||||
}
|
||||
|
||||
if ((IsActiveEvent) || (IsNotAckedTransitions)) {
|
||||
/* Object Identifier */
|
||||
@@ -1633,8 +1634,9 @@ int Binary_Value_Event_Information(
|
||||
pObject->Notification_Class, getevent_data->eventPriorities);
|
||||
|
||||
return 1; /* active event */
|
||||
} else
|
||||
} else {
|
||||
return 0; /* no active event at this index */
|
||||
}
|
||||
}
|
||||
|
||||
int Binary_Value_Alarm_Ack(
|
||||
@@ -1774,10 +1776,12 @@ int Binary_Value_Alarm_Summary(
|
||||
&getalarm_data->acknowledgedTransitions, TRANSITION_TO_NORMAL,
|
||||
pObject->Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked);
|
||||
return 1; /* active alarm */
|
||||
} else
|
||||
} else {
|
||||
return 0; /* no active alarm at this index */
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
return -1; /* end of list */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1958,10 +1962,11 @@ void Binary_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
if ((PresentVal == pObject->Alarm_Value) &&
|
||||
((pObject->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ==
|
||||
EVENT_ENABLE_TO_OFFNORMAL)) {
|
||||
if (!pObject->Remaining_Time_Delay)
|
||||
if (!pObject->Remaining_Time_Delay) {
|
||||
pObject->Event_State = EVENT_STATE_OFFNORMAL;
|
||||
else
|
||||
} else {
|
||||
pObject->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1978,10 +1983,11 @@ void Binary_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
if ((PresentVal != pObject->Alarm_Value) &&
|
||||
((pObject->Event_Enable & EVENT_ENABLE_TO_NORMAL) ==
|
||||
EVENT_ENABLE_TO_NORMAL)) {
|
||||
if (!pObject->Remaining_Time_Delay)
|
||||
if (!pObject->Remaining_Time_Delay) {
|
||||
pObject->Event_State = EVENT_STATE_NORMAL;
|
||||
else
|
||||
} else {
|
||||
pObject->Remaining_Time_Delay--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2093,8 +2099,9 @@ void Binary_Value_Intrinsic_Reporting(uint32_t object_instance)
|
||||
/* filled before */
|
||||
|
||||
/* From State */
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION)
|
||||
if (event_data.notifyType != NOTIFY_ACK_NOTIFICATION) {
|
||||
event_data.fromState = FromState;
|
||||
}
|
||||
|
||||
/* To State */
|
||||
event_data.toState = pObject->Event_State;
|
||||
|
||||
+123
-176
@@ -31,219 +31,166 @@
|
||||
* @param value - binary preset-value of the write
|
||||
*/
|
||||
typedef void (*binary_value_write_present_value_callback)(
|
||||
uint32_t object_instance, BACNET_BINARY_PV old_value,
|
||||
uint32_t object_instance,
|
||||
BACNET_BINARY_PV old_value,
|
||||
BACNET_BINARY_PV value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Init(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Value_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Value_Instance_To_Index(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Value_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Value_Instance_To_Index(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Binary_Value_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Reliability_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_RELIABILITY value);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Binary_Value_Reliability(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Reliability_Set(
|
||||
uint32_t object_instance, BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Change_Of_Value_Clear(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Value_Present_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Present_Value_Set(
|
||||
uint32_t instance,
|
||||
BACNET_BINARY_PV value);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Present_Value_Callback_Set(
|
||||
binary_value_write_present_value_callback cb);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Value_Present_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Present_Value_Set(uint32_t instance, BACNET_BINARY_PV value);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Present_Value_Callback_Set(
|
||||
binary_value_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Disable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Disable(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Out_Of_Service(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Out_Of_Service_Set(
|
||||
uint32_t instance,
|
||||
bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Out_Of_Service(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Out_Of_Service_Set(uint32_t instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Description_Set(
|
||||
uint32_t object_instance,
|
||||
const char *text_string);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Description_Set(
|
||||
uint32_t object_instance, const char *text_string);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Inactive_Text(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Inactive_Text_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Active_Text(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Active_Text_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Inactive_Text(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Inactive_Text_Set(uint32_t instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Value_Active_Text(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Active_Text_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_POLARITY Binary_Value_Polarity(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Polarity_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_POLARITY polarity);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Create(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Delete(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Cleanup(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_POLARITY Binary_Value_Polarity(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Polarity_Set(
|
||||
uint32_t object_instance, BACNET_POLARITY polarity);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Create(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Delete(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Cleanup(void);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Value_Event_State(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Binary_Value_Event_State(uint32_t object_instance);
|
||||
|
||||
#if defined(INTRINSIC_REPORTING) && (BINARY_VALUE_INTRINSIC_REPORTING)
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Event_Detection_Enable(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Event_Detection_Enable_Set(
|
||||
uint32_t object_instance, bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Event_Detection_Enable(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Event_Detection_Enable_Set(
|
||||
uint32_t object_instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Event_Information(
|
||||
unsigned index,
|
||||
BACNET_GET_EVENT_INFORMATION_DATA * getevent_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Event_Information(
|
||||
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA * alarmack_data,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Alarm_Ack(
|
||||
BACNET_ALARM_ACK_DATA *alarmack_data, BACNET_ERROR_CODE *error_code);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Alarm_Summary(
|
||||
unsigned index,
|
||||
BACNET_GET_ALARM_SUMMARY_DATA * getalarm_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Binary_Value_Alarm_Summary(
|
||||
unsigned index, BACNET_GET_ALARM_SUMMARY_DATA *getalarm_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Time_Delay(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Time_Delay(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Time_Delay_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t time_delay);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Time_Delay_Set(uint32_t object_instance, uint32_t time_delay);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Notification_Class(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Notification_Class(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Notification_Class_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t notification_class);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Notification_Class_Set(
|
||||
uint32_t object_instance, uint32_t notification_class);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Value_Alarm_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Value_Alarm_Value(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Alarm_Value_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_PV value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Alarm_Value_Set(
|
||||
uint32_t object_instance, BACNET_BINARY_PV value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Event_Enable(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Value_Event_Enable(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Event_Enable_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t event_enable);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Event_Enable_Set(
|
||||
uint32_t object_instance, uint32_t event_enable);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_NOTIFY_TYPE Binary_Value_Notify_Type(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_NOTIFY_TYPE Binary_Value_Notify_Type(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Notify_Type_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_NOTIFY_TYPE notify_type);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Notify_Type_Set(
|
||||
uint32_t object_instance, BACNET_NOTIFY_TYPE notify_type);
|
||||
#endif
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Intrinsic_Reporting(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Intrinsic_Reporting(uint32_t object_instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ void Calendar_Write_Present_Value_Callback_Set(
|
||||
calendar_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_CALENDAR_ENTRY *Calendar_Date_List_Get(
|
||||
uint32_t object_instance, uint8_t index);
|
||||
BACNET_CALENDAR_ENTRY *
|
||||
Calendar_Date_List_Get(uint32_t object_instance, uint8_t index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Calendar_Date_List_Add(
|
||||
uint32_t object_instance, const BACNET_CALENDAR_ENTRY *value);
|
||||
|
||||
@@ -53,11 +53,20 @@ static write_property_function Write_Property_Internal_Callback;
|
||||
|
||||
/* These arrays are used by the ReadPropertyMultiple handler
|
||||
property-list property (as of protocol-revision 14) */
|
||||
static const int Channel_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_LAST_PRIORITY,
|
||||
PROP_WRITE_STATUS, PROP_STATUS_FLAGS, PROP_OUT_OF_SERVICE,
|
||||
PROP_LIST_OF_OBJECT_PROPERTY_REFERENCES, PROP_CHANNEL_NUMBER,
|
||||
PROP_CONTROL_GROUPS, -1 };
|
||||
static const int Channel_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_LAST_PRIORITY,
|
||||
PROP_WRITE_STATUS,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_LIST_OF_OBJECT_PROPERTY_REFERENCES,
|
||||
PROP_CHANNEL_NUMBER,
|
||||
PROP_CONTROL_GROUPS,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Channel_Properties_Optional[] = { -1 };
|
||||
|
||||
@@ -346,7 +355,8 @@ BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *Channel_Reference_List_Member_Element(
|
||||
*
|
||||
* @return pointer to member element or NULL if not found
|
||||
*/
|
||||
bool Channel_Reference_List_Member_Element_Set(uint32_t object_instance,
|
||||
bool Channel_Reference_List_Member_Element_Set(
|
||||
uint32_t object_instance,
|
||||
unsigned array_index,
|
||||
const BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *pMemberSrc)
|
||||
{
|
||||
@@ -359,7 +369,8 @@ bool Channel_Reference_List_Member_Element_Set(uint32_t object_instance,
|
||||
array_index--;
|
||||
if (array_index < CHANNEL_MEMBERS_MAX) {
|
||||
pMember = &pObject->Members[array_index];
|
||||
memcpy(pMember, pMemberSrc,
|
||||
memcpy(
|
||||
pMember, pMemberSrc,
|
||||
sizeof(BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE));
|
||||
status = true;
|
||||
}
|
||||
@@ -377,7 +388,8 @@ bool Channel_Reference_List_Member_Element_Set(uint32_t object_instance,
|
||||
* @return array_index - 1-based array index value for added element, or
|
||||
* zero if not added
|
||||
*/
|
||||
unsigned Channel_Reference_List_Member_Element_Add(uint32_t object_instance,
|
||||
unsigned Channel_Reference_List_Member_Element_Add(
|
||||
uint32_t object_instance,
|
||||
const BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *pMemberSrc)
|
||||
{
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *pMember = NULL;
|
||||
@@ -392,7 +404,8 @@ unsigned Channel_Reference_List_Member_Element_Add(uint32_t object_instance,
|
||||
if (!Channel_Reference_List_Member_Valid(pMember)) {
|
||||
/* first empty slot */
|
||||
array_index = 1 + m;
|
||||
memcpy(pMember, pMemberSrc,
|
||||
memcpy(
|
||||
pMember, pMemberSrc,
|
||||
sizeof(BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE));
|
||||
break;
|
||||
}
|
||||
@@ -410,8 +423,8 @@ unsigned Channel_Reference_List_Member_Element_Add(uint32_t object_instance,
|
||||
*
|
||||
* @return group number in the array, or 0 if invalid
|
||||
*/
|
||||
uint16_t Channel_Control_Groups_Element(
|
||||
uint32_t object_instance, int32_t array_index)
|
||||
uint16_t
|
||||
Channel_Control_Groups_Element(uint32_t object_instance, int32_t array_index)
|
||||
{
|
||||
uint16_t value = 0;
|
||||
const struct object_data *pObject;
|
||||
@@ -705,8 +718,8 @@ int Channel_Value_Encode(
|
||||
#endif
|
||||
#if defined(CHANNEL_OBJECT_ID)
|
||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||
apdu_len = encode_application_object_id(apdu,
|
||||
(int)value->type.Object_Id.type,
|
||||
apdu_len = encode_application_object_id(
|
||||
apdu, (int)value->type.Object_Id.type,
|
||||
value->type.Object_Id.instance);
|
||||
break;
|
||||
#endif
|
||||
@@ -742,7 +755,8 @@ int Channel_Value_Encode(
|
||||
*
|
||||
* @return number of bytes in the APDU, or BACNET_STATUS_ERROR if error.
|
||||
*/
|
||||
static int Coerce_Data_Encode(uint8_t *apdu,
|
||||
static int Coerce_Data_Encode(
|
||||
uint8_t *apdu,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_APPLICATION_TAG tag)
|
||||
{
|
||||
@@ -1058,7 +1072,8 @@ static int Coerce_Data_Encode(uint8_t *apdu,
|
||||
*
|
||||
* @return number of bytes in the APDU, or BACNET_STATUS_ERROR if error.
|
||||
*/
|
||||
int Channel_Coerce_Data_Encode(uint8_t *apdu,
|
||||
int Channel_Coerce_Data_Encode(
|
||||
uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_APPLICATION_TAG tag)
|
||||
@@ -1084,43 +1099,46 @@ int Channel_Coerce_Data_Encode(uint8_t *apdu,
|
||||
* @return true if values are within range and present-value is sent.
|
||||
*/
|
||||
bool Channel_Write_Member_Value(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data, const BACNET_APPLICATION_DATA_VALUE *value)
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
bool status = false;
|
||||
int apdu_len = 0;
|
||||
|
||||
if (wp_data && value) {
|
||||
if (((wp_data->object_type == OBJECT_ANALOG_INPUT) ||
|
||||
(wp_data->object_type == OBJECT_ANALOG_OUTPUT) ||
|
||||
(wp_data->object_type == OBJECT_ANALOG_VALUE)) &&
|
||||
(wp_data->object_type == OBJECT_ANALOG_OUTPUT) ||
|
||||
(wp_data->object_type == OBJECT_ANALOG_VALUE)) &&
|
||||
(wp_data->object_property == PROP_PRESENT_VALUE) &&
|
||||
(wp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_REAL);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
status = true;
|
||||
}
|
||||
} else if (((wp_data->object_type == OBJECT_BINARY_INPUT) ||
|
||||
(wp_data->object_type == OBJECT_BINARY_OUTPUT) ||
|
||||
(wp_data->object_type == OBJECT_BINARY_VALUE)) &&
|
||||
} else if (
|
||||
((wp_data->object_type == OBJECT_BINARY_INPUT) ||
|
||||
(wp_data->object_type == OBJECT_BINARY_OUTPUT) ||
|
||||
(wp_data->object_type == OBJECT_BINARY_VALUE)) &&
|
||||
(wp_data->object_property == PROP_PRESENT_VALUE) &&
|
||||
(wp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
status = true;
|
||||
}
|
||||
} else if (((wp_data->object_type == OBJECT_MULTI_STATE_INPUT) ||
|
||||
(wp_data->object_type == OBJECT_MULTI_STATE_OUTPUT) ||
|
||||
(wp_data->object_type == OBJECT_MULTI_STATE_VALUE)) &&
|
||||
} else if (
|
||||
((wp_data->object_type == OBJECT_MULTI_STATE_INPUT) ||
|
||||
(wp_data->object_type == OBJECT_MULTI_STATE_OUTPUT) ||
|
||||
(wp_data->object_type == OBJECT_MULTI_STATE_VALUE)) &&
|
||||
(wp_data->object_property == PROP_PRESENT_VALUE) &&
|
||||
(wp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
@@ -1129,18 +1147,19 @@ bool Channel_Write_Member_Value(
|
||||
} else if (wp_data->object_type == OBJECT_LIGHTING_OUTPUT) {
|
||||
if ((wp_data->object_property == PROP_PRESENT_VALUE) &&
|
||||
(wp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_REAL);
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len,
|
||||
value, BACNET_APPLICATION_TAG_REAL);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
status = true;
|
||||
}
|
||||
} else if ((wp_data->object_property == PROP_LIGHTING_COMMAND) &&
|
||||
} else if (
|
||||
(wp_data->object_property == PROP_LIGHTING_COMMAND) &&
|
||||
(wp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_LIGHTING_COMMAND);
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len,
|
||||
value, BACNET_APPLICATION_TAG_LIGHTING_COMMAND);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
status = true;
|
||||
@@ -1149,26 +1168,27 @@ bool Channel_Write_Member_Value(
|
||||
} else if (wp_data->object_type == OBJECT_COLOR) {
|
||||
if ((wp_data->object_property == PROP_PRESENT_VALUE) &&
|
||||
(wp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_XY_COLOR);
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len,
|
||||
value, BACNET_APPLICATION_TAG_XY_COLOR);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
status = true;
|
||||
}
|
||||
} else if ((wp_data->object_property == PROP_COLOR_COMMAND) &&
|
||||
} else if (
|
||||
(wp_data->object_property == PROP_COLOR_COMMAND) &&
|
||||
(wp_data->array_index == BACNET_ARRAY_ALL)) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_COLOR_COMMAND);
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len,
|
||||
value, BACNET_APPLICATION_TAG_COLOR_COMMAND);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
} else if (wp_data->object_type == OBJECT_COLOR_TEMPERATURE) {
|
||||
apdu_len = Channel_Coerce_Data_Encode(wp_data->application_data,
|
||||
wp_data->application_data_len, value,
|
||||
apdu_len = Channel_Coerce_Data_Encode(
|
||||
wp_data->application_data, wp_data->application_data_len, value,
|
||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||
if (apdu_len != BACNET_STATUS_ERROR) {
|
||||
wp_data->application_data_len = apdu_len;
|
||||
@@ -1190,7 +1210,8 @@ bool Channel_Write_Member_Value(
|
||||
*
|
||||
* @return true if values are within range and present-value is sent.
|
||||
*/
|
||||
static bool Channel_Write_Members(struct object_data *pObject,
|
||||
static bool Channel_Write_Members(
|
||||
struct object_data *pObject,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
uint8_t priority)
|
||||
{
|
||||
@@ -1244,7 +1265,8 @@ static bool Channel_Write_Members(struct object_data *pObject,
|
||||
* @return true if values are within range and present-value is sent.
|
||||
*/
|
||||
bool Channel_Present_Value_Set(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data, const BACNET_APPLICATION_DATA_VALUE *value)
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -1299,7 +1321,8 @@ bool Channel_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "CHANNEL-%lu",
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "CHANNEL-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
@@ -1459,8 +1482,8 @@ int Channel_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
case PROP_LIST_OF_OBJECT_PROPERTY_REFERENCES:
|
||||
count =
|
||||
Channel_Reference_List_Member_Count(rpdata->object_instance);
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index,
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Channel_Reference_List_Member_Element_Encode, count, apdu,
|
||||
apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
@@ -1476,9 +1499,10 @@ int Channel_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = encode_application_unsigned(apdu, unsigned_value);
|
||||
break;
|
||||
case PROP_CONTROL_GROUPS:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index, Channel_Control_Groups_Element_Encode,
|
||||
CONTROL_GROUPS_MAX, apdu, apdu_size);
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Channel_Control_Groups_Element_Encode, CONTROL_GROUPS_MAX, apdu,
|
||||
apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
rpdata->error_code =
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||
@@ -1586,7 +1610,7 @@ bool Channel_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
do {
|
||||
if ((element_len > 0) &&
|
||||
(value.tag ==
|
||||
BACNET_APPLICATION_TAG_UNSIGNED_INT)) {
|
||||
BACNET_APPLICATION_TAG_UNSIGNED_INT)) {
|
||||
if ((wp_data->array_index <= CONTROL_GROUPS_MAX) &&
|
||||
(value.type.Unsigned_Int <= 65535)) {
|
||||
status = Channel_Control_Groups_Element_Set(
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
/* BACNET_CHANNEL_VALUE decodes WriteProperty service requests
|
||||
Choose the datatypes that your application supports */
|
||||
#if !(defined(CHANNEL_NUMERIC) || defined(CHANNEL_NULL) || \
|
||||
#if !( \
|
||||
defined(CHANNEL_NUMERIC) || defined(CHANNEL_NULL) || \
|
||||
defined(CHANNEL_BOOLEAN) || defined(CHANNEL_UNSIGNED) || \
|
||||
defined(CHANNEL_SIGNED) || defined(CHANNEL_REAL) || \
|
||||
defined(CHANNEL_DOUBLE) || defined(CHANNEL_OCTET_STRING) || \
|
||||
@@ -132,7 +133,8 @@ BACNET_STACK_EXPORT
|
||||
BACNET_CHANNEL_VALUE *Channel_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Channel_Present_Value_Set(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data, const BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Channel_Out_Of_Service(uint32_t object_instance);
|
||||
@@ -153,15 +155,17 @@ BACNET_STACK_EXPORT
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *Channel_Reference_List_Member_Element(
|
||||
uint32_t object_instance, unsigned element);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Channel_Reference_List_Member_Element_Set(uint32_t object_instance,
|
||||
bool Channel_Reference_List_Member_Element_Set(
|
||||
uint32_t object_instance,
|
||||
unsigned array_index,
|
||||
const BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *pMemberSrc);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Channel_Reference_List_Member_Element_Add(uint32_t object_instance,
|
||||
unsigned Channel_Reference_List_Member_Element_Add(
|
||||
uint32_t object_instance,
|
||||
const BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *pMemberSrc);
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Channel_Control_Groups_Element(
|
||||
uint32_t object_instance, int32_t array_index);
|
||||
uint16_t
|
||||
Channel_Control_Groups_Element(uint32_t object_instance, int32_t array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Channel_Control_Groups_Element_Set(
|
||||
uint32_t object_instance, int32_t array_index, uint16_t value);
|
||||
@@ -172,17 +176,18 @@ BACNET_STACK_EXPORT
|
||||
int Channel_Value_Encode(
|
||||
uint8_t *apdu, int apdu_max, const BACNET_CHANNEL_VALUE *value);
|
||||
BACNET_STACK_EXPORT
|
||||
int Channel_Coerce_Data_Encode(uint8_t *apdu,
|
||||
int Channel_Coerce_Data_Encode(
|
||||
uint8_t *apdu,
|
||||
size_t apdu_size,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value,
|
||||
BACNET_APPLICATION_TAG tag);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Channel_Write_Member_Value(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data, const BACNET_APPLICATION_DATA_VALUE *value);
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||
const BACNET_APPLICATION_DATA_VALUE *value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Channel_Write_Property_Internal_Callback_Set(
|
||||
write_property_function cb);
|
||||
void Channel_Write_Property_Internal_Callback_Set(write_property_function cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Channel_Create(uint32_t object_instance);
|
||||
|
||||
@@ -84,39 +84,73 @@ static uint32_t Database_Revision = 0;
|
||||
|
||||
/* external prototypes */
|
||||
extern int Routed_Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
extern bool Routed_Device_Write_Property_Local(
|
||||
BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
extern bool
|
||||
Routed_Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
/* All included BACnet objects */
|
||||
static object_functions_t Object_Table[] = {
|
||||
{ OBJECT_DEVICE, NULL /* Init - don't init Device or it will recourse! */,
|
||||
Device_Count, Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number, Device_Object_Name,
|
||||
Device_Read_Property_Local, NULL /* Write_Property */,
|
||||
Device_Property_Lists, NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* Value_Lists */, NULL /* COV */, NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
NULL /* Create */, NULL /* Delete */, NULL /* Timer */ },
|
||||
{ OBJECT_DEVICE,
|
||||
NULL /* Init - don't init Device or it will recourse! */,
|
||||
Device_Count,
|
||||
Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number,
|
||||
Device_Object_Name,
|
||||
Device_Read_Property_Local,
|
||||
NULL /* Write_Property */,
|
||||
Device_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */,
|
||||
NULL /* Remove_List_Element */,
|
||||
NULL /* Create */,
|
||||
NULL /* Delete */,
|
||||
NULL /* Timer */ },
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
{ OBJECT_NETWORK_PORT, Network_Port_Init, Network_Port_Count,
|
||||
Network_Port_Index_To_Instance, Network_Port_Valid_Instance,
|
||||
Network_Port_Object_Name, Network_Port_Read_Property,
|
||||
Network_Port_Write_Property, Network_Port_Property_Lists,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
NULL /* Create */, NULL /* Delete */, NULL /* Timer */ },
|
||||
{ OBJECT_NETWORK_PORT,
|
||||
Network_Port_Init,
|
||||
Network_Port_Count,
|
||||
Network_Port_Index_To_Instance,
|
||||
Network_Port_Valid_Instance,
|
||||
Network_Port_Object_Name,
|
||||
Network_Port_Read_Property,
|
||||
Network_Port_Write_Property,
|
||||
Network_Port_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */,
|
||||
NULL /* Remove_List_Element */,
|
||||
NULL /* Create */,
|
||||
NULL /* Delete */,
|
||||
NULL /* Timer */ },
|
||||
#endif
|
||||
{ MAX_BACNET_OBJECT_TYPE, NULL /* Init */, NULL /* Count */,
|
||||
NULL /* Index_To_Instance */, NULL /* Valid_Instance */,
|
||||
NULL /* Object_Name */, NULL /* Read_Property */,
|
||||
NULL /* Write_Property */, NULL /* Property_Lists */,
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
||||
NULL /* COV */, NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
NULL /* Create */, NULL /* Delete */, NULL /* Timer */ },
|
||||
{ MAX_BACNET_OBJECT_TYPE,
|
||||
NULL /* Init */,
|
||||
NULL /* Count */,
|
||||
NULL /* Index_To_Instance */,
|
||||
NULL /* Valid_Instance */,
|
||||
NULL /* Object_Name */,
|
||||
NULL /* Read_Property */,
|
||||
NULL /* Write_Property */,
|
||||
NULL /* Property_Lists */,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */,
|
||||
NULL /* Add_List_Element */,
|
||||
NULL /* Remove_List_Element */,
|
||||
NULL /* Create */,
|
||||
NULL /* Delete */,
|
||||
NULL /* Timer */ },
|
||||
};
|
||||
|
||||
/** Glue function to let the Device object, when called by a handler,
|
||||
@@ -127,8 +161,8 @@ static object_functions_t Object_Table[] = {
|
||||
* @return Pointer to the group of object helper functions that implement this
|
||||
* type of Object.
|
||||
*/
|
||||
static struct object_functions *Device_Objects_Find_Functions(
|
||||
BACNET_OBJECT_TYPE Object_Type)
|
||||
static struct object_functions *
|
||||
Device_Objects_Find_Functions(BACNET_OBJECT_TYPE Object_Type)
|
||||
{
|
||||
struct object_functions *pObject = NULL;
|
||||
|
||||
@@ -175,7 +209,8 @@ rr_info_function Device_Objects_RR_Info(BACNET_OBJECT_TYPE object_type)
|
||||
* list, separately, the Required, Optional, and Proprietary object
|
||||
* properties with their counts.
|
||||
*/
|
||||
void Device_Objects_Property_List(BACNET_OBJECT_TYPE object_type,
|
||||
void Device_Objects_Property_List(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
struct special_property_list_t *pPropertyList)
|
||||
{
|
||||
@@ -193,8 +228,9 @@ void Device_Objects_Property_List(BACNET_OBJECT_TYPE object_type,
|
||||
|
||||
pObject = Device_Objects_Find_Functions(object_type);
|
||||
if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) {
|
||||
pObject->Object_RPM_List(&pPropertyList->Required.pList,
|
||||
&pPropertyList->Optional.pList, &pPropertyList->Proprietary.pList);
|
||||
pObject->Object_RPM_List(
|
||||
&pPropertyList->Required.pList, &pPropertyList->Optional.pList,
|
||||
&pPropertyList->Proprietary.pList);
|
||||
}
|
||||
|
||||
/* Fetch the counts if available otherwise zero them */
|
||||
@@ -214,21 +250,35 @@ void Device_Objects_Property_List(BACNET_OBJECT_TYPE object_type,
|
||||
}
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Device_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_SYSTEM_STATUS, PROP_VENDOR_NAME,
|
||||
PROP_VENDOR_IDENTIFIER, PROP_MODEL_NAME, PROP_FIRMWARE_REVISION,
|
||||
PROP_APPLICATION_SOFTWARE_VERSION, PROP_PROTOCOL_VERSION,
|
||||
PROP_PROTOCOL_REVISION, PROP_PROTOCOL_SERVICES_SUPPORTED,
|
||||
PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED, PROP_OBJECT_LIST,
|
||||
PROP_MAX_APDU_LENGTH_ACCEPTED, PROP_SEGMENTATION_SUPPORTED,
|
||||
PROP_APDU_TIMEOUT, PROP_NUMBER_OF_APDU_RETRIES, PROP_DEVICE_ADDRESS_BINDING,
|
||||
PROP_DATABASE_REVISION, -1 };
|
||||
static const int Device_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_SYSTEM_STATUS,
|
||||
PROP_VENDOR_NAME,
|
||||
PROP_VENDOR_IDENTIFIER,
|
||||
PROP_MODEL_NAME,
|
||||
PROP_FIRMWARE_REVISION,
|
||||
PROP_APPLICATION_SOFTWARE_VERSION,
|
||||
PROP_PROTOCOL_VERSION,
|
||||
PROP_PROTOCOL_REVISION,
|
||||
PROP_PROTOCOL_SERVICES_SUPPORTED,
|
||||
PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED,
|
||||
PROP_OBJECT_LIST,
|
||||
PROP_MAX_APDU_LENGTH_ACCEPTED,
|
||||
PROP_SEGMENTATION_SUPPORTED,
|
||||
PROP_APDU_TIMEOUT,
|
||||
PROP_NUMBER_OF_APDU_RETRIES,
|
||||
PROP_DEVICE_ADDRESS_BINDING,
|
||||
PROP_DATABASE_REVISION,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Device_Properties_Optional[] = {
|
||||
#if defined(BACDL_MSTP)
|
||||
PROP_MAX_MASTER, PROP_MAX_INFO_FRAMES,
|
||||
PROP_MAX_MASTER, PROP_MAX_INFO_FRAMES,
|
||||
#endif
|
||||
PROP_DESCRIPTION, PROP_LOCATION, PROP_ACTIVE_COV_SUBSCRIPTIONS, -1
|
||||
PROP_DESCRIPTION, PROP_LOCATION, PROP_ACTIVE_COV_SUBSCRIPTIONS, -1
|
||||
};
|
||||
|
||||
static const int Device_Properties_Proprietary[] = { -1 };
|
||||
@@ -724,7 +774,8 @@ int Device_Object_List_Element_Encode(
|
||||
* Object.
|
||||
* @return True on success or else False if not found.
|
||||
*/
|
||||
bool Device_Valid_Object_Name(const BACNET_CHARACTER_STRING *object_name1,
|
||||
bool Device_Valid_Object_Name(
|
||||
const BACNET_CHARACTER_STRING *object_name1,
|
||||
BACNET_OBJECT_TYPE *object_type,
|
||||
uint32_t *object_instance)
|
||||
{
|
||||
@@ -743,7 +794,7 @@ bool Device_Valid_Object_Name(const BACNET_CHARACTER_STRING *object_name1,
|
||||
pObject = Device_Objects_Find_Functions(type);
|
||||
if ((pObject != NULL) && (pObject->Object_Name != NULL) &&
|
||||
(pObject->Object_Name(instance, &object_name2) &&
|
||||
characterstring_same(object_name1, &object_name2))) {
|
||||
characterstring_same(object_name1, &object_name2))) {
|
||||
found = true;
|
||||
if (object_type) {
|
||||
*object_type = type;
|
||||
@@ -784,7 +835,8 @@ bool Device_Valid_Object_Id(
|
||||
* @param object_name [out] The Object Name found for this child Object.
|
||||
* @return True on success or else False if not found.
|
||||
*/
|
||||
bool Device_Object_Name_Copy(BACNET_OBJECT_TYPE object_type,
|
||||
bool Device_Object_Name_Copy(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
@@ -980,7 +1032,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
bitstring_init(&bit_string);
|
||||
for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) {
|
||||
/* automatic lookup based on handlers set */
|
||||
bitstring_set_bit(&bit_string, (uint8_t)i,
|
||||
bitstring_set_bit(
|
||||
&bit_string, (uint8_t)i,
|
||||
apdu_service_supported((BACNET_SERVICES_SUPPORTED)i));
|
||||
}
|
||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||
@@ -1006,10 +1059,9 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
break;
|
||||
case PROP_OBJECT_LIST:
|
||||
count = Device_Object_List_Count();
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index,
|
||||
Device_Object_List_Element_Encode,
|
||||
count, apdu, apdu_size);
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Device_Object_List_Element_Encode, count, apdu, apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
rpdata->error_code =
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||
@@ -1095,10 +1147,11 @@ int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
if (pObject->Object_Read_Property) {
|
||||
#if (BACNET_PROTOCOL_REVISION >= 14)
|
||||
if ((int)rpdata->object_property == PROP_PROPERTY_LIST) {
|
||||
Device_Objects_Property_List(rpdata->object_type,
|
||||
rpdata->object_instance, &property_list);
|
||||
apdu_len = property_list_encode(rpdata,
|
||||
property_list.Required.pList,
|
||||
Device_Objects_Property_List(
|
||||
rpdata->object_type, rpdata->object_instance,
|
||||
&property_list);
|
||||
apdu_len = property_list_encode(
|
||||
rpdata, property_list.Required.pList,
|
||||
property_list.Optional.pList,
|
||||
property_list.Proprietary.pList);
|
||||
} else
|
||||
@@ -1123,8 +1176,7 @@ int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
* @brief Updates all the object timers with elapsed milliseconds
|
||||
* @param milliseconds - number of milliseconds elapsed
|
||||
*/
|
||||
void Device_Timer(
|
||||
uint16_t milliseconds)
|
||||
void Device_Timer(uint16_t milliseconds)
|
||||
{
|
||||
struct object_functions *pObject;
|
||||
unsigned count = 0;
|
||||
|
||||
@@ -62,13 +62,16 @@ static OS_Keylist Object_List;
|
||||
static color_write_present_value_callback Color_Write_Present_Value_Callback;
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Color_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_TRACKING_VALUE,
|
||||
PROP_COLOR_COMMAND, PROP_IN_PROGRESS, PROP_DEFAULT_COLOR,
|
||||
PROP_DEFAULT_FADE_TIME, -1 };
|
||||
static const int Color_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE, PROP_PRESENT_VALUE,
|
||||
PROP_TRACKING_VALUE, PROP_COLOR_COMMAND,
|
||||
PROP_IN_PROGRESS, PROP_DEFAULT_COLOR,
|
||||
PROP_DEFAULT_FADE_TIME, -1
|
||||
};
|
||||
|
||||
static const int Color_Properties_Optional[] = { PROP_DESCRIPTION,
|
||||
PROP_TRANSITION, -1 };
|
||||
PROP_TRANSITION, -1 };
|
||||
|
||||
static const int Color_Properties_Proprietary[] = { -1 };
|
||||
|
||||
@@ -188,7 +191,8 @@ bool Color_Present_Value(uint32_t object_instance, BACNET_XY_COLOR *value)
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
bool Color_Present_Value_Set(uint32_t object_instance, const BACNET_XY_COLOR *value)
|
||||
bool Color_Present_Value_Set(
|
||||
uint32_t object_instance, const BACNET_XY_COLOR *value)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
@@ -213,7 +217,8 @@ bool Color_Present_Value_Set(uint32_t object_instance, const BACNET_XY_COLOR *va
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Present_Value_Write(uint32_t object_instance,
|
||||
static bool Color_Present_Value_Write(
|
||||
uint32_t object_instance,
|
||||
const BACNET_XY_COLOR *value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -342,7 +347,8 @@ bool Color_Command_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Command_Write(uint32_t object_instance,
|
||||
static bool Color_Command_Write(
|
||||
uint32_t object_instance,
|
||||
const BACNET_COLOR_COMMAND *value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -468,7 +474,8 @@ bool Color_Default_Color_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Default_Color_Write(uint32_t object_instance,
|
||||
static bool Color_Default_Color_Write(
|
||||
uint32_t object_instance,
|
||||
const BACNET_XY_COLOR *value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -532,7 +539,7 @@ bool Color_Default_Fade_Time_Set(uint32_t object_instance, uint32_t value)
|
||||
if (pObject) {
|
||||
if ((value == 0) ||
|
||||
((value >= BACNET_COLOR_FADE_TIME_MIN) &&
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
pObject->Default_Fade_Time = value;
|
||||
}
|
||||
status = true;
|
||||
@@ -552,7 +559,8 @@ bool Color_Default_Fade_Time_Set(uint32_t object_instance, uint32_t value)
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Default_Fade_Time_Write(uint32_t object_instance,
|
||||
static bool Color_Default_Fade_Time_Write(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -567,7 +575,7 @@ static bool Color_Default_Fade_Time_Write(uint32_t object_instance,
|
||||
if (pObject->Write_Enabled) {
|
||||
if ((value == 0) ||
|
||||
((value >= BACNET_COLOR_FADE_TIME_MIN) &&
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
pObject->Default_Fade_Time = value;
|
||||
status = true;
|
||||
} else {
|
||||
@@ -640,7 +648,8 @@ bool Color_Transition_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Transition_Write(uint32_t object_instance,
|
||||
static bool Color_Transition_Write(
|
||||
uint32_t object_instance,
|
||||
uint32_t value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -802,8 +811,8 @@ bool Color_Description_Set(uint32_t object_instance, const char *new_name)
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param milliseconds - number of milliseconds elapsed
|
||||
*/
|
||||
static void Color_Fade_To_Color_Handler(
|
||||
uint32_t object_instance, uint16_t milliseconds)
|
||||
static void
|
||||
Color_Fade_To_Color_Handler(uint32_t object_instance, uint16_t milliseconds)
|
||||
{
|
||||
BACNET_XY_COLOR old_value;
|
||||
struct object_data *pObject;
|
||||
@@ -836,12 +845,12 @@ static void Color_Fade_To_Color_Handler(
|
||||
x3 = (float)pObject->Color_Command.transit.fade_time;
|
||||
y1 = old_value.x_coordinate;
|
||||
y3 = pObject->Color_Command.target.color.x_coordinate;
|
||||
pObject->Tracking_Value.x_coordinate = linear_interpolate(x1, x2,
|
||||
x3, y1, y3);
|
||||
pObject->Tracking_Value.x_coordinate =
|
||||
linear_interpolate(x1, x2, x3, y1, y3);
|
||||
y1 = old_value.y_coordinate;
|
||||
y3 = pObject->Color_Command.target.color.y_coordinate;
|
||||
pObject->Tracking_Value.y_coordinate = linear_interpolate(x1, x2,
|
||||
x3, y1, y3);
|
||||
pObject->Tracking_Value.y_coordinate =
|
||||
linear_interpolate(x1, x2, x3, y1, y3);
|
||||
pObject->Color_Command.transit.fade_time -= milliseconds;
|
||||
pObject->In_Progress =
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS_FADE_ACTIVE;
|
||||
@@ -870,8 +879,7 @@ void Color_Timer(uint32_t object_instance, uint16_t milliseconds)
|
||||
pObject->In_Progress = BACNET_COLOR_OPERATION_IN_PROGRESS_IDLE;
|
||||
break;
|
||||
case BACNET_COLOR_OPERATION_FADE_TO_COLOR:
|
||||
Color_Fade_To_Color_Handler(
|
||||
object_instance, milliseconds);
|
||||
Color_Fade_To_Color_Handler(object_instance, milliseconds);
|
||||
break;
|
||||
case BACNET_COLOR_OPERATION_STOP:
|
||||
pObject->In_Progress = BACNET_COLOR_OPERATION_IN_PROGRESS_IDLE;
|
||||
@@ -995,8 +1003,9 @@ bool Color_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
/* decode the some of the request */
|
||||
apdu = wp_data->application_data;
|
||||
apdu_size = wp_data->application_data_len;
|
||||
len = bacapp_decode_known_property(apdu, apdu_size, &value,
|
||||
wp_data->object_type, wp_data->object_property);
|
||||
len = bacapp_decode_known_property(
|
||||
apdu, apdu_size, &value, wp_data->object_type,
|
||||
wp_data->object_property);
|
||||
/* FIXME: len < application_data_len: more data? */
|
||||
if (len < 0) {
|
||||
/* error while decoding - a value larger than we can handle */
|
||||
@@ -1017,45 +1026,50 @@ bool Color_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_XY_COLOR);
|
||||
if (status) {
|
||||
status = Color_Present_Value_Write(wp_data->object_instance,
|
||||
&value.type.XY_Color, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Color_Present_Value_Write(
|
||||
wp_data->object_instance, &value.type.XY_Color,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
}
|
||||
break;
|
||||
case PROP_COLOR_COMMAND:
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_COLOR_COMMAND);
|
||||
if (status) {
|
||||
status = Color_Command_Write(wp_data->object_instance,
|
||||
&value.type.Color_Command, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Color_Command_Write(
|
||||
wp_data->object_instance, &value.type.Color_Command,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
}
|
||||
break;
|
||||
case PROP_DEFAULT_COLOR:
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_XY_COLOR);
|
||||
if (status) {
|
||||
status = Color_Default_Color_Write(wp_data->object_instance,
|
||||
&value.type.XY_Color, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Color_Default_Color_Write(
|
||||
wp_data->object_instance, &value.type.XY_Color,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
}
|
||||
break;
|
||||
case PROP_DEFAULT_FADE_TIME:
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||
if (status) {
|
||||
status = Color_Default_Fade_Time_Write(wp_data->object_instance,
|
||||
value.type.Unsigned_Int, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Color_Default_Fade_Time_Write(
|
||||
wp_data->object_instance, value.type.Unsigned_Int,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
}
|
||||
break;
|
||||
case PROP_TRANSITION:
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||
if (status) {
|
||||
status = Color_Transition_Write(wp_data->object_instance,
|
||||
value.type.Enumerated, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Color_Transition_Write(
|
||||
wp_data->object_instance, value.type.Enumerated,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
}
|
||||
break;
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
* @param old_value - BACnetXYColor value prior to write
|
||||
* @param value - BACnetXYColor value of the write
|
||||
*/
|
||||
typedef void (*color_write_present_value_callback)(uint32_t object_instance,
|
||||
typedef void (*color_write_present_value_callback)(
|
||||
uint32_t object_instance,
|
||||
BACNET_XY_COLOR *old_value,
|
||||
BACNET_XY_COLOR *value);
|
||||
|
||||
|
||||
@@ -57,14 +57,24 @@ static color_temperature_write_present_value_callback
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Color_Temperature_Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE, PROP_TRACKING_VALUE, PROP_COLOR_COMMAND,
|
||||
PROP_IN_PROGRESS, PROP_DEFAULT_COLOR_TEMPERATURE, PROP_DEFAULT_FADE_TIME,
|
||||
PROP_DEFAULT_RAMP_RATE, PROP_DEFAULT_STEP_INCREMENT, -1
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_TRACKING_VALUE,
|
||||
PROP_COLOR_COMMAND,
|
||||
PROP_IN_PROGRESS,
|
||||
PROP_DEFAULT_COLOR_TEMPERATURE,
|
||||
PROP_DEFAULT_FADE_TIME,
|
||||
PROP_DEFAULT_RAMP_RATE,
|
||||
PROP_DEFAULT_STEP_INCREMENT,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Color_Temperature_Properties_Optional[] = { PROP_DESCRIPTION,
|
||||
PROP_TRANSITION, PROP_MIN_PRES_VALUE, PROP_MAX_PRES_VALUE, -1 };
|
||||
static const int Color_Temperature_Properties_Optional[] = {
|
||||
PROP_DESCRIPTION, PROP_TRANSITION, PROP_MIN_PRES_VALUE, PROP_MAX_PRES_VALUE,
|
||||
-1
|
||||
};
|
||||
|
||||
static const int Color_Temperature_Properties_Proprietary[] = { -1 };
|
||||
|
||||
@@ -208,7 +218,8 @@ bool Color_Temperature_Present_Value_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Temperature_Present_Value_Write(uint32_t object_instance,
|
||||
static bool Color_Temperature_Present_Value_Write(
|
||||
uint32_t object_instance,
|
||||
uint32_t value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -430,8 +441,8 @@ bool Color_Temperature_Command_Set(
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return property value
|
||||
*/
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS Color_Temperature_In_Progress(
|
||||
uint32_t object_instance)
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS
|
||||
Color_Temperature_In_Progress(uint32_t object_instance)
|
||||
{
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS value =
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS_MAX;
|
||||
@@ -523,7 +534,8 @@ bool Color_Temperature_Default_Color_Temperature_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Temperature_Default_Write(uint32_t object_instance,
|
||||
static bool Color_Temperature_Default_Write(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -592,7 +604,7 @@ bool Color_Temperature_Default_Fade_Time_Set(
|
||||
if (pObject) {
|
||||
if ((value == 0) ||
|
||||
((value >= BACNET_COLOR_FADE_TIME_MIN) &&
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
pObject->Default_Fade_Time = value;
|
||||
}
|
||||
status = true;
|
||||
@@ -612,7 +624,8 @@ bool Color_Temperature_Default_Fade_Time_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Temperature_Default_Fade_Time_Write(uint32_t object_instance,
|
||||
static bool Color_Temperature_Default_Fade_Time_Write(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -627,7 +640,7 @@ static bool Color_Temperature_Default_Fade_Time_Write(uint32_t object_instance,
|
||||
if (pObject->Write_Enabled) {
|
||||
if ((value == 0) ||
|
||||
((value >= BACNET_COLOR_FADE_TIME_MIN) &&
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
(value <= BACNET_COLOR_FADE_TIME_MAX))) {
|
||||
pObject->Default_Fade_Time = value;
|
||||
status = true;
|
||||
} else {
|
||||
@@ -698,7 +711,8 @@ bool Color_Temperature_Default_Ramp_Rate_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Temperature_Default_Ramp_Rate_Write(uint32_t object_instance,
|
||||
static bool Color_Temperature_Default_Ramp_Rate_Write(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -713,7 +727,7 @@ static bool Color_Temperature_Default_Ramp_Rate_Write(uint32_t object_instance,
|
||||
if (pObject->Write_Enabled) {
|
||||
if ((value == 0) ||
|
||||
((value >= BACNET_COLOR_RAMP_RATE_MIN) &&
|
||||
(value <= BACNET_COLOR_RAMP_RATE_MAX))) {
|
||||
(value <= BACNET_COLOR_RAMP_RATE_MAX))) {
|
||||
pObject->Default_Fade_Time = value;
|
||||
status = true;
|
||||
} else {
|
||||
@@ -800,7 +814,7 @@ static bool Color_Temperature_Default_Step_Increment_Write(
|
||||
if (pObject->Write_Enabled) {
|
||||
if ((value == 0) ||
|
||||
((value >= BACNET_COLOR_STEP_INCREMENT_MIN) &&
|
||||
(value <= BACNET_COLOR_STEP_INCREMENT_MAX))) {
|
||||
(value <= BACNET_COLOR_STEP_INCREMENT_MAX))) {
|
||||
pObject->Default_Fade_Time = value;
|
||||
status = true;
|
||||
} else {
|
||||
@@ -873,7 +887,8 @@ bool Color_Temperature_Transition_Set(
|
||||
*
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
static bool Color_Transition_Write(uint32_t object_instance,
|
||||
static bool Color_Transition_Write(
|
||||
uint32_t object_instance,
|
||||
uint32_t value,
|
||||
uint8_t priority,
|
||||
BACNET_ERROR_CLASS *error_class,
|
||||
@@ -928,7 +943,8 @@ bool Color_Temperature_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "COLOR-TEMPERATURE-%u",
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "COLOR-TEMPERATURE-%u",
|
||||
object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
@@ -1074,9 +1090,9 @@ static void Color_Temperature_Fade_To_CCT_Handler(
|
||||
pObject->Color_Command.transit.fade_time = 0;
|
||||
} else {
|
||||
/* fading */
|
||||
pObject->Tracking_Value = linear_interpolate_int(0, milliseconds,
|
||||
pObject->Color_Command.transit.fade_time, old_value,
|
||||
target_value);
|
||||
pObject->Tracking_Value = linear_interpolate_int(
|
||||
0, milliseconds, pObject->Color_Command.transit.fade_time,
|
||||
old_value, target_value);
|
||||
pObject->Color_Command.transit.fade_time -= milliseconds;
|
||||
pObject->In_Progress =
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS_FADE_ACTIVE;
|
||||
@@ -1326,15 +1342,18 @@ int Color_Temperature_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu, Color_Temperature_Present_Value(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_MIN_PRES_VALUE:
|
||||
apdu_len = encode_application_unsigned(apdu,
|
||||
apdu_len = encode_application_unsigned(
|
||||
apdu,
|
||||
Color_Temperature_Min_Pres_Value(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_MAX_PRES_VALUE:
|
||||
apdu_len = encode_application_unsigned(apdu,
|
||||
apdu_len = encode_application_unsigned(
|
||||
apdu,
|
||||
Color_Temperature_Max_Pres_Value(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_TRACKING_VALUE:
|
||||
apdu_len = encode_application_unsigned(apdu,
|
||||
apdu_len = encode_application_unsigned(
|
||||
apdu,
|
||||
Color_Temperature_Tracking_Value(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_COLOR_COMMAND:
|
||||
@@ -1348,20 +1367,24 @@ int Color_Temperature_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu, Color_Temperature_In_Progress(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_DEFAULT_COLOR_TEMPERATURE:
|
||||
apdu_len = encode_application_unsigned(apdu,
|
||||
apdu_len = encode_application_unsigned(
|
||||
apdu,
|
||||
Color_Temperature_Default_Color_Temperature(
|
||||
rpdata->object_instance));
|
||||
break;
|
||||
case PROP_DEFAULT_FADE_TIME:
|
||||
apdu_len = encode_application_unsigned(apdu,
|
||||
apdu_len = encode_application_unsigned(
|
||||
apdu,
|
||||
Color_Temperature_Default_Fade_Time(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_DEFAULT_RAMP_RATE:
|
||||
apdu_len = encode_application_unsigned(apdu,
|
||||
apdu_len = encode_application_unsigned(
|
||||
apdu,
|
||||
Color_Temperature_Default_Ramp_Rate(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_DEFAULT_STEP_INCREMENT:
|
||||
apdu_len = encode_application_unsigned(apdu,
|
||||
apdu_len = encode_application_unsigned(
|
||||
apdu,
|
||||
Color_Temperature_Default_Step_Increment(
|
||||
rpdata->object_instance));
|
||||
break;
|
||||
@@ -1370,7 +1393,8 @@ int Color_Temperature_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu, Color_Temperature_Transition(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
characterstring_init_ansi(&char_string,
|
||||
characterstring_init_ansi(
|
||||
&char_string,
|
||||
Color_Temperature_Description(rpdata->object_instance));
|
||||
apdu_len = encode_application_character_string(apdu, &char_string);
|
||||
break;
|
||||
@@ -1412,8 +1436,9 @@ bool Color_Temperature_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
/* decode the some of the request */
|
||||
apdu = wp_data->application_data;
|
||||
apdu_size = wp_data->application_data_len;
|
||||
len = bacapp_decode_known_property(apdu, apdu_size, &value,
|
||||
wp_data->object_type, wp_data->object_property);
|
||||
len = bacapp_decode_known_property(
|
||||
apdu, apdu_size, &value, wp_data->object_type,
|
||||
wp_data->object_property);
|
||||
if (len < 0) {
|
||||
/* error while decoding - a value larger than we can handle */
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
@@ -1443,10 +1468,10 @@ bool Color_Temperature_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||
if (status) {
|
||||
status =
|
||||
Color_Temperature_Default_Write(wp_data->object_instance,
|
||||
value.type.Unsigned_Int, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Color_Temperature_Default_Write(
|
||||
wp_data->object_instance, value.type.Unsigned_Int,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
}
|
||||
break;
|
||||
case PROP_DEFAULT_FADE_TIME:
|
||||
@@ -1463,9 +1488,10 @@ bool Color_Temperature_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||
if (status) {
|
||||
status = Color_Transition_Write(wp_data->object_instance,
|
||||
value.type.Enumerated, wp_data->priority,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
status = Color_Transition_Write(
|
||||
wp_data->object_instance, value.type.Enumerated,
|
||||
wp_data->priority, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
}
|
||||
break;
|
||||
case PROP_DEFAULT_RAMP_RATE:
|
||||
|
||||
@@ -45,8 +45,7 @@ BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_Name_Set(
|
||||
uint32_t object_instance, const char *new_name);
|
||||
bool Color_Temperature_Name_Set(uint32_t object_instance, const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Color_Temperature_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
@@ -103,22 +102,20 @@ bool Color_Temperature_Default_Fade_Time_Set(
|
||||
uint32_t object_instance, uint32_t value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Color_Temperature_Default_Ramp_Rate(
|
||||
uint32_t object_instance);
|
||||
uint32_t Color_Temperature_Default_Ramp_Rate(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_Default_Ramp_Rate_Set(
|
||||
uint32_t object_instance, uint32_t value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Color_Temperature_Default_Step_Increment(
|
||||
uint32_t object_instance);
|
||||
uint32_t Color_Temperature_Default_Step_Increment(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_Default_Step_Increment_Set(
|
||||
uint32_t object_instance, uint32_t value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS Color_Temperature_In_Progress(
|
||||
uint32_t object_instance);
|
||||
BACNET_COLOR_OPERATION_IN_PROGRESS
|
||||
Color_Temperature_In_Progress(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_In_Progress_Set(
|
||||
uint32_t object_instance, BACNET_COLOR_OPERATION_IN_PROGRESS value);
|
||||
@@ -132,8 +129,7 @@ bool Color_Temperature_Transition_Set(
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Color_Temperature_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_Description_Set(
|
||||
uint32_t instance, const char *new_name);
|
||||
bool Color_Temperature_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_Write_Enabled(uint32_t instance);
|
||||
|
||||
@@ -325,8 +325,7 @@ static COMMAND_DESCR *Object_Data(uint32_t object_instance)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BACNET_ACTION_LIST * Command_Action_List_Entry(
|
||||
uint32_t instance, unsigned index)
|
||||
BACNET_ACTION_LIST *Command_Action_List_Entry(uint32_t instance, unsigned index)
|
||||
{
|
||||
COMMAND_DESCR *pObject;
|
||||
BACNET_ACTION_LIST *pAction = NULL;
|
||||
@@ -342,8 +341,7 @@ BACNET_ACTION_LIST * Command_Action_List_Entry(
|
||||
/**
|
||||
* @brief For a given object instance-number, returns the number of actions
|
||||
*/
|
||||
unsigned Command_Action_List_Count(
|
||||
uint32_t instance)
|
||||
unsigned Command_Action_List_Count(uint32_t instance)
|
||||
{
|
||||
(void)instance;
|
||||
return MAX_COMMAND_ACTIONS;
|
||||
@@ -367,8 +365,7 @@ static int Command_Action_List_Encode(
|
||||
|
||||
pObject = Object_Data(object_instance);
|
||||
if (pObject && (index < MAX_COMMAND_ACTIONS)) {
|
||||
apdu_len = bacnet_action_command_encode(
|
||||
apdu, &pObject->Action[index]);
|
||||
apdu_len = bacnet_action_command_encode(apdu, &pObject->Action[index]);
|
||||
}
|
||||
|
||||
return apdu_len;
|
||||
@@ -427,9 +424,10 @@ int Command_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
Command_All_Writes_Successful(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_ACTION:
|
||||
apdu_len = bacnet_array_encode(rpdata->object_instance,
|
||||
rpdata->array_index, Command_Action_List_Encode,
|
||||
MAX_COMMAND_ACTIONS, apdu, apdu_size);
|
||||
apdu_len = bacnet_array_encode(
|
||||
rpdata->object_instance, rpdata->array_index,
|
||||
Command_Action_List_Encode, MAX_COMMAND_ACTIONS, apdu,
|
||||
apdu_size);
|
||||
if (apdu_len == BACNET_STATUS_ABORT) {
|
||||
rpdata->error_code =
|
||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||
|
||||
@@ -28,116 +28,83 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct command_descr {
|
||||
uint32_t Present_Value;
|
||||
bool In_Process;
|
||||
bool All_Writes_Successful;
|
||||
BACNET_ACTION_LIST Action[MAX_COMMAND_ACTIONS];
|
||||
} COMMAND_DESCR;
|
||||
typedef struct command_descr {
|
||||
uint32_t Present_Value;
|
||||
bool In_Process;
|
||||
bool All_Writes_Successful;
|
||||
BACNET_ACTION_LIST Action[MAX_COMMAND_ACTIONS];
|
||||
} COMMAND_DESCR;
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Property_Lists(
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Command_Count(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Command_Index_To_Instance(
|
||||
unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Command_Instance_To_Index(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Object_Instance_Add(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Valid_Instance(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Command_Count(void);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Command_Index_To_Instance(unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Command_Instance_To_Index(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Object_Instance_Add(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Name_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Command_Description(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Description_Set(
|
||||
uint32_t instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
char *Command_Description(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Description_Set(uint32_t instance, const char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Command_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
BACNET_STACK_EXPORT
|
||||
int Command_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Command_Present_Value(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Command_Present_Value(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Present_Value_Set(uint32_t object_instance, uint32_t value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_In_Process(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_In_Process_Set(
|
||||
uint32_t object_instance,
|
||||
bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_In_Process(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_In_Process_Set(uint32_t object_instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_All_Writes_Successful(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_All_Writes_Successful_Set(
|
||||
uint32_t object_instance,
|
||||
bool value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_All_Writes_Successful(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_All_Writes_Successful_Set(uint32_t object_instance, bool value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Change_Of_Value(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Change_Of_Value_Clear(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Encode_Value_List(
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_VALUE * value_list);
|
||||
float Command_COV_Increment(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_COV_Increment_Set(
|
||||
uint32_t instance,
|
||||
float value);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Change_Of_Value(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Change_Of_Value_Clear(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Command_Encode_Value_List(
|
||||
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list);
|
||||
float Command_COV_Increment(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_COV_Increment_Set(uint32_t instance, float value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_ACTION_LIST * Command_Action_List_Entry(
|
||||
uint32_t instance, unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Command_Action_List_Count(
|
||||
uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_ACTION_LIST *
|
||||
Command_Action_List_Entry(uint32_t instance, unsigned index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned Command_Action_List_Count(uint32_t instance);
|
||||
|
||||
/* note: header of Intrinsic_Reporting function is required
|
||||
even when INTRINSIC_REPORTING is not defined */
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Intrinsic_Reporting(
|
||||
uint32_t object_instance);
|
||||
/* note: header of Intrinsic_Reporting function is required
|
||||
even when INTRINSIC_REPORTING is not defined */
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Intrinsic_Reporting(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Init(
|
||||
void);
|
||||
BACNET_STACK_EXPORT
|
||||
void Command_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user