Indented.
This commit is contained in:
@@ -39,24 +39,34 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int abort_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, uint8_t abort_reason, bool server);
|
||||
int abort_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
uint8_t abort_reason,
|
||||
bool server);
|
||||
|
||||
int abort_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, uint8_t * invoke_id, uint8_t * abort_reason);
|
||||
int abort_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
uint8_t * abort_reason);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int abort_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, uint8_t * invoke_id, uint8_t * abort_reason,
|
||||
int abort_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
uint8_t * abort_reason,
|
||||
bool * server);
|
||||
|
||||
void testAbort(Test * pTest);
|
||||
void testAbort(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -41,35 +41,52 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void address_init(void);
|
||||
void address_init(
|
||||
void);
|
||||
|
||||
void address_add(uint32_t device_id,
|
||||
unsigned max_apdu, BACNET_ADDRESS * src);
|
||||
void address_add(
|
||||
uint32_t device_id,
|
||||
unsigned max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void address_remove_device(uint32_t device_id);
|
||||
void address_remove_device(
|
||||
uint32_t device_id);
|
||||
|
||||
bool address_get_by_device(uint32_t device_id,
|
||||
unsigned *max_apdu, BACNET_ADDRESS * src);
|
||||
bool address_get_by_device(
|
||||
uint32_t device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
bool address_get_by_index(unsigned index,
|
||||
uint32_t * device_id, unsigned *max_apdu, BACNET_ADDRESS * src);
|
||||
|
||||
bool address_get_device_id(BACNET_ADDRESS * src,
|
||||
uint32_t *device_id);
|
||||
bool address_get_by_index(
|
||||
unsigned index,
|
||||
uint32_t * device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
unsigned address_count(void);
|
||||
bool address_get_device_id(
|
||||
BACNET_ADDRESS * src,
|
||||
uint32_t * device_id);
|
||||
|
||||
bool address_match(BACNET_ADDRESS * dest, BACNET_ADDRESS * src);
|
||||
unsigned address_count(
|
||||
void);
|
||||
|
||||
bool address_bind_request(uint32_t device_id,
|
||||
unsigned *max_apdu, BACNET_ADDRESS * src);
|
||||
bool address_match(
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void address_add_binding(uint32_t device_id,
|
||||
unsigned max_apdu, BACNET_ADDRESS * src);
|
||||
bool address_bind_request(
|
||||
uint32_t device_id,
|
||||
unsigned *max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void address_add_binding(
|
||||
uint32_t device_id,
|
||||
unsigned max_apdu,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -31,28 +31,35 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
void Analog_Input_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Analog_Input_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Analog_Input_Count(void);
|
||||
uint32_t Analog_Input_Index_To_Instance(unsigned index);
|
||||
char *Analog_Input_Name(uint32_t object_instance);
|
||||
bool Analog_Input_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Analog_Input_Count(
|
||||
void);
|
||||
uint32_t Analog_Input_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Analog_Input_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Analog_Input_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testAnalogInput(Test * pTest);
|
||||
void testAnalogInput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+30
-17
@@ -33,40 +33,53 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Analog_Output_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Analog_Output_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Analog_Output_Count(void);
|
||||
uint32_t Analog_Output_Index_To_Instance(unsigned index);
|
||||
char *Analog_Output_Name(uint32_t object_instance);
|
||||
float Analog_Output_Present_Value(uint32_t object_instance);
|
||||
unsigned Analog_Output_Present_Value_Priority(uint32_t
|
||||
object_instance);
|
||||
bool Analog_Output_Present_Value_Set(uint32_t object_instance,
|
||||
float value, unsigned priority);
|
||||
bool Analog_Output_Present_Value_Relinquish(uint32_t object_instance,
|
||||
bool Analog_Output_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Analog_Output_Count(
|
||||
void);
|
||||
uint32_t Analog_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Analog_Output_Name(
|
||||
uint32_t object_instance);
|
||||
float Analog_Output_Present_Value(
|
||||
uint32_t object_instance);
|
||||
unsigned Analog_Output_Present_Value_Priority(
|
||||
uint32_t object_instance);
|
||||
bool Analog_Output_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
float value,
|
||||
unsigned priority);
|
||||
bool Analog_Output_Present_Value_Relinquish(
|
||||
uint32_t object_instance,
|
||||
int priority);
|
||||
|
||||
|
||||
int Analog_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Analog_Output_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Analog_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Analog_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testAnalogOutput(Test * pTest);
|
||||
void testAnalogOutput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+61
-32
@@ -60,7 +60,7 @@ typedef struct _confirmed_service_ack_data {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* generic unconfirmed function handler */
|
||||
/* Suitable to handle the following services: */
|
||||
@@ -68,8 +68,11 @@ extern "C" {
|
||||
/* Unconfirmed_Event_Notification, Unconfirmed_Private_Transfer, */
|
||||
/* Unconfirmed_Text_Message, Time_Synchronization, Who_Has, */
|
||||
/* UTC_Time_Synchronization */
|
||||
typedef void (*unconfirmed_function) (uint8_t * service_request,
|
||||
uint16_t len, BACNET_ADDRESS * src);
|
||||
typedef void (
|
||||
*unconfirmed_function) (
|
||||
uint8_t * service_request,
|
||||
uint16_t len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
/* generic confirmed function handler */
|
||||
/* Suitable to handle the following services: */
|
||||
@@ -87,72 +90,98 @@ extern "C" {
|
||||
/* Confirmed_Text_Message, Reinitialize_Device, */
|
||||
/* VT_Open, VT_Close, VT_Data_Handler, */
|
||||
/* Authenticate, Request_Key */
|
||||
typedef void (*confirmed_function) (uint8_t * service_request,
|
||||
typedef void (
|
||||
*confirmed_function) (
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
/* generic confirmed simple ack function handler */
|
||||
typedef void (*confirmed_simple_ack_function) (BACNET_ADDRESS * src,
|
||||
typedef void (
|
||||
*confirmed_simple_ack_function) (
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t invoke_id);
|
||||
|
||||
/* generic confirmed ack function handler */
|
||||
typedef void (*confirmed_ack_function) (uint8_t * service_request,
|
||||
typedef void (
|
||||
*confirmed_ack_function) (
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA * service_data);
|
||||
|
||||
/* generic error reply function */
|
||||
typedef void (*error_function) (BACNET_ADDRESS * src,
|
||||
typedef void (
|
||||
*error_function) (
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code);
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code);
|
||||
|
||||
/* generic abort reply function */
|
||||
typedef void (*abort_function) (BACNET_ADDRESS * src,
|
||||
uint8_t invoke_id, uint8_t abort_reason, bool server);
|
||||
typedef void (
|
||||
*abort_function) (
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t invoke_id,
|
||||
uint8_t abort_reason,
|
||||
bool server);
|
||||
|
||||
/* generic reject reply function */
|
||||
typedef void (*reject_function) (BACNET_ADDRESS * src,
|
||||
uint8_t invoke_id, uint8_t reject_reason);
|
||||
typedef void (
|
||||
*reject_function) (
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t invoke_id,
|
||||
uint8_t reject_reason);
|
||||
|
||||
void apdu_set_confirmed_ack_handler(BACNET_CONFIRMED_SERVICE
|
||||
service_choice, confirmed_ack_function pFunction);
|
||||
void apdu_set_confirmed_ack_handler(
|
||||
BACNET_CONFIRMED_SERVICE service_choice,
|
||||
confirmed_ack_function pFunction);
|
||||
|
||||
void apdu_set_confirmed_simple_ack_handler(BACNET_CONFIRMED_SERVICE
|
||||
service_choice, confirmed_simple_ack_function pFunction);
|
||||
void apdu_set_confirmed_simple_ack_handler(
|
||||
BACNET_CONFIRMED_SERVICE service_choice,
|
||||
confirmed_simple_ack_function pFunction);
|
||||
|
||||
/* configure reject for confirmed services that are not supported */
|
||||
void apdu_set_unrecognized_service_handler_handler(confirmed_function
|
||||
pFunction);
|
||||
void apdu_set_unrecognized_service_handler_handler(
|
||||
confirmed_function pFunction);
|
||||
|
||||
void apdu_set_confirmed_handler(BACNET_CONFIRMED_SERVICE
|
||||
service_choice, confirmed_function pFunction);
|
||||
void apdu_set_confirmed_handler(
|
||||
BACNET_CONFIRMED_SERVICE service_choice,
|
||||
confirmed_function pFunction);
|
||||
|
||||
void apdu_set_unconfirmed_handler(BACNET_UNCONFIRMED_SERVICE
|
||||
service_choice, unconfirmed_function pFunction);
|
||||
void apdu_set_unconfirmed_handler(
|
||||
BACNET_UNCONFIRMED_SERVICE service_choice,
|
||||
unconfirmed_function pFunction);
|
||||
|
||||
/* returns true if the service is supported by a handler */
|
||||
bool apdu_service_supported(BACNET_SERVICES_SUPPORTED
|
||||
service_supported);
|
||||
bool apdu_service_supported(
|
||||
BACNET_SERVICES_SUPPORTED service_supported);
|
||||
|
||||
void apdu_set_error_handler(BACNET_CONFIRMED_SERVICE service_choice,
|
||||
void apdu_set_error_handler(
|
||||
BACNET_CONFIRMED_SERVICE service_choice,
|
||||
error_function pFunction);
|
||||
|
||||
void apdu_set_abort_handler(abort_function pFunction);
|
||||
void apdu_set_abort_handler(
|
||||
abort_function pFunction);
|
||||
|
||||
void apdu_set_reject_handler(reject_function pFunction);
|
||||
void apdu_set_reject_handler(
|
||||
reject_function pFunction);
|
||||
|
||||
uint16_t apdu_decode_confirmed_service_request(uint8_t * apdu, /* APDU data */
|
||||
uint16_t apdu_decode_confirmed_service_request(
|
||||
uint8_t * apdu, /* APDU data */
|
||||
uint16_t apdu_len,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data,
|
||||
uint8_t * service_choice,
|
||||
uint8_t ** service_request, uint16_t * service_request_len);
|
||||
uint8_t ** service_request,
|
||||
uint16_t * service_request_len);
|
||||
|
||||
void apdu_handler(BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * apdu, /* APDU data */
|
||||
void apdu_handler(
|
||||
BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * apdu, /* APDU data */
|
||||
uint16_t pdu_len); /* for confirmed messages */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -46,30 +46,37 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool arcnet_valid(void);
|
||||
void arcnet_cleanup(void);
|
||||
bool arcnet_init(char *interface_name);
|
||||
bool arcnet_valid(
|
||||
void);
|
||||
void arcnet_cleanup(
|
||||
void);
|
||||
bool arcnet_init(
|
||||
char *interface_name);
|
||||
|
||||
/* function to send a packet out the 802.2 socket */
|
||||
/* returns zero on success, non-zero on failure */
|
||||
int arcnet_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
int arcnet_send_pdu(
|
||||
BACNET_ADDRESS * dest, /* destination address */
|
||||
BACNET_NPDU_DATA * npdu_data, /* network information */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len); /* number of bytes of data */
|
||||
|
||||
/* receives an framed packet */
|
||||
/* returns the number of octets in the PDU, or zero on failure */
|
||||
uint16_t arcnet_receive(BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t arcnet_receive(
|
||||
BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t max_pdu, /* amount of space available in the PDU */
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
|
||||
void arcnet_get_my_address(BACNET_ADDRESS * my_address);
|
||||
void arcnet_get_broadcast_address(BACNET_ADDRESS * dest); /* destination address */
|
||||
void arcnet_get_my_address(
|
||||
BACNET_ADDRESS * my_address);
|
||||
void arcnet_get_broadcast_address(
|
||||
BACNET_ADDRESS * dest); /* destination address */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+32
-18
@@ -60,43 +60,57 @@ typedef struct BACnet_Atomic_Read_File_Data {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Atomic Read File */
|
||||
/* encode service */
|
||||
int arf_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
int arf_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
/* decode the service request only */
|
||||
int arf_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
int arf_decode_apdu(uint8_t * apdu,
|
||||
int arf_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id, BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
int arf_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
/* Atomic Read File Ack */
|
||||
|
||||
/* encode service */
|
||||
int arf_ack_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
int arf_ack_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
/* decode the service request only */
|
||||
int arf_ack_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
int arf_ack_decode_apdu(uint8_t * apdu,
|
||||
int arf_ack_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id, BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
int arf_ack_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
|
||||
void test_AtomicReadFile(Test * pTest);
|
||||
void test_AtomicReadFileAck(Test * pTest);
|
||||
void test_AtomicReadFile(
|
||||
Test * pTest);
|
||||
void test_AtomicReadFileAck(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+20
-11
@@ -33,31 +33,40 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
void Analog_Value_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Analog_Value_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Analog_Value_Count(void);
|
||||
uint32_t Analog_Value_Index_To_Instance(unsigned index);
|
||||
char *Analog_Value_Name(uint32_t object_instance);
|
||||
bool Analog_Value_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Analog_Value_Count(
|
||||
void);
|
||||
uint32_t Analog_Value_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Analog_Value_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Analog_Value_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Analog_Value_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testAnalog_Value(Test * pTest);
|
||||
void testAnalog_Value(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+32
-18
@@ -56,42 +56,56 @@ typedef struct BACnet_Atomic_Write_File_Data {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Atomic Write File */
|
||||
/* encode service */
|
||||
int awf_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
int awf_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
/* decode the service request only */
|
||||
int awf_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
int awf_decode_apdu(uint8_t * apdu,
|
||||
int awf_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id, BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
int awf_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
/* Atomic Write File Ack */
|
||||
/* encode service */
|
||||
int awf_ack_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
int awf_ack_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
/* decode the service request only */
|
||||
int awf_ack_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
int awf_ack_decode_apdu(uint8_t * apdu,
|
||||
int awf_ack_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id, BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
int awf_ack_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
|
||||
void test_AtomicWriteFile(Test * pTest);
|
||||
void test_AtomicWriteFileAck(Test * pTest);
|
||||
void test_AtomicWriteFile(
|
||||
Test * pTest);
|
||||
void test_AtomicWriteFileAck(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -41,12 +41,16 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void bacnet_address_copy(BACNET_ADDRESS * dest, BACNET_ADDRESS * src);
|
||||
bool bacnet_address_same(BACNET_ADDRESS * dest, BACNET_ADDRESS * src);
|
||||
void bacnet_address_copy(
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_ADDRESS * src);
|
||||
bool bacnet_address_same(
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@ 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 */
|
||||
uint8_t tag; /* application tag data type */
|
||||
union {
|
||||
/* NULL - not needed as it is encoded in the tag alone */
|
||||
#if defined (BACAPP_BOOLEAN)
|
||||
@@ -63,25 +63,25 @@ typedef struct BACnet_Application_Data_Value {
|
||||
#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)
|
||||
int 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
|
||||
} type;
|
||||
@@ -91,38 +91,51 @@ typedef struct BACnet_Application_Data_Value {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
int bacapp_encode_data(uint8_t * apdu,
|
||||
#endif /* __cplusplus */
|
||||
int bacapp_encode_data(
|
||||
uint8_t * apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
|
||||
int bacapp_decode_application_data(uint8_t * apdu,
|
||||
int max_apdu_len, BACNET_APPLICATION_DATA_VALUE * value);
|
||||
|
||||
int bacapp_encode_application_data(uint8_t * apdu,
|
||||
int bacapp_decode_application_data(
|
||||
uint8_t * apdu,
|
||||
int max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
|
||||
int bacapp_decode_context_data(uint8_t * apdu,
|
||||
int max_apdu_len, BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
int bacapp_encode_application_data(
|
||||
uint8_t * apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
|
||||
int bacapp_encode_context_data(uint8_t * apdu,
|
||||
int bacapp_decode_context_data(
|
||||
uint8_t * apdu,
|
||||
int max_apdu_len,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
|
||||
int bacapp_encode_context_data_value(uint8_t * apdu,
|
||||
uint8_t context_tag_number, BACNET_APPLICATION_DATA_VALUE * value);
|
||||
int bacapp_encode_context_data(
|
||||
uint8_t * apdu,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
|
||||
BACNET_APPLICATION_TAG bacapp_context_tag_type(BACNET_PROPERTY_ID
|
||||
property, uint8_t tag_number);
|
||||
int bacapp_encode_context_data_value(
|
||||
uint8_t * apdu,
|
||||
uint8_t context_tag_number,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
|
||||
bool bacapp_copy(BACNET_APPLICATION_DATA_VALUE * dest_value,
|
||||
BACNET_APPLICATION_TAG bacapp_context_tag_type(
|
||||
BACNET_PROPERTY_ID property,
|
||||
uint8_t tag_number);
|
||||
|
||||
bool bacapp_copy(
|
||||
BACNET_APPLICATION_DATA_VALUE * dest_value,
|
||||
BACNET_APPLICATION_DATA_VALUE * src_value);
|
||||
|
||||
/* returns the length of data between an opening tag and a closing tag.
|
||||
Expects that the first octet contain the opening tag.
|
||||
Include a value property identifier for context specific data
|
||||
such as the value received in a WriteProperty request */
|
||||
int bacapp_data_len(uint8_t * apdu, int max_apdu_len,
|
||||
int bacapp_data_len(
|
||||
uint8_t * apdu,
|
||||
int max_apdu_len,
|
||||
BACNET_PROPERTY_ID property);
|
||||
|
||||
#if PRINT_ENABLED
|
||||
@@ -134,9 +147,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef BACAPP_PRINT_ENABLED
|
||||
bool bacapp_parse_application_data(BACNET_APPLICATION_TAG tag_number,
|
||||
const char *argv, BACNET_APPLICATION_DATA_VALUE * value);
|
||||
bool bacapp_print_value(FILE * stream,
|
||||
bool bacapp_parse_application_data(
|
||||
BACNET_APPLICATION_TAG tag_number,
|
||||
const char *argv,
|
||||
BACNET_APPLICATION_DATA_VALUE * value);
|
||||
bool bacapp_print_value(
|
||||
FILE * stream,
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_PROPERTY_ID property);
|
||||
#else
|
||||
@@ -147,14 +163,17 @@ extern "C" {
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
#include "datetime.h"
|
||||
bool bacapp_same_value(BACNET_APPLICATION_DATA_VALUE * value,
|
||||
bool bacapp_same_value(
|
||||
BACNET_APPLICATION_DATA_VALUE * value,
|
||||
BACNET_APPLICATION_DATA_VALUE * test_value);
|
||||
|
||||
void testBACnetApplicationDataLength(Test * pTest);
|
||||
void testBACnetApplicationData(Test * pTest);
|
||||
void testBACnetApplicationDataLength(
|
||||
Test * pTest);
|
||||
void testBACnetApplicationData(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+174
-64
@@ -45,133 +45,229 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* from clause 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_tag(uint8_t * apdu, uint8_t tag_number,
|
||||
bool context_specific, uint32_t len_value_type);
|
||||
int encode_tag(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
bool context_specific,
|
||||
uint32_t len_value_type);
|
||||
|
||||
/* from clause 20.2.1.3.2 Constructed Data */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_opening_tag(uint8_t * apdu, uint8_t tag_number);
|
||||
int encode_closing_tag(uint8_t * apdu, uint8_t tag_number);
|
||||
int decode_tag_number(uint8_t * apdu, uint8_t * tag_number);
|
||||
int decode_tag_number_and_value(uint8_t * apdu, uint8_t * tag_number,
|
||||
int encode_opening_tag(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number);
|
||||
int encode_closing_tag(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number);
|
||||
int decode_tag_number(
|
||||
uint8_t * apdu,
|
||||
uint8_t * tag_number);
|
||||
int decode_tag_number_and_value(
|
||||
uint8_t * apdu,
|
||||
uint8_t * tag_number,
|
||||
uint32_t * value);
|
||||
/* returns true if the tag is context specific */
|
||||
bool decode_is_context_specific(uint8_t * apdu);
|
||||
bool decode_is_context_specific(
|
||||
uint8_t * apdu);
|
||||
/* returns true if the tag is an opening tag and matches */
|
||||
bool decode_is_opening_tag_number(uint8_t * apdu, uint8_t tag_number);
|
||||
bool decode_is_opening_tag_number(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number);
|
||||
/* returns true if the tag is a closing tag and matches */
|
||||
bool decode_is_closing_tag_number(uint8_t * apdu, uint8_t tag_number);
|
||||
bool decode_is_closing_tag_number(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number);
|
||||
/* returns true if the tag is context specific and matches */
|
||||
bool decode_is_context_tag(uint8_t * apdu, uint8_t tag_number);
|
||||
bool decode_is_context_tag(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number);
|
||||
/* returns true if the tag is an opening tag */
|
||||
bool decode_is_opening_tag(uint8_t * apdu);
|
||||
bool decode_is_opening_tag(
|
||||
uint8_t * apdu);
|
||||
/* returns true if the tag is a closing tag */
|
||||
bool decode_is_closing_tag(uint8_t * apdu);
|
||||
bool decode_is_closing_tag(
|
||||
uint8_t * apdu);
|
||||
|
||||
/* from clause 20.2.2 Encoding of a Null Value */
|
||||
int encode_application_null(uint8_t * apdu);
|
||||
int encode_context_null(uint8_t * apdu, int tag_number);
|
||||
int encode_application_null(
|
||||
uint8_t * apdu);
|
||||
int encode_context_null(
|
||||
uint8_t * apdu,
|
||||
int tag_number);
|
||||
|
||||
/* from clause 20.2.3 Encoding of a Boolean Value */
|
||||
int encode_application_boolean(uint8_t * apdu, bool boolean_value);
|
||||
bool decode_boolean(uint32_t len_value);
|
||||
int encode_context_boolean(uint8_t * apdu, int tag_number,
|
||||
int encode_application_boolean(
|
||||
uint8_t * apdu,
|
||||
bool boolean_value);
|
||||
bool decode_context_boolean(uint8_t * apdu);
|
||||
bool decode_boolean(
|
||||
uint32_t len_value);
|
||||
int encode_context_boolean(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
bool boolean_value);
|
||||
bool decode_context_boolean(
|
||||
uint8_t * apdu);
|
||||
|
||||
/* from clause 20.2.10 Encoding of a Bit String Value */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int decode_bitstring(uint8_t * apdu, uint32_t len_value,
|
||||
int decode_bitstring(
|
||||
uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_bitstring(uint8_t * apdu, BACNET_BIT_STRING * bit_string);
|
||||
int encode_application_bitstring(uint8_t * apdu,
|
||||
int encode_bitstring(
|
||||
uint8_t * apdu,
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
int encode_context_bitstring(uint8_t * apdu, int tag_number,
|
||||
int encode_application_bitstring(
|
||||
uint8_t * apdu,
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
int encode_context_bitstring(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
|
||||
/* from clause 20.2.6 Encoding of a Real Number Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_application_real(uint8_t * apdu, float value);
|
||||
int encode_context_real(uint8_t * apdu, int tag_number, float value);
|
||||
int encode_application_real(
|
||||
uint8_t * apdu,
|
||||
float value);
|
||||
int encode_context_real(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
float value);
|
||||
|
||||
/* from clause 20.2.14 Encoding of an Object Identifier Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int decode_object_id(uint8_t * apdu, int *object_type,
|
||||
int decode_object_id(
|
||||
uint8_t * apdu,
|
||||
int *object_type,
|
||||
uint32_t * instance);
|
||||
int encode_bacnet_object_id(uint8_t * apdu, int object_type,
|
||||
int encode_bacnet_object_id(
|
||||
uint8_t * apdu,
|
||||
int object_type,
|
||||
uint32_t instance);
|
||||
int encode_context_object_id(uint8_t * apdu, int tag_number,
|
||||
int object_type, uint32_t instance);
|
||||
int encode_application_object_id(uint8_t * apdu, int object_type,
|
||||
int encode_context_object_id(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
int object_type,
|
||||
uint32_t instance);
|
||||
int encode_application_object_id(
|
||||
uint8_t * apdu,
|
||||
int object_type,
|
||||
uint32_t instance);
|
||||
|
||||
/* from clause 20.2.8 Encoding of an Octet String Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_octet_string(uint8_t * apdu,
|
||||
int encode_octet_string(
|
||||
uint8_t * apdu,
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
int encode_application_octet_string(uint8_t * apdu,
|
||||
int encode_application_octet_string(
|
||||
uint8_t * apdu,
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
int encode_context_octet_string(uint8_t * apdu,
|
||||
int tag_number, BACNET_OCTET_STRING * octet_string);
|
||||
int decode_octet_string(uint8_t * apdu, uint32_t len_value,
|
||||
int encode_context_octet_string(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
int decode_octet_string(
|
||||
uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
|
||||
|
||||
/* from clause 20.2.9 Encoding of a Character String Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_bacnet_character_string(uint8_t * apdu,
|
||||
int encode_bacnet_character_string(
|
||||
uint8_t * apdu,
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
int encode_application_character_string(uint8_t * apdu,
|
||||
int encode_application_character_string(
|
||||
uint8_t * apdu,
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
int encode_context_character_string(uint8_t * apdu, int tag_number,
|
||||
int encode_context_character_string(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
int decode_character_string(uint8_t * apdu, uint32_t len_value,
|
||||
int decode_character_string(
|
||||
uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
|
||||
/* from clause 20.2.4 Encoding of an Unsigned Integer Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_bacnet_unsigned(uint8_t * apdu, uint32_t value);
|
||||
int encode_context_unsigned(uint8_t * apdu, int tag_number,
|
||||
int encode_bacnet_unsigned(
|
||||
uint8_t * apdu,
|
||||
uint32_t value);
|
||||
int encode_application_unsigned(uint8_t * apdu, uint32_t value);
|
||||
int decode_unsigned(uint8_t * apdu, uint32_t len_value,
|
||||
int encode_context_unsigned(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
uint32_t value);
|
||||
int encode_application_unsigned(
|
||||
uint8_t * apdu,
|
||||
uint32_t value);
|
||||
int decode_unsigned(
|
||||
uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
uint32_t * value);
|
||||
|
||||
/* from clause 20.2.5 Encoding of a Signed Integer Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_bacnet_signed(uint8_t * apdu, int32_t value);
|
||||
int encode_application_signed(uint8_t * apdu, int32_t value);
|
||||
int encode_context_signed(uint8_t * apdu, int tag_number,
|
||||
int encode_bacnet_signed(
|
||||
uint8_t * apdu,
|
||||
int32_t value);
|
||||
int decode_signed(uint8_t * apdu, uint32_t len_value, int32_t * value);
|
||||
int encode_application_signed(
|
||||
uint8_t * apdu,
|
||||
int32_t value);
|
||||
int encode_context_signed(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
int32_t value);
|
||||
int decode_signed(
|
||||
uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
int32_t * value);
|
||||
|
||||
/* from clause 20.2.11 Encoding of an Enumerated Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int decode_enumerated(uint8_t * apdu, uint32_t len_value, int *value);
|
||||
int encode_bacnet_enumerated(uint8_t * apdu, int value);
|
||||
int encode_application_enumerated(uint8_t * apdu, int value);
|
||||
int encode_context_enumerated(uint8_t * apdu, int tag_number,
|
||||
int decode_enumerated(
|
||||
uint8_t * apdu,
|
||||
uint32_t len_value,
|
||||
int *value);
|
||||
int encode_bacnet_enumerated(
|
||||
uint8_t * apdu,
|
||||
int value);
|
||||
int encode_application_enumerated(
|
||||
uint8_t * apdu,
|
||||
int value);
|
||||
int encode_context_enumerated(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
int value);
|
||||
|
||||
/* from clause 20.2.13 Encoding of a Time Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_bacnet_time(uint8_t * apdu, BACNET_TIME * btime);
|
||||
int encode_application_time(uint8_t * apdu, BACNET_TIME * btime);
|
||||
int decode_bacnet_time(uint8_t * apdu, BACNET_TIME * btime);
|
||||
int encode_context_time(uint8_t * apdu, int tag_number,
|
||||
int encode_bacnet_time(
|
||||
uint8_t * apdu,
|
||||
BACNET_TIME * btime);
|
||||
int encode_application_time(
|
||||
uint8_t * apdu,
|
||||
BACNET_TIME * btime);
|
||||
int decode_bacnet_time(
|
||||
uint8_t * apdu,
|
||||
BACNET_TIME * btime);
|
||||
int encode_context_time(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
BACNET_TIME * btime);
|
||||
|
||||
/* BACnet Date */
|
||||
@@ -183,24 +279,38 @@ extern "C" {
|
||||
/* from clause 20.2.12 Encoding of a Date Value */
|
||||
/* and 20.2.1 General Rules for Encoding BACnet Tags */
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_bacnet_date(uint8_t * apdu, BACNET_DATE * bdate);
|
||||
int encode_application_date(uint8_t * apdu, BACNET_DATE * bdate);
|
||||
int encode_context_date(uint8_t * apdu, int tag_number,
|
||||
int encode_bacnet_date(
|
||||
uint8_t * apdu,
|
||||
BACNET_DATE * bdate);
|
||||
int encode_application_date(
|
||||
uint8_t * apdu,
|
||||
BACNET_DATE * bdate);
|
||||
int encode_context_date(
|
||||
uint8_t * apdu,
|
||||
int tag_number,
|
||||
BACNET_DATE * bdate);
|
||||
int decode_date(
|
||||
uint8_t * apdu,
|
||||
BACNET_DATE * bdate);
|
||||
int decode_date(uint8_t * apdu, BACNET_DATE * bdate);
|
||||
|
||||
/* from clause 20.1.2.4 max-segments-accepted */
|
||||
/* and clause 20.1.2.5 max-APDU-length-accepted */
|
||||
/* returns the encoded octet */
|
||||
uint8_t encode_max_segs_max_apdu(int max_segs, int max_apdu);
|
||||
int decode_max_segs(uint8_t octet);
|
||||
int decode_max_apdu(uint8_t octet);
|
||||
uint8_t encode_max_segs_max_apdu(
|
||||
int max_segs,
|
||||
int max_apdu);
|
||||
int decode_max_segs(
|
||||
uint8_t octet);
|
||||
int decode_max_apdu(
|
||||
uint8_t octet);
|
||||
|
||||
/* returns the number of apdu bytes consumed */
|
||||
int encode_simple_ack(uint8_t * apdu, uint8_t invoke_id,
|
||||
int encode_simple_ack(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
uint8_t service_choice);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -71,10 +71,10 @@ struct BACnet_Device_Address {
|
||||
/* DNET,DLEN,DADR or SNET,SLEN,SADR */
|
||||
/* the following are used if the device is behind a router */
|
||||
/* net = 0 indicates local */
|
||||
uint16_t net; /* BACnet network number */
|
||||
uint16_t net; /* BACnet network number */
|
||||
/* LEN = 0 denotes broadcast MAC ADR and ADR field is absent */
|
||||
/* LEN > 0 specifies length of ADR field */
|
||||
uint8_t len; /* length of MAC address */
|
||||
uint8_t len; /* length of MAC address */
|
||||
uint8_t adr[MAX_MAC_LEN]; /* hwaddr (MAC) address */
|
||||
};
|
||||
typedef struct BACnet_Device_Address BACNET_ADDRESS;
|
||||
|
||||
@@ -279,12 +279,12 @@ typedef enum {
|
||||
PROP_RAMP_RATE = 241,
|
||||
PROP_STEP_INCREMENT = 242,
|
||||
PROP_SYSTEM_FAILURE_VALUE = 243
|
||||
/* The special property identifiers all, optional, and required */
|
||||
/* are reserved for use in the ReadPropertyConditional and */
|
||||
/* ReadPropertyMultiple services or services not defined in this standard. */
|
||||
/* Enumerated values 0-511 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 512-4194303 may be used by others subject to the */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
/* The special property identifiers all, optional, and required */
|
||||
/* are reserved for use in the ReadPropertyConditional and */
|
||||
/* ReadPropertyMultiple services or services not defined in this standard. */
|
||||
/* Enumerated values 0-511 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 512-4194303 may be used by others subject to the */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
} BACNET_PROPERTY_ID;
|
||||
#define MAX_BACNET_PROPERTY_ID 4194303
|
||||
|
||||
@@ -294,11 +294,11 @@ typedef enum {
|
||||
} BACNET_ACTION;
|
||||
|
||||
typedef enum {
|
||||
MIN_BINARY_PV = 0, /* for validating incoming values */
|
||||
MIN_BINARY_PV = 0, /* for validating incoming values */
|
||||
BINARY_INACTIVE = 0,
|
||||
BINARY_ACTIVE = 1,
|
||||
MAX_BINARY_PV = 1, /* for validating incoming values */
|
||||
BINARY_NULL = 2 /* our homemade way of storing this info */
|
||||
MAX_BINARY_PV = 1, /* for validating incoming values */
|
||||
BINARY_NULL = 2 /* our homemade way of storing this info */
|
||||
} BACNET_BINARY_PV;
|
||||
|
||||
typedef enum {
|
||||
@@ -538,10 +538,10 @@ typedef enum {
|
||||
UNITS_SQUARE_METERS_PER_NEWTON = 185,
|
||||
UNITS_WATTS_PER_METER_PER_DEGREE_KELVIN = 189,
|
||||
UNITS_WATTS_PER_SQUARE_METER_DEGREE_KELVIN = 141
|
||||
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 256-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* The last enumeration used in this version is 189. */
|
||||
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 256-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* The last enumeration used in this version is 189. */
|
||||
} BACNET_ENGINEERING_UNITS;
|
||||
|
||||
typedef enum {
|
||||
@@ -573,9 +573,9 @@ typedef enum {
|
||||
PROGRAM_ERROR_INTERNAL = 2,
|
||||
PROGRAM_ERROR_PROGRAM = 3,
|
||||
PROGRAM_ERROR_OTHER = 4
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
} BACNET_PROGRAM_ERROR;
|
||||
|
||||
typedef enum {
|
||||
@@ -592,9 +592,9 @@ typedef enum {
|
||||
RELIABILITY_CONFIGURATION_ERROR = 10,
|
||||
RELIABILITY_COMMUNICATION_FAILURE = 12,
|
||||
RELIABILITY_TRIPPED = 13
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
} BACNET_RELIABILITY;
|
||||
|
||||
typedef enum {
|
||||
@@ -610,13 +610,13 @@ typedef enum {
|
||||
EVENT_EXTENDED = 9,
|
||||
EVENT_BUFFER_READY = 10,
|
||||
EVENT_UNSIGNED_RANGE = 11
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* It is expected that these enumerated values will correspond to */
|
||||
/* the use of the complex-event-type CHOICE [6] of the */
|
||||
/* BACnetNotificationParameters production. */
|
||||
/* The last enumeration used in this version is 11. */
|
||||
/* Enumerated values 0-63 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 64-65535 may be used by others subject to */
|
||||
/* the procedures and constraints described in Clause 23. */
|
||||
/* It is expected that these enumerated values will correspond to */
|
||||
/* the use of the complex-event-type CHOICE [6] of the */
|
||||
/* BACnetNotificationParameters production. */
|
||||
/* The last enumeration used in this version is 11. */
|
||||
} BACNET_EVENT_TYPE;
|
||||
|
||||
typedef enum {
|
||||
@@ -643,9 +643,9 @@ typedef enum {
|
||||
LIFE_SAFETY_MODE_AUTOMATIC_RELEASE_DISABLED = 13,
|
||||
LIFE_SAFETY_MODE_DEFAULT = 14,
|
||||
MAX_LIFE_SAFETY_MODE = 14
|
||||
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 256-65535 may be used by others subject to */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 256-65535 may be used by others subject to */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
} BACNET_LIFE_SAFETY_MODE;
|
||||
|
||||
typedef enum {
|
||||
@@ -691,9 +691,9 @@ typedef enum {
|
||||
LIFE_SAFETY_STATE_SUPERVISORY = 22,
|
||||
LIFE_SAFETY_STATE_TEST_SUPERVISORY = 23,
|
||||
MAX_LIFE_SAFETY_STATE = 0
|
||||
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 256-65535 may be used by others subject to */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
|
||||
/* Enumerated values 256-65535 may be used by others subject to */
|
||||
/* procedures and constraints described in Clause 23. */
|
||||
} BACNET_LIFE_SAFETY_STATE;
|
||||
|
||||
typedef enum {
|
||||
@@ -1035,8 +1035,8 @@ typedef enum {
|
||||
NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE_ACK = 7,
|
||||
NETWORK_MESSAGE_ESTABLISH_CONNECTION_TO_NETWORK = 8,
|
||||
NETWORK_MESSAGE_DISCONNECT_CONNECTION_TO_NETWORK = 9,
|
||||
/* X'0A' to X'7F': Reserved for use by ASHRAE, */
|
||||
/* X'80' to X'FF': Available for vendor proprietary messages */
|
||||
/* X'0A' to X'7F': Reserved for use by ASHRAE, */
|
||||
/* X'80' to X'FF': Available for vendor proprietary messages */
|
||||
NETWORK_MESSAGE_INVALID = 0x100
|
||||
} BACNET_NETWORK_MESSAGE_TYPE;
|
||||
|
||||
@@ -1221,21 +1221,21 @@ typedef enum BACnetShedState {
|
||||
} BACNET_SHED_STATE;
|
||||
|
||||
typedef enum BACnetLightingOperation {
|
||||
BACNET_LIGHTS_STOP = 0,
|
||||
BACNET_LIGHTS_FADE_TO = 1,
|
||||
BACNET_LIGHTS_FADE_TO_OVER = 2,
|
||||
BACNET_LIGHTS_RAMP_TO = 3,
|
||||
BACNET_LIGHTS_RAMP_TO_AT_RATE = 4,
|
||||
BACNET_LIGHTS_RAMP_UP = 5,
|
||||
BACNET_LIGHTS_RAMP_UP_AT_RATE = 6,
|
||||
BACNET_LIGHTS_RAMP_DOWN = 7,
|
||||
BACNET_LIGHTS_RAMP_DOWN_AT_RATE = 8,
|
||||
BACNET_LIGHTS_STEP_UP = 9,
|
||||
BACNET_LIGHTS_STEP_DOWN = 10,
|
||||
BACNET_LIGHTS_STEP_UP_BY = 11,
|
||||
BACNET_LIGHTS_STEP_DOWN_BY = 12,
|
||||
BACNET_LIGHTS_GOTO_LEVEL = 13,
|
||||
BACNET_LIGHTS_RELINQUISH = 14
|
||||
BACNET_LIGHTS_STOP = 0,
|
||||
BACNET_LIGHTS_FADE_TO = 1,
|
||||
BACNET_LIGHTS_FADE_TO_OVER = 2,
|
||||
BACNET_LIGHTS_RAMP_TO = 3,
|
||||
BACNET_LIGHTS_RAMP_TO_AT_RATE = 4,
|
||||
BACNET_LIGHTS_RAMP_UP = 5,
|
||||
BACNET_LIGHTS_RAMP_UP_AT_RATE = 6,
|
||||
BACNET_LIGHTS_RAMP_DOWN = 7,
|
||||
BACNET_LIGHTS_RAMP_DOWN_AT_RATE = 8,
|
||||
BACNET_LIGHTS_STEP_UP = 9,
|
||||
BACNET_LIGHTS_STEP_DOWN = 10,
|
||||
BACNET_LIGHTS_STEP_UP_BY = 11,
|
||||
BACNET_LIGHTS_STEP_DOWN_BY = 12,
|
||||
BACNET_LIGHTS_GOTO_LEVEL = 13,
|
||||
BACNET_LIGHTS_RELINQUISH = 14
|
||||
} BACNET_LIGHTING_OPERATION;
|
||||
|
||||
/* NOTE: BACNET_DAYS_OF_WEEK is different than BACNET_WEEKDAY */
|
||||
@@ -1247,7 +1247,7 @@ typedef enum BACnetDaysOfWeek {
|
||||
BACNET_DAYS_OF_WEEK_THURSDAY = 3,
|
||||
BACNET_DAYS_OF_WEEK_FRIDAY = 4,
|
||||
BACNET_DAYS_OF_WEEK_SATURDAY = 5,
|
||||
BACNET_DAYS_OF_WEEK_SUNDAY = 6
|
||||
BACNET_DAYS_OF_WEEK_SUNDAY = 6
|
||||
} BACNET_DAYS_OF_WEEK;
|
||||
|
||||
#endif /* end of BACENUM_H */
|
||||
#endif /* end of BACENUM_H */
|
||||
|
||||
@@ -40,35 +40,44 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
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, BACNET_ERROR_CODE error_code);
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code);
|
||||
|
||||
int bacerror_decode_service_request(uint8_t * apdu,
|
||||
int bacerror_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE * service,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
int bacerror_decode_error_class_and_code(uint8_t * apdu,
|
||||
int bacerror_decode_error_class_and_code(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int bacerror_decode_apdu(uint8_t * apdu,
|
||||
int bacerror_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_CONFIRMED_SERVICE * service,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
void testBACError(Test * pTest);
|
||||
void testBACError(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -44,40 +44,52 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void BACfile_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
char *bacfile_name(uint32_t instance);
|
||||
bool bacfile_valid_instance(uint32_t object_instance);
|
||||
uint32_t bacfile_count(void);
|
||||
uint32_t bacfile_index_to_instance(unsigned find_index);
|
||||
uint32_t bacfile_instance(char *filename);
|
||||
char *bacfile_name(
|
||||
uint32_t instance);
|
||||
bool bacfile_valid_instance(
|
||||
uint32_t object_instance);
|
||||
uint32_t bacfile_count(
|
||||
void);
|
||||
uint32_t bacfile_index_to_instance(
|
||||
unsigned find_index);
|
||||
uint32_t bacfile_instance(
|
||||
char *filename);
|
||||
/* 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 */
|
||||
uint32_t bacfile_instance_from_tsm(uint8_t invokeID);
|
||||
uint32_t bacfile_instance_from_tsm(
|
||||
uint8_t invokeID);
|
||||
|
||||
/* handler ACK helper */
|
||||
bool bacfile_read_data(BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
bool bacfile_write_stream_data(BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
bool bacfile_read_data(
|
||||
BACNET_ATOMIC_READ_FILE_DATA * data);
|
||||
bool bacfile_write_stream_data(
|
||||
BACNET_ATOMIC_WRITE_FILE_DATA * data);
|
||||
|
||||
/* handling for read property service */
|
||||
int bacfile_encode_property_apdu(uint8_t * apdu,
|
||||
int bacfile_encode_property_apdu(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
/* handling for write property service */
|
||||
bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool bacfile_write_property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -40,29 +40,55 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* unsigned value encoding and decoding */
|
||||
int encode_unsigned16(uint8_t * apdu, uint16_t value);
|
||||
int decode_unsigned16(uint8_t * apdu, uint16_t * value);
|
||||
int encode_unsigned24(uint8_t * apdu, uint32_t value);
|
||||
int decode_unsigned24(uint8_t * apdu, uint32_t * value);
|
||||
int encode_unsigned32(uint8_t * apdu, uint32_t value);
|
||||
int decode_unsigned32(uint8_t * apdu, uint32_t * value);
|
||||
int encode_unsigned16(
|
||||
uint8_t * apdu,
|
||||
uint16_t value);
|
||||
int decode_unsigned16(
|
||||
uint8_t * apdu,
|
||||
uint16_t * value);
|
||||
int encode_unsigned24(
|
||||
uint8_t * apdu,
|
||||
uint32_t value);
|
||||
int decode_unsigned24(
|
||||
uint8_t * apdu,
|
||||
uint32_t * value);
|
||||
int encode_unsigned32(
|
||||
uint8_t * apdu,
|
||||
uint32_t value);
|
||||
int decode_unsigned32(
|
||||
uint8_t * apdu,
|
||||
uint32_t * value);
|
||||
|
||||
/* signed value encoding and decoding */
|
||||
int encode_signed8(uint8_t * apdu, int8_t value);
|
||||
int decode_signed8(uint8_t * apdu, int32_t * value);
|
||||
int encode_signed16(uint8_t * apdu, int16_t value);
|
||||
int decode_signed16(uint8_t * apdu, int32_t * value);
|
||||
int encode_signed24(uint8_t * apdu, int32_t value);
|
||||
int decode_signed24(uint8_t * apdu, int32_t * value);
|
||||
int encode_signed32(uint8_t * apdu, int32_t value);
|
||||
int decode_signed32(uint8_t * apdu, int32_t * value);
|
||||
|
||||
int encode_signed8(
|
||||
uint8_t * apdu,
|
||||
int8_t value);
|
||||
int decode_signed8(
|
||||
uint8_t * apdu,
|
||||
int32_t * value);
|
||||
int encode_signed16(
|
||||
uint8_t * apdu,
|
||||
int16_t value);
|
||||
int decode_signed16(
|
||||
uint8_t * apdu,
|
||||
int32_t * value);
|
||||
int encode_signed24(
|
||||
uint8_t * apdu,
|
||||
int32_t value);
|
||||
int decode_signed24(
|
||||
uint8_t * apdu,
|
||||
int32_t * value);
|
||||
int encode_signed32(
|
||||
uint8_t * apdu,
|
||||
int32_t value);
|
||||
int decode_signed32(
|
||||
uint8_t * apdu,
|
||||
int32_t * value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,20 +39,24 @@
|
||||
#include "bacenum.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 */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
signed bacprop_tag_by_index_default(PROP_TAG_DATA * data_list,
|
||||
signed index, signed default_ret);
|
||||
signed bacprop_tag_by_index_default(
|
||||
PROP_TAG_DATA * data_list,
|
||||
signed index,
|
||||
signed default_ret);
|
||||
|
||||
signed bacprop_property_tag(BACNET_OBJECT_TYPE type, signed prop);
|
||||
signed bacprop_property_tag(
|
||||
BACNET_OBJECT_TYPE type,
|
||||
signed prop);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -40,20 +40,23 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int decode_real(uint8_t * apdu, float *real_value);
|
||||
int encode_bacnet_real(float value, uint8_t * apdu);
|
||||
int decode_real(
|
||||
uint8_t * apdu,
|
||||
float *real_value);
|
||||
int encode_bacnet_real(
|
||||
float value,
|
||||
uint8_t * apdu);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
|
||||
void testBACreal(Test * pTest);
|
||||
void testBACreal(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -65,23 +65,36 @@ typedef struct BACnet_Octet_String {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void bitstring_init(BACNET_BIT_STRING * bit_string);
|
||||
void bitstring_set_bit(BACNET_BIT_STRING * bit_string, uint8_t bit_number,
|
||||
void bitstring_init(
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
void bitstring_set_bit(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bit_number,
|
||||
bool value);
|
||||
bool bitstring_bit(BACNET_BIT_STRING * bit_string, uint8_t bit_number);
|
||||
uint8_t bitstring_bits_used(BACNET_BIT_STRING * bit_string);
|
||||
bool bitstring_bit(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bit_number);
|
||||
uint8_t bitstring_bits_used(
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
/* returns the number of bytes that a bit string is using */
|
||||
int bitstring_bytes_used(BACNET_BIT_STRING * bit_string);
|
||||
uint8_t bitstring_bits_capacity(BACNET_BIT_STRING * bit_string);
|
||||
int bitstring_bytes_used(
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
uint8_t bitstring_bits_capacity(
|
||||
BACNET_BIT_STRING * bit_string);
|
||||
/* used for encoding and decoding from the APDU */
|
||||
uint8_t bitstring_octet(BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bitstring_octet(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t octet_index);
|
||||
bool bitstring_set_octet(BACNET_BIT_STRING * bit_string, uint8_t index,
|
||||
bool bitstring_set_octet(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t index,
|
||||
uint8_t octet);
|
||||
bool bitstring_set_bits_used(BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bytes_used, uint8_t unused_bits);
|
||||
bool bitstring_set_bits_used(
|
||||
BACNET_BIT_STRING * bit_string,
|
||||
uint8_t bytes_used,
|
||||
uint8_t unused_bits);
|
||||
bool bitstring_copy(
|
||||
BACNET_BIT_STRING * dest,
|
||||
BACNET_BIT_STRING * src);
|
||||
@@ -89,57 +102,80 @@ extern "C" {
|
||||
|
||||
/* returns false if the string exceeds capacity
|
||||
initialize by using length=0 */
|
||||
bool characterstring_init(BACNET_CHARACTER_STRING * char_string,
|
||||
uint8_t encoding, char *value, size_t length);
|
||||
bool characterstring_init(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
uint8_t encoding,
|
||||
char *value,
|
||||
size_t length);
|
||||
/* used for ANSI C-Strings */
|
||||
bool characterstring_init_ansi(BACNET_CHARACTER_STRING * char_string,
|
||||
bool characterstring_init_ansi(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
char *value);
|
||||
bool characterstring_copy(BACNET_CHARACTER_STRING * dest,
|
||||
bool characterstring_copy(
|
||||
BACNET_CHARACTER_STRING * dest,
|
||||
BACNET_CHARACTER_STRING * src);
|
||||
/* returns true if the strings are the same length, encoding, value */
|
||||
bool characterstring_same(BACNET_CHARACTER_STRING * dest,
|
||||
bool characterstring_same(
|
||||
BACNET_CHARACTER_STRING * dest,
|
||||
BACNET_CHARACTER_STRING * src);
|
||||
bool characterstring_ansi_same(BACNET_CHARACTER_STRING * dest,
|
||||
bool characterstring_ansi_same(
|
||||
BACNET_CHARACTER_STRING * dest,
|
||||
const char *src);
|
||||
/* returns false if the string exceeds capacity */
|
||||
bool characterstring_append(BACNET_CHARACTER_STRING * char_string,
|
||||
char *value, size_t length);
|
||||
bool characterstring_append(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
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. */
|
||||
bool characterstring_truncate(BACNET_CHARACTER_STRING * char_string,
|
||||
bool characterstring_truncate(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
size_t length);
|
||||
bool characterstring_set_encoding(BACNET_CHARACTER_STRING *
|
||||
char_string, uint8_t encoding);
|
||||
bool characterstring_set_encoding(
|
||||
BACNET_CHARACTER_STRING * char_string,
|
||||
uint8_t encoding);
|
||||
/* Returns the value */
|
||||
char *characterstring_value(BACNET_CHARACTER_STRING * char_string);
|
||||
char *characterstring_value(
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
/* returns the length */
|
||||
size_t characterstring_length(BACNET_CHARACTER_STRING * char_string);
|
||||
uint8_t characterstring_encoding(BACNET_CHARACTER_STRING *
|
||||
char_string);
|
||||
size_t characterstring_capacity(BACNET_CHARACTER_STRING * char_string);
|
||||
size_t characterstring_length(
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
uint8_t characterstring_encoding(
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
size_t characterstring_capacity(
|
||||
BACNET_CHARACTER_STRING * char_string);
|
||||
|
||||
/* returns false if the string exceeds capacity
|
||||
initialize by using length=0 */
|
||||
bool octetstring_init(BACNET_OCTET_STRING * octet_string,
|
||||
uint8_t * value, size_t length);
|
||||
bool octetstring_copy(BACNET_OCTET_STRING * dest,
|
||||
bool octetstring_init(
|
||||
BACNET_OCTET_STRING * octet_string,
|
||||
uint8_t * value,
|
||||
size_t length);
|
||||
bool octetstring_copy(
|
||||
BACNET_OCTET_STRING * dest,
|
||||
BACNET_OCTET_STRING * src);
|
||||
/* returns false if the string exceeds capacity */
|
||||
bool octetstring_append(BACNET_OCTET_STRING * octet_string,
|
||||
uint8_t * value, size_t length);
|
||||
bool octetstring_append(
|
||||
BACNET_OCTET_STRING * octet_string,
|
||||
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. */
|
||||
bool octetstring_truncate(BACNET_OCTET_STRING * octet_string,
|
||||
bool octetstring_truncate(
|
||||
BACNET_OCTET_STRING * octet_string,
|
||||
size_t length);
|
||||
/* Returns the value */
|
||||
uint8_t *octetstring_value(BACNET_OCTET_STRING * octet_string);
|
||||
uint8_t *octetstring_value(
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
/* Returns the length.*/
|
||||
size_t octetstring_length(BACNET_OCTET_STRING * octet_string);
|
||||
size_t octetstring_capacity(BACNET_OCTET_STRING * octet_string);
|
||||
size_t octetstring_length(
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
size_t octetstring_capacity(
|
||||
BACNET_OCTET_STRING * octet_string);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -51,31 +51,50 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
const char *bactext_confirmed_service_name(int index);
|
||||
const char *bactext_unconfirmed_service_name(int index);
|
||||
const char *bactext_application_tag_name(int index);
|
||||
const char *bactext_object_type_name(int index);
|
||||
const char *bactext_property_name(int index);
|
||||
const char *bactext_engineering_unit_name(int index);
|
||||
const char *bactext_reject_reason_name(int index);
|
||||
const char *bactext_abort_reason_name(int index);
|
||||
const char *bactext_error_class_name(int index);
|
||||
const char *bactext_error_code_name(int index);
|
||||
unsigned bactext_property_id(const char *name);
|
||||
const char *bactext_month_name(int index);
|
||||
const char *bactext_week_of_month_name(int index);
|
||||
const char *bactext_day_of_week_name(int index);
|
||||
const char *bactext_event_state_name(int index);
|
||||
const char *bactext_binary_present_value_name(int index);
|
||||
const char *bactext_reliability_name(int index);
|
||||
const char *bactext_device_status_name(int index);
|
||||
const char *bactext_segmentation_name(int index);
|
||||
const char *bactext_confirmed_service_name(
|
||||
int index);
|
||||
const char *bactext_unconfirmed_service_name(
|
||||
int index);
|
||||
const char *bactext_application_tag_name(
|
||||
int index);
|
||||
const char *bactext_object_type_name(
|
||||
int index);
|
||||
const char *bactext_property_name(
|
||||
int index);
|
||||
const char *bactext_engineering_unit_name(
|
||||
int index);
|
||||
const char *bactext_reject_reason_name(
|
||||
int index);
|
||||
const char *bactext_abort_reason_name(
|
||||
int index);
|
||||
const char *bactext_error_class_name(
|
||||
int index);
|
||||
const char *bactext_error_code_name(
|
||||
int index);
|
||||
unsigned bactext_property_id(
|
||||
const char *name);
|
||||
const char *bactext_month_name(
|
||||
int index);
|
||||
const char *bactext_week_of_month_name(
|
||||
int index);
|
||||
const char *bactext_day_of_week_name(
|
||||
int index);
|
||||
const char *bactext_event_state_name(
|
||||
int index);
|
||||
const char *bactext_binary_present_value_name(
|
||||
int index);
|
||||
const char *bactext_reliability_name(
|
||||
int index);
|
||||
const char *bactext_device_status_name(
|
||||
int index);
|
||||
const char *bactext_segmentation_name(
|
||||
int index);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* BACTEXT_PRINT_ENABLED */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* BACTEXT_PRINT_ENABLED */
|
||||
#endif
|
||||
|
||||
@@ -31,29 +31,36 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Binary_Input_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Binary_Input_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Binary_Input_Count(void);
|
||||
uint32_t Binary_Input_Index_To_Instance(unsigned index);
|
||||
char *Binary_Input_Name(uint32_t object_instance);
|
||||
bool Binary_Input_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Binary_Input_Count(
|
||||
void);
|
||||
uint32_t Binary_Input_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Binary_Input_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Binary_Input_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testBinaryInput(Test * pTest);
|
||||
void testBinaryInput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Big-Endian systems save the most significant byte first. */
|
||||
/* Sun and Motorola processors, IBM-370s and PDP-10s are big-endian. */
|
||||
@@ -21,9 +21,10 @@ extern "C" {
|
||||
/* x[2] = 0x03 */
|
||||
/* x[3] = 0x04 */
|
||||
|
||||
int big_endian(void);
|
||||
int big_endian(
|
||||
void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+34
-19
@@ -51,51 +51,66 @@ extern bool BIP_Debug;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* note: define init and cleanup in your ports section */
|
||||
/* on Linux, ifname is eth0, ath0, arc0, and others.
|
||||
on Windows, ifname is the dotted ip address of the interface */
|
||||
bool bip_init(char *ifname);
|
||||
bool bip_init(
|
||||
char *ifname);
|
||||
|
||||
/* normal functions... */
|
||||
void bip_cleanup(void);
|
||||
void bip_set_socket(int sock_fd);
|
||||
int bip_socket(void);
|
||||
bool bip_valid(void);
|
||||
void bip_get_broadcast_address(BACNET_ADDRESS * dest); /* destination address */
|
||||
void bip_get_my_address(BACNET_ADDRESS * my_address);
|
||||
void bip_cleanup(
|
||||
void);
|
||||
void bip_set_socket(
|
||||
int sock_fd);
|
||||
int bip_socket(
|
||||
void);
|
||||
bool bip_valid(
|
||||
void);
|
||||
void bip_get_broadcast_address(
|
||||
BACNET_ADDRESS * dest); /* destination address */
|
||||
void bip_get_my_address(
|
||||
BACNET_ADDRESS * my_address);
|
||||
|
||||
/* function to send a packet out the BACnet/IP socket */
|
||||
/* returns zero on success, non-zero on failure */
|
||||
int bip_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
int bip_send_pdu(
|
||||
BACNET_ADDRESS * dest, /* destination address */
|
||||
BACNET_NPDU_DATA * npdu_data, /* network information */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len); /* number of bytes of data */
|
||||
|
||||
/* receives a BACnet/IP packet */
|
||||
/* returns the number of octets in the PDU, or zero on failure */
|
||||
uint16_t bip_receive(BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t bip_receive(
|
||||
BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t max_pdu, /* amount of space available in the PDU */
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
|
||||
/* use host byte order for setting */
|
||||
void bip_set_port(uint16_t port);
|
||||
void bip_set_port(
|
||||
uint16_t port);
|
||||
/* returns host byte order */
|
||||
uint16_t bip_get_port(void);
|
||||
uint16_t bip_get_port(
|
||||
void);
|
||||
|
||||
/* use network byte order for setting */
|
||||
void bip_set_addr(uint32_t net_address);
|
||||
void bip_set_addr(
|
||||
uint32_t net_address);
|
||||
/* returns host byte order */
|
||||
uint32_t bip_get_addr(void);
|
||||
uint32_t bip_get_addr(
|
||||
void);
|
||||
|
||||
/* use network byte order for setting */
|
||||
void bip_set_broadcast_addr(uint32_t net_address);
|
||||
void bip_set_broadcast_addr(
|
||||
uint32_t net_address);
|
||||
/* returns host byte order */
|
||||
uint32_t bip_get_broadcast_addr(void);
|
||||
uint32_t bip_get_broadcast_addr(
|
||||
void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+20
-11
@@ -33,32 +33,41 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Binary_Output_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Binary_Output_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Binary_Output_Count(void);
|
||||
uint32_t Binary_Output_Index_To_Instance(unsigned index);
|
||||
char *Binary_Output_Name(uint32_t object_instance);
|
||||
bool Binary_Output_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Binary_Output_Count(
|
||||
void);
|
||||
uint32_t Binary_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Binary_Output_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Binary_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Binary_Output_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Binary_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testBinaryOutput(Test * pTest);
|
||||
void testBinaryOutput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+20
-11
@@ -33,32 +33,41 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Binary_Value_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Binary_Value_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Binary_Value_Count(void);
|
||||
uint32_t Binary_Value_Index_To_Instance(unsigned index);
|
||||
char *Binary_Value_Name(uint32_t object_instance);
|
||||
bool Binary_Value_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Binary_Value_Count(
|
||||
void);
|
||||
uint32_t Binary_Value_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Binary_Value_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Binary_Value_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Binary_Value_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testBinary_Value(Test * pTest);
|
||||
void testBinary_Value(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -43,21 +43,21 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
uint16_t bvlc_receive(
|
||||
BACNET_ADDRESS * src, /* returns the source address */
|
||||
uint8_t * npdu, /* returns the NPDU */
|
||||
uint8_t * npdu, /* returns the NPDU */
|
||||
uint16_t max_npdu, /* amount of space available in the NPDU */
|
||||
unsigned timeout); /* number of milliseconds to wait for a packet */
|
||||
unsigned timeout); /* number of milliseconds to wait for a packet */
|
||||
|
||||
int bvlc_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
BACNET_NPDU_DATA * npdu_data, /* network information */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
int bvlc_send_pdu(
|
||||
BACNET_ADDRESS * dest, /* destination address */
|
||||
BACNET_NPDU_DATA * npdu_data, /* network information */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif /* */
|
||||
|
||||
@@ -67,4 +67,4 @@
|
||||
|
||||
|
||||
|
||||
#endif /* end of header file */
|
||||
#endif /* end of header file */
|
||||
|
||||
@@ -35,56 +35,81 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* unconfirmed requests */
|
||||
void Send_WhoIs(int32_t low_limit, int32_t high_limit);
|
||||
void Send_WhoIs(
|
||||
int32_t low_limit,
|
||||
int32_t high_limit);
|
||||
|
||||
void Send_WhoHas_Object(int32_t low_limit,
|
||||
void Send_WhoHas_Object(
|
||||
int32_t low_limit,
|
||||
int32_t high_limit,
|
||||
BACNET_OBJECT_TYPE object_type, uint32_t object_instance);
|
||||
|
||||
void Send_WhoHas_Name(int32_t low_limit,
|
||||
int32_t high_limit, char *object_name);
|
||||
|
||||
void Send_I_Have(uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance, char *object_name);
|
||||
uint32_t object_instance);
|
||||
|
||||
/* returns the invoke ID for confirmed request, or 0 if failed */
|
||||
uint8_t Send_Read_Property_Request(uint32_t device_id, /* destination device */
|
||||
void Send_WhoHas_Name(
|
||||
int32_t low_limit,
|
||||
int32_t high_limit,
|
||||
char *object_name);
|
||||
|
||||
void Send_I_Have(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property, int32_t array_index);
|
||||
char *object_name);
|
||||
|
||||
/* returns the invoke ID for confirmed request, or 0 if failed */
|
||||
uint8_t Send_Write_Property_Request(uint32_t device_id, /* destination device */
|
||||
uint8_t Send_Read_Property_Request(
|
||||
uint32_t device_id, /* destination device */
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
int32_t array_index);
|
||||
|
||||
/* returns the invoke ID for confirmed request, or 0 if failed */
|
||||
uint8_t Send_Write_Property_Request(
|
||||
uint32_t device_id, /* destination device */
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
BACNET_APPLICATION_DATA_VALUE * object_value,
|
||||
uint8_t priority, int32_t array_index);
|
||||
uint8_t priority,
|
||||
int32_t array_index);
|
||||
|
||||
/* returns the invoke ID for confirmed request, or 0 if failed */
|
||||
uint8_t Send_Reinitialize_Device_Request(uint32_t device_id,
|
||||
BACNET_REINITIALIZED_STATE state, char *password);
|
||||
uint8_t Send_Reinitialize_Device_Request(
|
||||
uint32_t device_id,
|
||||
BACNET_REINITIALIZED_STATE state,
|
||||
char *password);
|
||||
|
||||
/* returns the invoke ID for confirmed request, or 0 if failed */
|
||||
uint8_t Send_Device_Communication_Control_Request(uint32_t device_id, uint16_t timeDuration, /* 0=optional */
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE state, char *password); /* NULL=optional */
|
||||
uint8_t Send_Device_Communication_Control_Request(
|
||||
uint32_t device_id,
|
||||
uint16_t timeDuration, /* 0=optional */
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE state,
|
||||
char *password); /* NULL=optional */
|
||||
|
||||
void Send_TimeSync(BACNET_DATE * bdate, BACNET_TIME * btime);
|
||||
void Send_TimeSyncUTC(BACNET_DATE * bdate, BACNET_TIME * btime);
|
||||
void Send_TimeSync(
|
||||
BACNET_DATE * bdate,
|
||||
BACNET_TIME * btime);
|
||||
void Send_TimeSyncUTC(
|
||||
BACNET_DATE * bdate,
|
||||
BACNET_TIME * btime);
|
||||
|
||||
uint8_t Send_Atomic_Read_File_Stream(uint32_t device_id,
|
||||
uint32_t file_instance, int fileStartPosition,
|
||||
unsigned requestedOctetCount);
|
||||
uint8_t Send_Atomic_Write_File_Stream(uint32_t device_id,
|
||||
uint8_t Send_Atomic_Read_File_Stream(
|
||||
uint32_t device_id,
|
||||
uint32_t file_instance,
|
||||
int fileStartPosition, BACNET_OCTET_STRING * fileData);
|
||||
int fileStartPosition,
|
||||
unsigned requestedOctetCount);
|
||||
uint8_t Send_Atomic_Write_File_Stream(
|
||||
uint32_t device_id,
|
||||
uint32_t file_instance,
|
||||
int fileStartPosition,
|
||||
BACNET_OCTET_STRING * fileData);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -7,29 +7,29 @@
|
||||
/* declare a single physical layer using your compiler define.
|
||||
see datalink.h for possible defines. */
|
||||
#if !(defined(BACDL_ETHERNET) || defined(BACDL_ARCNET) || defined(BACDL_MSTP) || defined(BACDL_BIP) || defined(BACDL_TEST))
|
||||
#define BACDL_BIP
|
||||
#define BACDL_BIP
|
||||
#endif
|
||||
|
||||
/* optional debug info for BACnet/IP datalink layers */
|
||||
#if defined(BACDL_BIP)
|
||||
#if !defined(USE_INADDR)
|
||||
#define USE_INADDR 1
|
||||
#endif
|
||||
#if !defined(USE_INADDR)
|
||||
#define USE_INADDR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define your processor architecture as
|
||||
Big Endian (PowerPC,68K,Sparc) or Little Endian (Intel,AVR)
|
||||
ARM and MIPS can be either - what is your setup? */
|
||||
#if !defined(BIG_ENDIAN)
|
||||
#define BIG_ENDIAN 0
|
||||
#define BIG_ENDIAN 0
|
||||
#endif
|
||||
|
||||
/* Define your Vendor Identifier assigned by ASHRAE */
|
||||
#if !defined(BACNET_VENDOR_ID)
|
||||
#define BACNET_VENDOR_ID 260
|
||||
#define BACNET_VENDOR_ID 260
|
||||
#endif
|
||||
#if !defined(BACNET_VENDOR_NAME)
|
||||
#define BACNET_VENDOR_NAME "BACnet Stack at SourceForge"
|
||||
#define BACNET_VENDOR_NAME "BACnet Stack at SourceForge"
|
||||
#endif
|
||||
|
||||
/* Max number of bytes in an APDU. */
|
||||
@@ -39,7 +39,7 @@
|
||||
/* Lon=206, MS/TP=480, ARCNET=480, Ethernet=1476, BACnet/IP=64K */
|
||||
#if !defined(MAX_APDU)
|
||||
/* #define MAX_APDU 50 */
|
||||
#define MAX_APDU 480
|
||||
#define MAX_APDU 480
|
||||
/* #define MAX_APDU 1476 */
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
/* Configure from 1..255 for number of outstanding confirmed */
|
||||
/* requests available. */
|
||||
#if !defined(MAX_TSM_TRANSACTIONS)
|
||||
#define MAX_TSM_TRANSACTIONS 255
|
||||
#define MAX_TSM_TRANSACTIONS 255
|
||||
#endif
|
||||
/* The address cache is used for binding to BACnet devices */
|
||||
/* The number of entries corresponds to the number of */
|
||||
@@ -57,30 +57,30 @@
|
||||
/* If your device is a simple server and does not need to bind, */
|
||||
/* then you don't need to use this. */
|
||||
#if !defined(MAX_ADDRESS_CACHE)
|
||||
#define MAX_ADDRESS_CACHE 255
|
||||
#define MAX_ADDRESS_CACHE 255
|
||||
#endif
|
||||
|
||||
/* some modules have debugging enabled using PRINT_ENABLED */
|
||||
#if !defined(PRINT_ENABLED)
|
||||
#define PRINT_ENABLED 0
|
||||
#define PRINT_ENABLED 0
|
||||
#endif
|
||||
|
||||
/* BACAPP decodes WriteProperty service requests
|
||||
Choose the datatypes that your application supports */
|
||||
#if defined (BACAPP_ALL)
|
||||
#define BACAPP_NULL
|
||||
#define BACAPP_BOOLEAN
|
||||
#define BACAPP_UNSIGNED
|
||||
#define BACAPP_SIGNED
|
||||
#define BACAPP_REAL
|
||||
#define BACAPP_NULL
|
||||
#define BACAPP_BOOLEAN
|
||||
#define BACAPP_UNSIGNED
|
||||
#define BACAPP_SIGNED
|
||||
#define BACAPP_REAL
|
||||
/* FIXME: not implemented #define BACAPP_DOUBLE */
|
||||
#define BACAPP_OCTET_STRING
|
||||
#define BACAPP_CHARACTER_STRING
|
||||
#define BACAPP_BIT_STRING
|
||||
#define BACAPP_ENUMERATED
|
||||
#define BACAPP_DATE
|
||||
#define BACAPP_TIME
|
||||
#define BACAPP_OBJECT_ID
|
||||
#define BACAPP_OCTET_STRING
|
||||
#define BACAPP_CHARACTER_STRING
|
||||
#define BACAPP_BIT_STRING
|
||||
#define BACAPP_ENUMERATED
|
||||
#define BACAPP_DATE
|
||||
#define BACAPP_TIME
|
||||
#define BACAPP_OBJECT_ID
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+49
-25
@@ -67,54 +67,78 @@ typedef struct BACnet_Subscribe_COV_Data {
|
||||
BACNET_OBJECT_ID monitoredObjectIdentifier;
|
||||
bool cancellationRequest; /* true if this is a cancellation request */
|
||||
bool issueConfirmedNotifications; /* optional */
|
||||
unsigned lifetime; /* optional */
|
||||
unsigned lifetime; /* optional */
|
||||
BACNET_PROPERTY_REFERENCE monitoredProperty;
|
||||
bool covIncrementPresent; /* true if present */
|
||||
float covIncrement; /* optional */
|
||||
float covIncrement; /* optional */
|
||||
} BACNET_SUBSCRIBE_COV_DATA;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int ucov_notify_encode_apdu(uint8_t * apdu, BACNET_COV_DATA * data);
|
||||
int ucov_notify_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
BACNET_COV_DATA * data);
|
||||
|
||||
int ucov_notify_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_COV_DATA * data);
|
||||
int ucov_notify_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_COV_DATA * data);
|
||||
|
||||
int ucov_notify_send(uint8_t * buffer, BACNET_COV_DATA * data);
|
||||
int ucov_notify_send(
|
||||
uint8_t * buffer,
|
||||
BACNET_COV_DATA * data);
|
||||
|
||||
int ccov_notify_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_COV_DATA * data);
|
||||
int ccov_notify_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_COV_DATA * data);
|
||||
|
||||
int ccov_notify_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, uint8_t * invoke_id, BACNET_COV_DATA * data);
|
||||
int ccov_notify_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_COV_DATA * data);
|
||||
|
||||
/* common for both confirmed and unconfirmed */
|
||||
int cov_notify_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_COV_DATA * data);
|
||||
int cov_notify_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_COV_DATA * data);
|
||||
|
||||
int cov_subscribe_property_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
int cov_subscribe_property_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
|
||||
int cov_subscribe_property_encode_adpu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
int cov_subscribe_property_encode_adpu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
|
||||
int cov_subscribe_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
int cov_subscribe_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
|
||||
int cov_subscribe_encode_adpu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
int cov_subscribe_encode_adpu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_SUBSCRIBE_COV_DATA * data);
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testCOVNotify(Test * pTest);
|
||||
void testCOVSubscribeProperty(Test * pTest);
|
||||
void testCOVSubscribe(Test * pTest);
|
||||
void testCOVNotify(
|
||||
Test * pTest);
|
||||
void testCOVSubscribeProperty(
|
||||
Test * pTest);
|
||||
void testCOVSubscribe(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -40,12 +40,16 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
uint8_t CRC_Calc_Header(uint8_t dataValue, uint8_t crcValue);
|
||||
uint16_t CRC_Calc_Data(uint8_t dataValue, uint16_t crcValue);
|
||||
uint8_t CRC_Calc_Header(
|
||||
uint8_t dataValue,
|
||||
uint8_t crcValue);
|
||||
uint16_t CRC_Calc_Data(
|
||||
uint8_t dataValue,
|
||||
uint16_t crcValue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -69,16 +69,16 @@
|
||||
#elif defined(BACDL_BIP)
|
||||
#include "bip.h"
|
||||
#ifdef BBMD_ENABLED
|
||||
#include "bvlc.h"
|
||||
#include "bvlc.h"
|
||||
#endif
|
||||
|
||||
#define datalink_init bip_init
|
||||
#ifdef BBMD_ENABLED
|
||||
#define datalink_send_pdu bvlc_send_pdu
|
||||
#define datalink_receive bvlc_receive
|
||||
#define datalink_send_pdu bvlc_send_pdu
|
||||
#define datalink_receive bvlc_receive
|
||||
#else
|
||||
#define datalink_send_pdu bip_send_pdu
|
||||
#define datalink_receive bip_receive
|
||||
#define datalink_send_pdu bip_send_pdu
|
||||
#define datalink_receive bip_receive
|
||||
#endif
|
||||
#define datalink_cleanup bip_cleanup
|
||||
#define datalink_get_broadcast_address bip_get_broadcast_address
|
||||
@@ -87,14 +87,24 @@
|
||||
#else
|
||||
#include "npdu.h"
|
||||
|
||||
extern int datalink_send_pdu(BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * npdu_data, uint8_t * pdu, unsigned pdu_len);
|
||||
extern uint16_t datalink_receive(BACNET_ADDRESS * src,
|
||||
uint8_t * pdu, uint16_t max_pdu, unsigned timeout);
|
||||
extern void datalink_cleanup(void);
|
||||
extern void datalink_get_broadcast_address(BACNET_ADDRESS * dest);
|
||||
extern void datalink_get_my_address(BACNET_ADDRESS * my_address);
|
||||
extern void datalink_set_interface(char *ifname);
|
||||
extern int datalink_send_pdu(
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * npdu_data,
|
||||
uint8_t * pdu,
|
||||
unsigned pdu_len);
|
||||
extern uint16_t datalink_receive(
|
||||
BACNET_ADDRESS * src,
|
||||
uint8_t * pdu,
|
||||
uint16_t max_pdu,
|
||||
unsigned timeout);
|
||||
extern void datalink_cleanup(
|
||||
void);
|
||||
extern void datalink_get_broadcast_address(
|
||||
BACNET_ADDRESS * dest);
|
||||
extern void datalink_get_my_address(
|
||||
BACNET_ADDRESS * my_address);
|
||||
extern void datalink_set_interface(
|
||||
char *ifname);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ typedef enum BACnet_Weekday {
|
||||
|
||||
/* date */
|
||||
typedef struct BACnet_Date {
|
||||
uint16_t year; /* AD */
|
||||
uint8_t month; /* 1=Jan */
|
||||
uint8_t day; /* 1..31 */
|
||||
uint8_t wday; /* 1=Monday-7=Sunday */
|
||||
uint16_t year; /* AD */
|
||||
uint8_t month; /* 1=Jan */
|
||||
uint8_t day; /* 1..31 */
|
||||
uint8_t wday; /* 1=Monday-7=Sunday */
|
||||
} BACNET_DATE;
|
||||
|
||||
/* time */
|
||||
@@ -70,45 +70,75 @@ typedef struct BACnet_DateTime {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* utility initialization functions */
|
||||
void datetime_set_date(BACNET_DATE * bdate,
|
||||
uint16_t year, uint8_t month, uint8_t day);
|
||||
void datetime_set_time(BACNET_TIME * btime,
|
||||
uint8_t hour, uint8_t minute, uint8_t seconds, uint8_t hundredths);
|
||||
void datetime_set(BACNET_DATE_TIME * bdatetime,
|
||||
BACNET_DATE * bdate, BACNET_TIME * btime);
|
||||
void datetime_set_values(BACNET_DATE_TIME * bdatetime,
|
||||
uint16_t year, uint8_t month, uint8_t day,
|
||||
uint8_t hour, uint8_t minute, uint8_t seconds, uint8_t hundredths);
|
||||
void datetime_set_date(
|
||||
BACNET_DATE * bdate,
|
||||
uint16_t year,
|
||||
uint8_t month,
|
||||
uint8_t day);
|
||||
void datetime_set_time(
|
||||
BACNET_TIME * btime,
|
||||
uint8_t hour,
|
||||
uint8_t minute,
|
||||
uint8_t seconds,
|
||||
uint8_t hundredths);
|
||||
void datetime_set(
|
||||
BACNET_DATE_TIME * bdatetime,
|
||||
BACNET_DATE * bdate,
|
||||
BACNET_TIME * btime);
|
||||
void datetime_set_values(
|
||||
BACNET_DATE_TIME * bdatetime,
|
||||
uint16_t year,
|
||||
uint8_t month,
|
||||
uint8_t day,
|
||||
uint8_t hour,
|
||||
uint8_t minute,
|
||||
uint8_t seconds,
|
||||
uint8_t hundredths);
|
||||
|
||||
/* utility comparison functions:
|
||||
if the date/times are the same, return is 0
|
||||
if date1 is before date2, returns negative
|
||||
if date1 is after date2, returns positive */
|
||||
int datetime_compare_date(BACNET_DATE * date1, BACNET_DATE * date2);
|
||||
int datetime_compare_time(BACNET_TIME * time1, BACNET_TIME * time2);
|
||||
int datetime_compare(BACNET_DATE_TIME * datetime1,
|
||||
int datetime_compare_date(
|
||||
BACNET_DATE * date1,
|
||||
BACNET_DATE * date2);
|
||||
int datetime_compare_time(
|
||||
BACNET_TIME * time1,
|
||||
BACNET_TIME * time2);
|
||||
int datetime_compare(
|
||||
BACNET_DATE_TIME * datetime1,
|
||||
BACNET_DATE_TIME * datetime2);
|
||||
|
||||
/* utility copy functions */
|
||||
void datetime_copy_date(BACNET_DATE * date1, BACNET_DATE * date2);
|
||||
void datetime_copy_time(BACNET_TIME * time1, BACNET_TIME * time2);
|
||||
void datetime_copy(BACNET_DATE_TIME * datetime1,
|
||||
void datetime_copy_date(
|
||||
BACNET_DATE * date1,
|
||||
BACNET_DATE * date2);
|
||||
void datetime_copy_time(
|
||||
BACNET_TIME * time1,
|
||||
BACNET_TIME * time2);
|
||||
void datetime_copy(
|
||||
BACNET_DATE_TIME * datetime1,
|
||||
BACNET_DATE_TIME * datetime2);
|
||||
|
||||
/* utility add function */
|
||||
void datetime_add_minutes(BACNET_DATE_TIME * bdatetime,
|
||||
void datetime_add_minutes(
|
||||
BACNET_DATE_TIME * bdatetime,
|
||||
uint32_t minutes);
|
||||
|
||||
/* date and time wildcards */
|
||||
bool datetime_wildcard(BACNET_DATE_TIME * bdatetime);
|
||||
void datetime_wildcard_set(BACNET_DATE_TIME * bdatetime);
|
||||
void datetime_date_wildcard_set(BACNET_DATE * bdate);
|
||||
void datetime_time_wildcard_set(BACNET_TIME * btime);
|
||||
bool datetime_wildcard(
|
||||
BACNET_DATE_TIME * bdatetime);
|
||||
void datetime_wildcard_set(
|
||||
BACNET_DATE_TIME * bdatetime);
|
||||
void datetime_date_wildcard_set(
|
||||
BACNET_DATE * bdate);
|
||||
void datetime_time_wildcard_set(
|
||||
BACNET_TIME * btime);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* DATE_TIME_H */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* DATE_TIME_H */
|
||||
|
||||
+29
-15
@@ -41,28 +41,40 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* return the status */
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE dcc_enable_status(void);
|
||||
bool dcc_communication_enabled(void);
|
||||
bool dcc_communication_disabled(void);
|
||||
bool dcc_communication_initiation_disabled(void);
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE dcc_enable_status(
|
||||
void);
|
||||
bool dcc_communication_enabled(
|
||||
void);
|
||||
bool dcc_communication_disabled(
|
||||
void);
|
||||
bool dcc_communication_initiation_disabled(
|
||||
void);
|
||||
/* return the time */
|
||||
uint32_t dcc_duration_seconds(void);
|
||||
uint32_t dcc_duration_seconds(
|
||||
void);
|
||||
/* called every second or so. If more than one second,
|
||||
then seconds should be the number of seconds to tick away */
|
||||
void dcc_timer_seconds(uint32_t seconds);
|
||||
void dcc_timer_seconds(
|
||||
uint32_t seconds);
|
||||
/* setup the communication values */
|
||||
bool dcc_set_status_duration(BACNET_COMMUNICATION_ENABLE_DISABLE
|
||||
status, uint16_t minutes);
|
||||
bool dcc_set_status_duration(
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE status,
|
||||
uint16_t minutes);
|
||||
|
||||
/* encode service */
|
||||
int dcc_encode_apdu(uint8_t * apdu, uint8_t invoke_id, uint16_t timeDuration, /* 0=optional */
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE enable_disable, BACNET_CHARACTER_STRING * password); /* NULL=optional */
|
||||
int dcc_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
uint16_t timeDuration, /* 0=optional */
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE enable_disable,
|
||||
BACNET_CHARACTER_STRING * password); /* NULL=optional */
|
||||
|
||||
/* decode the service request only */
|
||||
int dcc_decode_service_request(uint8_t * apdu,
|
||||
int dcc_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint16_t * timeDuration,
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE * enable_disable,
|
||||
@@ -70,17 +82,19 @@ extern "C" {
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int dcc_decode_apdu(uint8_t * apdu,
|
||||
int dcc_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
uint16_t * timeDuration,
|
||||
BACNET_COMMUNICATION_ENABLE_DISABLE * enable_disable,
|
||||
BACNET_CHARACTER_STRING * password);
|
||||
|
||||
void test_DeviceCommunicationControl(Test * pTest);
|
||||
void test_DeviceCommunicationControl(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -42,71 +42,110 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Device_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
|
||||
uint32_t Device_Object_Instance_Number(void);
|
||||
bool Device_Set_Object_Instance_Number(uint32_t object_id);
|
||||
bool Device_Valid_Object_Instance_Number(uint32_t object_id);
|
||||
unsigned Device_Object_List_Count(void);
|
||||
bool Device_Object_List_Identifier(unsigned array_index,
|
||||
int *object_type, uint32_t * instance);
|
||||
uint32_t Device_Object_Instance_Number(
|
||||
void);
|
||||
bool Device_Set_Object_Instance_Number(
|
||||
uint32_t object_id);
|
||||
bool Device_Valid_Object_Instance_Number(
|
||||
uint32_t object_id);
|
||||
unsigned Device_Object_List_Count(
|
||||
void);
|
||||
bool Device_Object_List_Identifier(
|
||||
unsigned array_index,
|
||||
int *object_type,
|
||||
uint32_t * instance);
|
||||
|
||||
BACNET_DEVICE_STATUS Device_System_Status(void);
|
||||
void Device_Set_System_Status(BACNET_DEVICE_STATUS status);
|
||||
BACNET_DEVICE_STATUS Device_System_Status(
|
||||
void);
|
||||
void Device_Set_System_Status(
|
||||
BACNET_DEVICE_STATUS status);
|
||||
|
||||
const char *Device_Vendor_Name(void);
|
||||
const char *Device_Vendor_Name(
|
||||
void);
|
||||
|
||||
uint16_t Device_Vendor_Identifier(void);
|
||||
uint16_t Device_Vendor_Identifier(
|
||||
void);
|
||||
|
||||
const char *Device_Model_Name(void);
|
||||
bool Device_Set_Model_Name(const char *name, size_t length);
|
||||
|
||||
const char *Device_Firmware_Revision(void);
|
||||
|
||||
const char *Device_Application_Software_Version(void);
|
||||
bool Device_Set_Application_Software_Version(const char *name,
|
||||
const char *Device_Model_Name(
|
||||
void);
|
||||
bool Device_Set_Model_Name(
|
||||
const char *name,
|
||||
size_t length);
|
||||
|
||||
const char *Device_Description(void);
|
||||
bool Device_Set_Description(const char *name, size_t length);
|
||||
const char *Device_Firmware_Revision(
|
||||
void);
|
||||
|
||||
const char *Device_Location(void);
|
||||
bool Device_Set_Location(const char *name, size_t length);
|
||||
const char *Device_Application_Software_Version(
|
||||
void);
|
||||
bool Device_Set_Application_Software_Version(
|
||||
const char *name,
|
||||
size_t length);
|
||||
|
||||
const char *Device_Description(
|
||||
void);
|
||||
bool Device_Set_Description(
|
||||
const char *name,
|
||||
size_t length);
|
||||
|
||||
const char *Device_Location(
|
||||
void);
|
||||
bool Device_Set_Location(
|
||||
const char *name,
|
||||
size_t length);
|
||||
|
||||
/* some stack-centric constant values - no set methods */
|
||||
uint8_t Device_Protocol_Version(void);
|
||||
uint8_t Device_Protocol_Revision(void);
|
||||
uint16_t Device_Max_APDU_Length_Accepted(void);
|
||||
BACNET_SEGMENTATION Device_Segmentation_Supported(void);
|
||||
uint8_t Device_Protocol_Version(
|
||||
void);
|
||||
uint8_t Device_Protocol_Revision(
|
||||
void);
|
||||
uint16_t Device_Max_APDU_Length_Accepted(
|
||||
void);
|
||||
BACNET_SEGMENTATION Device_Segmentation_Supported(
|
||||
void);
|
||||
|
||||
uint16_t Device_APDU_Timeout(void);
|
||||
void Device_Set_APDU_Timeout(uint16_t timeout);
|
||||
uint16_t Device_APDU_Timeout(
|
||||
void);
|
||||
void Device_Set_APDU_Timeout(
|
||||
uint16_t timeout);
|
||||
|
||||
uint8_t Device_Number_Of_APDU_Retries(void);
|
||||
void Device_Set_Number_Of_APDU_Retries(uint8_t retries);
|
||||
uint8_t Device_Number_Of_APDU_Retries(
|
||||
void);
|
||||
void Device_Set_Number_Of_APDU_Retries(
|
||||
uint8_t retries);
|
||||
|
||||
uint8_t Device_Database_Revision(void);
|
||||
void Device_Set_Database_Revision(uint8_t revision);
|
||||
uint8_t Device_Database_Revision(
|
||||
void);
|
||||
void Device_Set_Database_Revision(
|
||||
uint8_t revision);
|
||||
|
||||
bool Device_Valid_Object_Name(const char *object_name,
|
||||
int *object_type, uint32_t * object_instance);
|
||||
char *Device_Valid_Object_Id(int object_type,
|
||||
bool Device_Valid_Object_Name(
|
||||
const char *object_name,
|
||||
int *object_type,
|
||||
uint32_t * object_instance);
|
||||
char *Device_Valid_Object_Id(
|
||||
int object_type,
|
||||
uint32_t object_instance);
|
||||
|
||||
int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Device_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Device_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -46,29 +46,33 @@
|
||||
#define MAX_MPDU (MAX_HEADER+MAX_PDU)
|
||||
|
||||
typedef struct dlmstp_packet {
|
||||
bool ready; /* true if ready to be sent or received */
|
||||
bool ready; /* true if ready to be sent or received */
|
||||
BACNET_ADDRESS address; /* source address */
|
||||
uint8_t frame_type; /* type of message */
|
||||
uint16_t pdu_len; /* packet length */
|
||||
uint8_t frame_type; /* type of message */
|
||||
uint16_t pdu_len; /* packet length */
|
||||
uint8_t pdu[MAX_MPDU]; /* packet */
|
||||
} DLMSTP_PACKET;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool dlmstp_init(char *ifname);
|
||||
void dlmstp_cleanup(void);
|
||||
bool dlmstp_init(
|
||||
char *ifname);
|
||||
void dlmstp_cleanup(
|
||||
void);
|
||||
|
||||
/* returns number of bytes sent on success, negative on failure */
|
||||
int dlmstp_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
int dlmstp_send_pdu(
|
||||
BACNET_ADDRESS * dest, /* destination address */
|
||||
BACNET_NPDU_DATA * npdu_data, /* network information */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len); /* number of bytes of data */
|
||||
|
||||
/* returns the number of octets in the PDU, or zero on failure */
|
||||
uint16_t dlmstp_receive(BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t dlmstp_receive(
|
||||
BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t max_pdu, /* amount of space available in the PDU */
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
|
||||
@@ -79,29 +83,39 @@ extern "C" {
|
||||
/* nodes. This may be used to allocate more or less of the available link */
|
||||
/* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */
|
||||
/* node, its value shall be 1. */
|
||||
void dlmstp_set_max_info_frames(uint8_t max_info_frames);
|
||||
uint8_t dlmstp_max_info_frames(void);
|
||||
void dlmstp_set_max_info_frames(
|
||||
uint8_t max_info_frames);
|
||||
uint8_t dlmstp_max_info_frames(
|
||||
void);
|
||||
|
||||
/* This parameter represents the value of the Max_Master property of the */
|
||||
/* node's Device object. The value of Max_Master specifies the highest */
|
||||
/* allowable address for master nodes. The value of Max_Master shall be */
|
||||
/* less than or equal to 127. If Max_Master is not writable in a node, */
|
||||
/* its value shall be 127. */
|
||||
void dlmstp_set_max_master(uint8_t max_master);
|
||||
uint8_t dlmstp_max_master(void);
|
||||
void dlmstp_set_max_master(
|
||||
uint8_t max_master);
|
||||
uint8_t dlmstp_max_master(
|
||||
void);
|
||||
|
||||
/* MAC address 0-127 */
|
||||
void dlmstp_set_mac_address(uint8_t my_address);
|
||||
uint8_t dlmstp_mac_address(void);
|
||||
void dlmstp_set_mac_address(
|
||||
uint8_t my_address);
|
||||
uint8_t dlmstp_mac_address(
|
||||
void);
|
||||
|
||||
void dlmstp_get_my_address(BACNET_ADDRESS * my_address);
|
||||
void dlmstp_get_broadcast_address(BACNET_ADDRESS * dest); /* destination address */
|
||||
void dlmstp_get_my_address(
|
||||
BACNET_ADDRESS * my_address);
|
||||
void dlmstp_get_broadcast_address(
|
||||
BACNET_ADDRESS * dest); /* destination address */
|
||||
|
||||
/* RS485 Baud Rate 9600, 19200, 38400, 57600, 115200 */
|
||||
void dlmstp_set_baud_rate(uint32_t baud);
|
||||
uint32_t dlmstp_baud_rate(void);
|
||||
void dlmstp_set_baud_rate(
|
||||
uint32_t baud);
|
||||
uint32_t dlmstp_baud_rate(
|
||||
void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -46,31 +46,39 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool ethernet_valid(void);
|
||||
void ethernet_cleanup(void);
|
||||
bool ethernet_init(char *interface_name);
|
||||
bool ethernet_valid(
|
||||
void);
|
||||
void ethernet_cleanup(
|
||||
void);
|
||||
bool ethernet_init(
|
||||
char *interface_name);
|
||||
|
||||
/* function to send a packet out the 802.2 socket */
|
||||
/* returns number of bytes sent on success, negative on failure */
|
||||
int ethernet_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
int ethernet_send_pdu(
|
||||
BACNET_ADDRESS * dest, /* destination address */
|
||||
BACNET_NPDU_DATA * npdu_data, /* network information */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len); /* number of bytes of data */
|
||||
|
||||
/* receives an 802.2 framed packet */
|
||||
/* returns the number of octets in the PDU, or zero on failure */
|
||||
uint16_t ethernet_receive(BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t ethernet_receive(
|
||||
BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t max_pdu, /* amount of space available in the PDU */
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
|
||||
void ethernet_set_my_address(BACNET_ADDRESS * my_address);
|
||||
void ethernet_get_my_address(BACNET_ADDRESS * my_address);
|
||||
void ethernet_get_broadcast_address(BACNET_ADDRESS * dest); /* destination address */
|
||||
void ethernet_set_my_address(
|
||||
BACNET_ADDRESS * my_address);
|
||||
void ethernet_get_my_address(
|
||||
BACNET_ADDRESS * my_address);
|
||||
void ethernet_get_broadcast_address(
|
||||
BACNET_ADDRESS * dest); /* destination address */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -36,11 +36,12 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
char *filename_remove_path(const char *filename_in);
|
||||
char *filename_remove_path(
|
||||
const char *filename_in);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -34,72 +34,96 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void handler_unrecognized_service(uint8_t * service_request,
|
||||
void handler_unrecognized_service(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_who_is(uint8_t * service_request,
|
||||
uint16_t service_len, BACNET_ADDRESS * src);
|
||||
void handler_who_is(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void handler_who_has(uint8_t * service_request,
|
||||
uint16_t service_len, BACNET_ADDRESS * src);
|
||||
void handler_who_has(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void handler_i_am_add(uint8_t * service_request,
|
||||
uint16_t service_len, BACNET_ADDRESS * src);
|
||||
void handler_i_am_add(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void handler_i_am_bind(uint8_t * service_request,
|
||||
uint16_t service_len, BACNET_ADDRESS * src);
|
||||
void handler_i_am_bind(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void handler_read_property(uint8_t * service_request,
|
||||
void handler_read_property(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_read_property_ack(uint8_t * service_request,
|
||||
void handler_read_property_ack(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA * service_data);
|
||||
|
||||
void handler_write_property(uint8_t * service_request,
|
||||
void handler_write_property(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_atomic_read_file(uint8_t * service_request,
|
||||
void handler_atomic_read_file(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_atomic_read_file_ack(uint8_t * service_request,
|
||||
void handler_atomic_read_file_ack(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_ACK_DATA * service_data);
|
||||
|
||||
void handler_atomic_write_file(uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src, BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_reinitialize_device(uint8_t * service_request,
|
||||
void handler_atomic_write_file(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_device_communication_control(uint8_t * service_request,
|
||||
void handler_reinitialize_device(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_i_have(uint8_t * service_request,
|
||||
uint16_t service_len, BACNET_ADDRESS * src);
|
||||
void handler_device_communication_control(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
void handler_timesync(uint8_t * service_request,
|
||||
uint16_t service_len, BACNET_ADDRESS * src);
|
||||
void handler_i_have(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void handler_timesync_utc(uint8_t * service_request,
|
||||
uint16_t service_len, BACNET_ADDRESS * src);
|
||||
void handler_timesync(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void handler_timesync_utc(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
BACNET_ADDRESS * src);
|
||||
|
||||
void handler_read_property_multiple(
|
||||
uint8_t * service_request,
|
||||
@@ -108,7 +132,7 @@ extern "C" {
|
||||
BACNET_CONFIRMED_SERVICE_DATA * service_data);
|
||||
|
||||
/* Encodes the property APDU and returns the length,
|
||||
or sets the error, and returns -1 */
|
||||
or sets the error, and returns -1 */
|
||||
/* resides in h_rp.c */
|
||||
int Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
@@ -123,5 +147,5 @@ extern "C" {
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+25
-14
@@ -42,33 +42,44 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int iam_encode_apdu(uint8_t * apdu,
|
||||
int iam_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint32_t device_id,
|
||||
unsigned max_apdu, int segmentation, uint16_t vendor_id);
|
||||
unsigned max_apdu,
|
||||
int segmentation,
|
||||
uint16_t vendor_id);
|
||||
|
||||
int iam_decode_service_request(uint8_t * apdu,
|
||||
int iam_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
uint32_t * pDevice_id,
|
||||
unsigned *pMax_apdu, int *pSegmentation, uint16_t * pVendor_id);
|
||||
unsigned *pMax_apdu,
|
||||
int *pSegmentation,
|
||||
uint16_t * pVendor_id);
|
||||
|
||||
int iam_encode_pdu(
|
||||
uint8_t * buffer,
|
||||
BACNET_ADDRESS *dest,
|
||||
BACNET_NPDU_DATA *npdu_data);
|
||||
|
||||
int iam_send(uint8_t * buffer);
|
||||
uint8_t * buffer,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * npdu_data);
|
||||
|
||||
int iam_send(
|
||||
uint8_t * buffer);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int iam_decode_apdu(uint8_t * apdu,
|
||||
int iam_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint32_t * pDevice_id,
|
||||
unsigned *pMax_apdu, int *pSegmentation, uint16_t * pVendor_id);
|
||||
unsigned *pMax_apdu,
|
||||
int *pSegmentation,
|
||||
uint16_t * pVendor_id);
|
||||
|
||||
void testIAm(Test * pTest);
|
||||
void testIAm(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -46,22 +46,29 @@ typedef struct BACnet_I_Have_Data {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int ihave_encode_apdu(uint8_t * apdu, BACNET_I_HAVE_DATA * data);
|
||||
int ihave_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
BACNET_I_HAVE_DATA * data);
|
||||
|
||||
int ihave_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_I_HAVE_DATA * data);
|
||||
int ihave_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_I_HAVE_DATA * data);
|
||||
|
||||
int ihave_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_I_HAVE_DATA * data);
|
||||
int ihave_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_I_HAVE_DATA * data);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testIHave(Test * pTest);
|
||||
void testIHave(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -40,56 +40,72 @@
|
||||
|
||||
/* index and text pairs */
|
||||
typedef struct {
|
||||
unsigned index; /* index number that matches the text */
|
||||
unsigned index; /* index number that matches the text */
|
||||
const char *pString; /* text pair - use NULL to end the list */
|
||||
} INDTEXT_DATA;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Searches for a matching string and returns the index to the string
|
||||
in the parameter found_index.
|
||||
If the string is not found, false is returned
|
||||
If the string is found, true is returned and the found_index contains
|
||||
the first index where the string was found. */
|
||||
bool indtext_by_string(INDTEXT_DATA * data_list,
|
||||
const char *search_name, unsigned *found_index);
|
||||
bool indtext_by_string(
|
||||
INDTEXT_DATA * data_list,
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
/* case insensitive version */
|
||||
bool indtext_by_istring(INDTEXT_DATA * data_list,
|
||||
const char *search_name, unsigned *found_index);
|
||||
bool indtext_by_istring(
|
||||
INDTEXT_DATA * data_list,
|
||||
const char *search_name,
|
||||
unsigned *found_index);
|
||||
/* Searches for a matching string and returns the index to the string
|
||||
or the default_index if the string is not found. */
|
||||
unsigned indtext_by_string_default(INDTEXT_DATA * data_list,
|
||||
const char *search_name, unsigned default_index);
|
||||
unsigned indtext_by_string_default(
|
||||
INDTEXT_DATA * data_list,
|
||||
const char *search_name,
|
||||
unsigned default_index);
|
||||
/* case insensitive version */
|
||||
unsigned indtext_by_istring_default(INDTEXT_DATA * data_list,
|
||||
const char *search_name, unsigned default_index);
|
||||
unsigned indtext_by_istring_default(
|
||||
INDTEXT_DATA * data_list,
|
||||
const char *search_name,
|
||||
unsigned default_index);
|
||||
/* for a given index, return the matching string,
|
||||
or NULL if not found */
|
||||
const char *indtext_by_index(INDTEXT_DATA * data_list, unsigned index);
|
||||
const char *indtext_by_index(
|
||||
INDTEXT_DATA * data_list,
|
||||
unsigned index);
|
||||
/* for a given index, return the matching string,
|
||||
or default_name if not found */
|
||||
const char *indtext_by_index_default(INDTEXT_DATA * data_list,
|
||||
unsigned index, const char *default_name);
|
||||
const char *indtext_by_index_default(
|
||||
INDTEXT_DATA * data_list,
|
||||
unsigned index,
|
||||
const char *default_name);
|
||||
/* for a given index, return the matching string,
|
||||
or default_name if not found.
|
||||
if the index is before the split,
|
||||
the before_split_default_name is used */
|
||||
const char *indtext_by_index_split_default(INDTEXT_DATA * data_list,
|
||||
const char *indtext_by_index_split_default(
|
||||
INDTEXT_DATA * data_list,
|
||||
int index,
|
||||
int split_index,
|
||||
const char *before_split_default_name, const char *default_name);
|
||||
const char *before_split_default_name,
|
||||
const char *default_name);
|
||||
|
||||
/* returns the number of elements in the list */
|
||||
unsigned indtext_count(INDTEXT_DATA * data_list);
|
||||
unsigned indtext_count(
|
||||
INDTEXT_DATA * data_list);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testIndexText(Test * pTest);
|
||||
void testIndexText(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -42,52 +42,71 @@
|
||||
|
||||
/* list data and datatype */
|
||||
struct Keylist_Node {
|
||||
KEY key; /* unique number that is sorted in the list */
|
||||
void *data; /* pointer to some data that is stored */
|
||||
KEY key; /* unique number that is sorted in the list */
|
||||
void *data; /* pointer to some data that is stored */
|
||||
};
|
||||
|
||||
typedef struct Keylist {
|
||||
struct Keylist_Node **array; /* array of nodes */
|
||||
int count; /* number of nodes in this list - more effecient than loop */
|
||||
int size; /* number of available nodes on this list - can grow or shrink */
|
||||
int count; /* number of nodes in this list - more effecient than loop */
|
||||
int size; /* number of available nodes on this list - can grow or shrink */
|
||||
} KEYLIST_TYPE;
|
||||
typedef KEYLIST_TYPE *OS_Keylist;
|
||||
|
||||
/* returns head of the list or NULL on failure. */
|
||||
OS_Keylist Keylist_Create(void);
|
||||
OS_Keylist Keylist_Create(
|
||||
void);
|
||||
|
||||
/* delete specified list */
|
||||
/* note: you should pop all the nodes off the list first. */
|
||||
void Keylist_Delete(OS_Keylist list);
|
||||
void Keylist_Delete(
|
||||
OS_Keylist list);
|
||||
|
||||
/* inserts a node into its sorted position */
|
||||
/* returns the index where it was added */
|
||||
int Keylist_Data_Add(OS_Keylist list, KEY key, void *data);
|
||||
int Keylist_Data_Add(
|
||||
OS_Keylist list,
|
||||
KEY key,
|
||||
void *data);
|
||||
|
||||
/* deletes a node specified by its key */
|
||||
/* returns the data from the node */
|
||||
void *Keylist_Data_Delete(OS_Keylist list, KEY key);
|
||||
void *Keylist_Data_Delete(
|
||||
OS_Keylist list,
|
||||
KEY key);
|
||||
|
||||
/* deletes a node specified by its index */
|
||||
/* returns the data from the node */
|
||||
void *Keylist_Data_Delete_By_Index(OS_Keylist list, int index);
|
||||
void *Keylist_Data_Delete_By_Index(
|
||||
OS_Keylist list,
|
||||
int index);
|
||||
|
||||
/* returns the data from last node, and removes it from the list */
|
||||
void *Keylist_Data_Pop(OS_Keylist list);
|
||||
void *Keylist_Data_Pop(
|
||||
OS_Keylist list);
|
||||
|
||||
/* returns the data from the node specified by key */
|
||||
void *Keylist_Data(OS_Keylist list, KEY key);
|
||||
void *Keylist_Data(
|
||||
OS_Keylist list,
|
||||
KEY key);
|
||||
|
||||
/* returns the data specified by key */
|
||||
void *Keylist_Data_Index(OS_Keylist list, int index);
|
||||
void *Keylist_Data_Index(
|
||||
OS_Keylist list,
|
||||
int index);
|
||||
|
||||
/* return the key at the given index */
|
||||
KEY Keylist_Key(OS_Keylist list, int index);
|
||||
KEY Keylist_Key(
|
||||
OS_Keylist list,
|
||||
int index);
|
||||
|
||||
/* returns the next empty key from the list */
|
||||
KEY Keylist_Next_Empty_Key(OS_Keylist list, KEY key);
|
||||
KEY Keylist_Next_Empty_Key(
|
||||
OS_Keylist list,
|
||||
KEY key);
|
||||
|
||||
/* returns the number of items in the list */
|
||||
int Keylist_Count(OS_Keylist list);
|
||||
int Keylist_Count(
|
||||
OS_Keylist list);
|
||||
|
||||
#endif
|
||||
|
||||
+22
-12
@@ -33,34 +33,44 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Load_Control_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
void Load_Control_State_Machine_Handler(void);
|
||||
void Load_Control_State_Machine_Handler(
|
||||
void);
|
||||
|
||||
bool Load_Control_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Load_Control_Count(void);
|
||||
uint32_t Load_Control_Index_To_Instance(unsigned index);
|
||||
char *Load_Control_Name(uint32_t object_instance);
|
||||
bool Load_Control_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Load_Control_Count(
|
||||
void);
|
||||
uint32_t Load_Control_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Load_Control_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Load_Control_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Load_Control_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Load_Control_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testLoadControl(Test * pTest);
|
||||
void testLoadControl(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+32
-19
@@ -33,37 +33,50 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool Analog_Output_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Lighting_Output_Count(void);
|
||||
uint32_t Lighting_Output_Index_To_Instance(unsigned index);
|
||||
char *Lighting_Output_Name(uint32_t object_instance);
|
||||
float Lighting_Output_Present_Value(uint32_t object_instance);
|
||||
unsigned Lighting_Output_Present_Value_Priority(uint32_t
|
||||
object_instance);
|
||||
bool Lighting_Output_Present_Value_Set(uint32_t object_instance,
|
||||
float value, unsigned priority);
|
||||
bool Lighting_Output_Present_Value_Relinquish(uint32_t object_instance,
|
||||
bool Analog_Output_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Lighting_Output_Count(
|
||||
void);
|
||||
uint32_t Lighting_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Lighting_Output_Name(
|
||||
uint32_t object_instance);
|
||||
float Lighting_Output_Present_Value(
|
||||
uint32_t object_instance);
|
||||
unsigned Lighting_Output_Present_Value_Priority(
|
||||
uint32_t object_instance);
|
||||
bool Lighting_Output_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
float value,
|
||||
unsigned priority);
|
||||
bool Lighting_Output_Present_Value_Relinquish(
|
||||
uint32_t object_instance,
|
||||
int priority);
|
||||
|
||||
|
||||
/* ReadProperty service support */
|
||||
int Lighting_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
/* ReadProperty service support */
|
||||
int Lighting_Output_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
/* WriteProperty service support */
|
||||
bool Lighting_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
/* WriteProperty service support */
|
||||
bool Lighting_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testLightingOutput(Test * pTest);
|
||||
void testLightingOutput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+19
-11
@@ -33,33 +33,41 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Life_Safety_Point_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Life_Safety_Point_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Life_Safety_Point_Count(void);
|
||||
uint32_t Life_Safety_Point_Index_To_Instance(unsigned index);
|
||||
char *Life_Safety_Point_Name(uint32_t object_instance);
|
||||
bool Life_Safety_Point_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Life_Safety_Point_Count(
|
||||
void);
|
||||
uint32_t Life_Safety_Point_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Life_Safety_Point_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Life_Safety_Point_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Life_Safety_Point_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *
|
||||
wp_data, BACNET_ERROR_CLASS * error_class,
|
||||
bool Life_Safety_Point_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testLifeSafetyPoint(Test * pTest);
|
||||
void testLifeSafetyPoint(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+19
-11
@@ -33,33 +33,41 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void Multistate_Output_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
bool Multistate_Output_Valid_Instance(uint32_t object_instance);
|
||||
unsigned Multistate_Output_Count(void);
|
||||
uint32_t Multistate_Output_Index_To_Instance(unsigned index);
|
||||
char *Multistate_Output_Name(uint32_t object_instance);
|
||||
bool Multistate_Output_Valid_Instance(
|
||||
uint32_t object_instance);
|
||||
unsigned Multistate_Output_Count(
|
||||
void);
|
||||
uint32_t Multistate_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
char *Multistate_Output_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
int Multistate_Output_Encode_Property_APDU(
|
||||
uint8_t * apdu,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID property,
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *
|
||||
wp_data, BACNET_ERROR_CLASS * error_class,
|
||||
bool Multistate_Output_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testMultistateOutput(Test * pTest);
|
||||
void testMultistateOutput(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+26
-18
@@ -194,14 +194,18 @@ struct mstp_port_struct_t {
|
||||
/* denote intervals between N-1 and N */
|
||||
/* Note: done here as functions - put into timer task or ISR
|
||||
so that you can be atomic on 8 bit microcontrollers */
|
||||
uint16_t (*SilenceTimer)(void);
|
||||
void (*SilenceTimerReset)(void);
|
||||
uint16_t(
|
||||
*SilenceTimer) (
|
||||
void);
|
||||
void (
|
||||
*SilenceTimerReset) (
|
||||
void);
|
||||
|
||||
/* A timer used to measure and generate Reply Postponed frames. It is */
|
||||
/* incremented by a timer process and is cleared by the Master Node State */
|
||||
/* Machine when a Data Expecting Reply Answer activity is completed. */
|
||||
/* note: we always send a reply postponed since a message other than
|
||||
the reply may be in the transmit queue */
|
||||
the reply may be in the transmit queue */
|
||||
/* uint16_t ReplyPostponedTimer; */
|
||||
|
||||
/* Used to store the Source Address of a received frame. */
|
||||
@@ -256,32 +260,36 @@ struct mstp_port_struct_t {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void MSTP_Init(volatile struct mstp_port_struct_t *mstp_port);
|
||||
void MSTP_Receive_Frame_FSM(volatile struct mstp_port_struct_t
|
||||
void MSTP_Init(
|
||||
volatile struct mstp_port_struct_t *mstp_port);
|
||||
void MSTP_Receive_Frame_FSM(
|
||||
volatile struct mstp_port_struct_t
|
||||
*mstp_port);
|
||||
bool MSTP_Master_Node_FSM(volatile struct mstp_port_struct_t
|
||||
bool MSTP_Master_Node_FSM(
|
||||
volatile struct mstp_port_struct_t
|
||||
*mstp_port);
|
||||
|
||||
/* returns true if line is active */
|
||||
bool MSTP_Line_Active(volatile struct mstp_port_struct_t *mstp_port);
|
||||
bool MSTP_Line_Active(
|
||||
volatile struct mstp_port_struct_t *mstp_port);
|
||||
|
||||
uint16_t MSTP_Create_Frame(
|
||||
uint8_t * buffer, /* where frame is loaded */
|
||||
uint8_t * buffer, /* where frame is loaded */
|
||||
uint16_t buffer_len, /* amount of space available */
|
||||
uint8_t frame_type, /* type of frame to send - see defines */
|
||||
uint8_t destination, /* destination address */
|
||||
uint8_t source, /* source address */
|
||||
uint8_t * data, /* any data to be sent - may be null */
|
||||
uint8_t source, /* source address */
|
||||
uint8_t * data, /* any data to be sent - may be null */
|
||||
uint16_t data_len); /* number of bytes of data (up to 501) */
|
||||
|
||||
void MSTP_Create_And_Send_Frame(
|
||||
volatile struct mstp_port_struct_t *mstp_port, /* port to send from */
|
||||
uint8_t frame_type, /* type of frame to send - see defines */
|
||||
uint8_t destination, /* destination address */
|
||||
uint8_t source, /* source address */
|
||||
uint8_t * data, /* any data to be sent - may be null */
|
||||
uint8_t frame_type, /* type of frame to send - see defines */
|
||||
uint8_t destination, /* destination address */
|
||||
uint8_t source, /* source address */
|
||||
uint8_t * data, /* any data to be sent - may be null */
|
||||
uint16_t data_len);
|
||||
|
||||
/* functions used by the MS/TP state machine to put or get data */
|
||||
@@ -293,15 +301,15 @@ extern "C" {
|
||||
/* Return: amount of PDU data */
|
||||
uint16_t MSTP_Get_Send(
|
||||
volatile struct mstp_port_struct_t *mstp_port,
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
/* for the MS/TP state machine to use for getting the reply for
|
||||
Data-Expecting-Reply Frame */
|
||||
/* Return: amount of PDU data */
|
||||
uint16_t MSTP_Get_Reply(
|
||||
volatile struct mstp_port_struct_t *mstp_port,
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
unsigned timeout); /* milliseconds to wait for a packet */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -37,14 +37,16 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
const char *mstptext_receive_state(int index);
|
||||
const char *mstptext_master_state(int index);
|
||||
const char *mstptext_frame_type(int index);
|
||||
const char *mstptext_receive_state(
|
||||
int index);
|
||||
const char *mstptext_master_state(
|
||||
int index);
|
||||
const char *mstptext_frame_type(
|
||||
int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+24
-13
@@ -48,34 +48,45 @@ typedef struct bacnet_npdu_data_t {
|
||||
BACNET_MESSAGE_PRIORITY priority;
|
||||
/* optional network message info */
|
||||
BACNET_NETWORK_MESSAGE_TYPE network_message_type; /* optional */
|
||||
uint16_t vendor_id; /* optional, if net message type is > 0x80 */
|
||||
uint16_t vendor_id; /* optional, if net message type is > 0x80 */
|
||||
uint8_t hop_count;
|
||||
} BACNET_NPDU_DATA;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
uint8_t npdu_encode_max_seg_max_apdu(int max_segs, int max_apdu);
|
||||
uint8_t npdu_encode_max_seg_max_apdu(
|
||||
int max_segs,
|
||||
int max_apdu);
|
||||
|
||||
int npdu_encode_pdu(uint8_t * npdu,
|
||||
int npdu_encode_pdu(
|
||||
uint8_t * npdu,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_ADDRESS * src, BACNET_NPDU_DATA * npdu_data);
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_NPDU_DATA * npdu_data);
|
||||
|
||||
void npdu_encode_npdu_data(BACNET_NPDU_DATA * npdu,
|
||||
bool data_expecting_reply, BACNET_MESSAGE_PRIORITY priority);
|
||||
void npdu_encode_npdu_data(
|
||||
BACNET_NPDU_DATA * npdu,
|
||||
bool data_expecting_reply,
|
||||
BACNET_MESSAGE_PRIORITY priority);
|
||||
|
||||
void npdu_copy_data(BACNET_NPDU_DATA * dest, BACNET_NPDU_DATA * src);
|
||||
void npdu_copy_data(
|
||||
BACNET_NPDU_DATA * dest,
|
||||
BACNET_NPDU_DATA * src);
|
||||
|
||||
int npdu_decode(uint8_t * npdu,
|
||||
int npdu_decode(
|
||||
uint8_t * npdu,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_ADDRESS * src, BACNET_NPDU_DATA * npdu_data);
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_NPDU_DATA * npdu_data);
|
||||
|
||||
void npdu_handler(BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
void npdu_handler(
|
||||
BACNET_ADDRESS * src, /* source address */
|
||||
uint8_t * pdu, /* PDU data */
|
||||
uint16_t pdu_len); /* length PDU */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -39,32 +39,36 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* encode service */
|
||||
int rd_encode_apdu(uint8_t * apdu,
|
||||
int rd_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_REINITIALIZED_STATE state,
|
||||
BACNET_CHARACTER_STRING * password);
|
||||
|
||||
/* decode the service request only */
|
||||
int rd_decode_service_request(uint8_t * apdu,
|
||||
int rd_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_REINITIALIZED_STATE * state,
|
||||
BACNET_CHARACTER_STRING * password);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int rd_decode_apdu(uint8_t * apdu,
|
||||
int rd_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
BACNET_REINITIALIZED_STATE * state,
|
||||
BACNET_CHARACTER_STRING * password);
|
||||
|
||||
void test_ReinitializeDevice(Test * pTest);
|
||||
void test_ReinitializeDevice(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -39,22 +39,31 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int reject_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, uint8_t reject_reason);
|
||||
int reject_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
uint8_t reject_reason);
|
||||
|
||||
int reject_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, uint8_t * invoke_id, uint8_t * reject_reason);
|
||||
int reject_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
uint8_t * reject_reason);
|
||||
|
||||
#ifdef TEST
|
||||
int reject_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, uint8_t * invoke_id, uint8_t * reject_reason);
|
||||
int reject_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
uint8_t * reject_reason);
|
||||
|
||||
void testReject(Test * pTest);
|
||||
void testReject(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -43,29 +43,34 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
struct ring_buffer_t {
|
||||
char *data; /* block of memory or array of data */
|
||||
char *data; /* block of memory or array of data */
|
||||
unsigned element_size; /* how many bytes for each chunk */
|
||||
unsigned element_count; /* number of chunks of data */
|
||||
unsigned head; /* first chunk of data */
|
||||
unsigned count; /* number of chunks in use */
|
||||
unsigned head; /* first chunk of data */
|
||||
unsigned count; /* number of chunks in use */
|
||||
};
|
||||
typedef struct ring_buffer_t RING_BUFFER;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool Ringbuf_Empty(RING_BUFFER const *b);
|
||||
char *Ringbuf_Get_Front(RING_BUFFER const *b);
|
||||
char *Ringbuf_Pop_Front(RING_BUFFER * b);
|
||||
bool Ringbuf_Put(RING_BUFFER * b, /* ring buffer structure */
|
||||
bool Ringbuf_Empty(
|
||||
RING_BUFFER const *b);
|
||||
char *Ringbuf_Get_Front(
|
||||
RING_BUFFER const *b);
|
||||
char *Ringbuf_Pop_Front(
|
||||
RING_BUFFER * b);
|
||||
bool Ringbuf_Put(
|
||||
RING_BUFFER * b, /* ring buffer structure */
|
||||
char *data_element); /* one element to add to the ring */
|
||||
void Ringbuf_Init(RING_BUFFER * b, /* ring buffer structure */
|
||||
char *data, /* data block or array of data */
|
||||
void Ringbuf_Init(
|
||||
RING_BUFFER * b, /* ring buffer structure */
|
||||
char *data, /* data block or array of data */
|
||||
unsigned element_size, /* size of one element in the data block */
|
||||
unsigned element_count); /* number of elements in the data block */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+30
-15
@@ -48,37 +48,52 @@ typedef struct BACnet_Read_Property_Data {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* encode service */
|
||||
int rp_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
int rp_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
|
||||
/* decode the service request only */
|
||||
int rp_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
int rp_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
|
||||
int rp_ack_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
int rp_ack_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
|
||||
int rp_ack_decode_service_request(uint8_t * apdu, int apdu_len, /* total length of the apdu */
|
||||
int rp_ack_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
int apdu_len, /* total length of the apdu */
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int rp_decode_apdu(uint8_t * apdu,
|
||||
int rp_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id, BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
uint8_t * invoke_id,
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
|
||||
int rp_ack_decode_apdu(uint8_t * apdu, int apdu_len, /* total length of the apdu */
|
||||
uint8_t * invoke_id, BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
int rp_ack_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
int apdu_len, /* total length of the apdu */
|
||||
uint8_t * invoke_id,
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
|
||||
void test_ReadProperty(Test * pTest);
|
||||
void test_ReadPropertyAck(Test * pTest);
|
||||
void test_ReadProperty(
|
||||
Test * pTest);
|
||||
void test_ReadPropertyAck(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+71
-34
@@ -42,7 +42,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* encode functions */
|
||||
/* Start with the Init function, and then add an object,
|
||||
@@ -51,71 +51,108 @@ extern "C" {
|
||||
until the APDU is full.*/
|
||||
|
||||
/* RPM */
|
||||
int rpm_encode_apdu_init(uint8_t * apdu, uint8_t invoke_id);
|
||||
int rpm_encode_apdu_init(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id);
|
||||
|
||||
int rpm_encode_apdu_object_begin(uint8_t * apdu,
|
||||
BACNET_OBJECT_TYPE object_type, uint32_t object_instance);
|
||||
int rpm_encode_apdu_object_begin(
|
||||
uint8_t * apdu,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance);
|
||||
|
||||
int rpm_encode_apdu_object_property(uint8_t * apdu,
|
||||
BACNET_PROPERTY_ID object_property, int32_t array_index);
|
||||
int rpm_encode_apdu_object_property(
|
||||
uint8_t * apdu,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
int32_t array_index);
|
||||
|
||||
int rpm_encode_apdu_object_end(uint8_t * apdu);
|
||||
int rpm_encode_apdu_object_end(
|
||||
uint8_t * apdu);
|
||||
|
||||
/* decode the object portion of the service request only */
|
||||
int rpm_decode_object_id(uint8_t * apdu,
|
||||
int rpm_decode_object_id(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_OBJECT_TYPE * object_type, uint32_t * object_instance);
|
||||
BACNET_OBJECT_TYPE * object_type,
|
||||
uint32_t * object_instance);
|
||||
|
||||
/* is this the end of this object property list? */
|
||||
int rpm_decode_object_end(uint8_t * apdu, unsigned apdu_len);
|
||||
int rpm_decode_object_end(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len);
|
||||
|
||||
/* decode the object property portion of the service request only */
|
||||
int rpm_decode_object_property(uint8_t * apdu,
|
||||
int rpm_decode_object_property(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_PROPERTY_ID * object_property, int32_t * array_index);
|
||||
BACNET_PROPERTY_ID * object_property,
|
||||
int32_t * array_index);
|
||||
|
||||
/* RPM Ack - reply from server */
|
||||
int rpm_ack_encode_apdu_init(uint8_t * apdu, uint8_t invoke_id);
|
||||
int rpm_ack_encode_apdu_init(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id);
|
||||
|
||||
int rpm_ack_encode_apdu_object_begin(uint8_t * apdu,
|
||||
BACNET_OBJECT_TYPE object_type, uint32_t object_instance);
|
||||
int rpm_ack_encode_apdu_object_begin(
|
||||
uint8_t * apdu,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance);
|
||||
|
||||
int rpm_ack_encode_apdu_object_property(uint8_t * apdu,
|
||||
BACNET_PROPERTY_ID object_property, int32_t array_index);
|
||||
int rpm_ack_encode_apdu_object_property(
|
||||
uint8_t * apdu,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
int32_t array_index);
|
||||
|
||||
int rpm_ack_encode_apdu_object_property_value(uint8_t * apdu,
|
||||
uint8_t * application_data, unsigned application_data_len);
|
||||
int rpm_ack_encode_apdu_object_property_value(
|
||||
uint8_t * apdu,
|
||||
uint8_t * application_data,
|
||||
unsigned application_data_len);
|
||||
|
||||
int rpm_ack_encode_apdu_object_property_error(uint8_t * apdu,
|
||||
BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code);
|
||||
int rpm_ack_encode_apdu_object_property_error(
|
||||
uint8_t * apdu,
|
||||
BACNET_ERROR_CLASS error_class,
|
||||
BACNET_ERROR_CODE error_code);
|
||||
|
||||
int rpm_ack_encode_apdu_object_end(uint8_t * apdu);
|
||||
int rpm_ack_encode_apdu_object_end(
|
||||
uint8_t * apdu);
|
||||
|
||||
int rpm_ack_decode_object_id(uint8_t * apdu,
|
||||
int rpm_ack_decode_object_id(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_OBJECT_TYPE * object_type, uint32_t * object_instance);
|
||||
BACNET_OBJECT_TYPE * object_type,
|
||||
uint32_t * object_instance);
|
||||
/* is this the end of the list of this objects properties values? */
|
||||
int rpm_ack_decode_object_end(uint8_t * apdu, unsigned apdu_len);
|
||||
int rpm_ack_decode_object_property(uint8_t * apdu,
|
||||
int rpm_ack_decode_object_end(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len);
|
||||
int rpm_ack_decode_object_property(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_PROPERTY_ID * object_property, int32_t * array_index);
|
||||
BACNET_PROPERTY_ID * object_property,
|
||||
int32_t * array_index);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int rpm_decode_apdu(uint8_t * apdu,
|
||||
int rpm_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id,
|
||||
uint8_t ** service_request, unsigned *service_request_len);
|
||||
uint8_t ** service_request,
|
||||
unsigned *service_request_len);
|
||||
|
||||
int rpm_ack_decode_apdu(uint8_t * apdu, int apdu_len, /* total length of the apdu */
|
||||
int rpm_ack_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
int apdu_len, /* total length of the apdu */
|
||||
uint8_t * invoke_id,
|
||||
uint8_t ** service_request, unsigned *service_request_len);
|
||||
uint8_t ** service_request,
|
||||
unsigned *service_request_len);
|
||||
|
||||
void testReadPropertyMultiple(Test * pTest);
|
||||
void testReadPropertyMultipleAck(Test * pTest);
|
||||
void testReadPropertyMultiple(
|
||||
Test * pTest);
|
||||
void testReadPropertyMultipleAck(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+25
-17
@@ -43,38 +43,46 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
struct static_buffer_t {
|
||||
char *data; /* block of memory or array of data */
|
||||
unsigned size; /* actual size, in bytes, of the block of data */
|
||||
unsigned count; /* number of bytes in use */
|
||||
char *data; /* block of memory or array of data */
|
||||
unsigned size; /* actual size, in bytes, of the block of data */
|
||||
unsigned count; /* number of bytes in use */
|
||||
};
|
||||
typedef struct static_buffer_t STATIC_BUFFER;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void sbuf_init(STATIC_BUFFER * b, /* static buffer structure */
|
||||
char *data, /* actual size, in bytes, of the data block or array of data */
|
||||
unsigned size); /* number of bytes used */
|
||||
void sbuf_init(
|
||||
STATIC_BUFFER * b, /* static buffer structure */
|
||||
char *data, /* actual size, in bytes, of the data block or array of data */
|
||||
unsigned size); /* number of bytes used */
|
||||
/* returns true if size==0, false if size > 0 */
|
||||
bool sbuf_empty(STATIC_BUFFER const *b);
|
||||
char *sbuf_data(STATIC_BUFFER const *b);
|
||||
unsigned sbuf_size(STATIC_BUFFER * b);
|
||||
unsigned sbuf_count(STATIC_BUFFER * b);
|
||||
bool sbuf_empty(
|
||||
STATIC_BUFFER const *b);
|
||||
char *sbuf_data(
|
||||
STATIC_BUFFER const *b);
|
||||
unsigned sbuf_size(
|
||||
STATIC_BUFFER * b);
|
||||
unsigned sbuf_count(
|
||||
STATIC_BUFFER * b);
|
||||
/* returns true if successful, false if not enough room to append data */
|
||||
bool sbuf_put(STATIC_BUFFER * b, /* static buffer structure */
|
||||
bool sbuf_put(
|
||||
STATIC_BUFFER * b, /* static buffer structure */
|
||||
unsigned offset, /* where to start */
|
||||
char *data, /* number of bytes used */
|
||||
char *data, /* number of bytes used */
|
||||
unsigned data_size); /* how many to add */
|
||||
/* returns true if successful, false if not enough room to append data */
|
||||
bool sbuf_append(STATIC_BUFFER * b, /* static buffer structure */
|
||||
char *data, /* number of bytes used */
|
||||
bool sbuf_append(
|
||||
STATIC_BUFFER * b, /* static buffer structure */
|
||||
char *data, /* number of bytes used */
|
||||
unsigned data_size); /* how many to add */
|
||||
/* returns true if successful, false if not enough room to append data */
|
||||
bool sbuf_truncate(STATIC_BUFFER * b, /* static buffer structure */
|
||||
bool sbuf_truncate(
|
||||
STATIC_BUFFER * b, /* static buffer structure */
|
||||
unsigned count); /* total number of bytes in use */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -40,27 +40,41 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* encode service */
|
||||
int timesync_utc_encode_apdu(uint8_t * apdu,
|
||||
BACNET_DATE * my_date, BACNET_TIME * my_time);
|
||||
int timesync_encode_apdu(uint8_t * apdu,
|
||||
BACNET_DATE * my_date, BACNET_TIME * my_time);
|
||||
int timesync_utc_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
BACNET_DATE * my_date,
|
||||
BACNET_TIME * my_time);
|
||||
int timesync_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
BACNET_DATE * my_date,
|
||||
BACNET_TIME * my_time);
|
||||
/* decode the service request only */
|
||||
int timesync_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_DATE * my_date, BACNET_TIME * my_time);
|
||||
int timesync_utc_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_DATE * my_date, BACNET_TIME * my_time);
|
||||
int timesync_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_DATE * my_date, BACNET_TIME * my_time);
|
||||
int timesync_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_DATE * my_date,
|
||||
BACNET_TIME * my_time);
|
||||
int timesync_utc_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_DATE * my_date,
|
||||
BACNET_TIME * my_time);
|
||||
int timesync_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_DATE * my_date,
|
||||
BACNET_TIME * my_time);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testTimeSync(Test * pTest);
|
||||
void testTimeSync(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+28
-16
@@ -92,31 +92,43 @@ typedef struct BACnet_TSM_Data {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool tsm_transaction_available(void);
|
||||
uint8_t tsm_transaction_idle_count(void);
|
||||
void tsm_timer_milliseconds(uint16_t milliseconds);
|
||||
bool tsm_transaction_available(
|
||||
void);
|
||||
uint8_t tsm_transaction_idle_count(
|
||||
void);
|
||||
void tsm_timer_milliseconds(
|
||||
uint16_t milliseconds);
|
||||
/* free the invoke ID when the reply comes back */
|
||||
void tsm_free_invoke_id(uint8_t invokeID);
|
||||
void tsm_free_invoke_id(
|
||||
uint8_t invokeID);
|
||||
/* use these in tandem */
|
||||
uint8_t tsm_next_free_invokeID(void);
|
||||
uint8_t tsm_next_free_invokeID(
|
||||
void);
|
||||
/* returns the same invoke ID that was given */
|
||||
void tsm_set_confirmed_unsegmented_transaction(uint8_t invokeID,
|
||||
BACNET_ADDRESS * dest, BACNET_NPDU_DATA * ndpu_data,
|
||||
uint8_t * apdu, uint16_t apdu_len);
|
||||
void tsm_set_confirmed_unsegmented_transaction(
|
||||
uint8_t invokeID,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * ndpu_data,
|
||||
uint8_t * apdu,
|
||||
uint16_t apdu_len);
|
||||
/* returns true if transaction is found */
|
||||
bool tsm_get_transaction_pdu(uint8_t invokeID,
|
||||
BACNET_ADDRESS * dest, BACNET_NPDU_DATA * ndpu_data,
|
||||
uint8_t * apdu, uint16_t * apdu_len);
|
||||
bool tsm_get_transaction_pdu(
|
||||
uint8_t invokeID,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * ndpu_data,
|
||||
uint8_t * apdu,
|
||||
uint16_t * apdu_len);
|
||||
|
||||
bool tsm_invoke_id_free(uint8_t invokeID);
|
||||
bool tsm_invoke_id_failed(uint8_t invokeID);
|
||||
bool tsm_invoke_id_free(
|
||||
uint8_t invokeID);
|
||||
bool tsm_invoke_id_failed(
|
||||
uint8_t invokeID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
/* define out any functions necessary for compile */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#include "bacstr.h"
|
||||
|
||||
typedef struct BACnet_Who_Has_Data {
|
||||
int32_t low_limit; /* deviceInstanceRange */
|
||||
int32_t low_limit; /* deviceInstanceRange */
|
||||
int32_t high_limit;
|
||||
bool object_name; /* true if a string */
|
||||
bool object_name; /* true if a string */
|
||||
union {
|
||||
BACNET_OBJECT_ID identifier;
|
||||
BACNET_CHARACTER_STRING name;
|
||||
@@ -50,23 +50,30 @@ typedef struct BACnet_Who_Has_Data {
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* encode service - use -1 for limit if you want unlimited */
|
||||
int whohas_encode_apdu(uint8_t * apdu, BACNET_WHO_HAS_DATA * data);
|
||||
int whohas_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
BACNET_WHO_HAS_DATA * data);
|
||||
|
||||
int whohas_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_WHO_HAS_DATA * data);
|
||||
int whohas_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_WHO_HAS_DATA * data);
|
||||
|
||||
int whohas_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_WHO_HAS_DATA * data);
|
||||
int whohas_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_WHO_HAS_DATA * data);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
void testWhoHas(Test * pTest);
|
||||
void testWhoHas(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
@@ -39,23 +39,32 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* encode service - use -1 for limit if you want unlimited */
|
||||
int whois_encode_apdu(uint8_t * apdu,
|
||||
int32_t low_limit, int32_t high_limit);
|
||||
int whois_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
int32_t low_limit,
|
||||
int32_t high_limit);
|
||||
|
||||
int whois_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, int32_t * pLow_limit, int32_t * pHigh_limit);
|
||||
int whois_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
int32_t * pLow_limit,
|
||||
int32_t * pHigh_limit);
|
||||
|
||||
#ifdef TEST
|
||||
int whois_decode_apdu(uint8_t * apdu,
|
||||
unsigned apdu_len, int32_t * pLow_limit, int32_t * pHigh_limit);
|
||||
int whois_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
int32_t * pLow_limit,
|
||||
int32_t * pHigh_limit);
|
||||
|
||||
void testWhoIs(Test * pTest);
|
||||
void testWhoIs(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
+19
-11
@@ -50,32 +50,40 @@ typedef struct BACnet_Write_Property_Data {
|
||||
int32_t array_index; /* use BACNET_ARRAY_ALL when not setting */
|
||||
uint8_t application_data[MAX_APDU];
|
||||
int application_data_len;
|
||||
uint8_t priority; /* use BACNET_NO_PRIORITY if no priority */
|
||||
uint8_t priority; /* use BACNET_NO_PRIORITY if no priority */
|
||||
} BACNET_WRITE_PROPERTY_DATA;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* encode service */
|
||||
int wp_encode_apdu(uint8_t * apdu,
|
||||
uint8_t invoke_id, BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
int wp_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint8_t invoke_id,
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
/* decode the service request only */
|
||||
int wp_decode_service_request(uint8_t * apdu,
|
||||
unsigned apdu_len, BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
int wp_decode_service_request(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
int wp_decode_apdu(uint8_t * apdu,
|
||||
int wp_decode_apdu(
|
||||
uint8_t * apdu,
|
||||
unsigned apdu_len,
|
||||
uint8_t * invoke_id, BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
uint8_t * invoke_id,
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data);
|
||||
|
||||
void test_ReadProperty(Test * pTest);
|
||||
void test_ReadPropertyAck(Test * pTest);
|
||||
void test_ReadProperty(
|
||||
Test * pTest);
|
||||
void test_ReadPropertyAck(
|
||||
Test * pTest);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user