Documentation for the Data Sharing BIBBs: RP, RPM, WP.
A start on ReadRange for Trending BIBB.
This commit is contained in:
@@ -42,6 +42,26 @@
|
||||
|
||||
/** @file h_rp.c Handles Read Property requests. */
|
||||
|
||||
|
||||
/** Handler for a ReadProperty Service request.
|
||||
* @ingroup DSRP
|
||||
* This handler will be invoked by apdu_handler() if it has been enabled
|
||||
* by a call to apdu_set_confirmed_handler().
|
||||
* This handler builds a response packet, which is
|
||||
* - an Abort if
|
||||
* - the message is segmented
|
||||
* - if decoding fails
|
||||
* - if the response would be too large
|
||||
* - the result from Device_Read_Property(), if it succeeds
|
||||
* - an Error if Device_Read_Property() fails
|
||||
* or there isn't enough room in the APDU to fit the data.
|
||||
*
|
||||
* @param service_request [in] The contents of the service request.
|
||||
* @param service_len [in] The length of the service_request.
|
||||
* @param src [in] BACNET_ADDRESS of the source of the message
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void handler_read_property(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
|
||||
@@ -43,7 +43,9 @@
|
||||
|
||||
/** @file h_rp_a.c Handles Read Property Acknowledgments. */
|
||||
|
||||
/* for debugging... */
|
||||
/** For debugging...
|
||||
* @param [in] data portion of the ACK
|
||||
*/
|
||||
static void PrintReadPropertyData(
|
||||
BACNET_READ_PROPERTY_DATA * data)
|
||||
{
|
||||
@@ -105,6 +107,18 @@ static void PrintReadPropertyData(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Handler for a ReadProperty ACK.
|
||||
* @ingroup DSRP
|
||||
* Doesn't actually do anything, except, for debugging, to
|
||||
* print out the ACK message.
|
||||
*
|
||||
* @param service_request [in] The contents of the service request.
|
||||
* @param service_len [in] The length of the service_request.
|
||||
* @param src [in] BACNET_ADDRESS of the source of the message
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void handler_read_property_ack(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
|
||||
@@ -98,7 +98,7 @@ static unsigned RPM_Object_Property_Count(
|
||||
return count;
|
||||
}
|
||||
|
||||
/* Encode the RPM property returning the length of the encoding,
|
||||
/** Encode the RPM property returning the length of the encoding,
|
||||
or 0 if there is no room to fit the encoding. */
|
||||
static int RPM_Encode_Property(
|
||||
uint8_t * apdu,
|
||||
@@ -156,6 +156,26 @@ static int RPM_Encode_Property(
|
||||
return apdu_len;
|
||||
}
|
||||
|
||||
|
||||
/** Handler for a ReadPropertyMultiple Service request.
|
||||
* @ingroup DSRPM
|
||||
* This handler will be invoked by apdu_handler() if it has been enabled
|
||||
* by a call to apdu_set_confirmed_handler().
|
||||
* This handler builds a response packet, which is
|
||||
* - an Abort if
|
||||
* - the message is segmented
|
||||
* - if decoding fails
|
||||
* - if the response would be too large
|
||||
* - the result from each included read request, if it succeeds
|
||||
* - an Error if processing fails for all, or individual errors if only some fail,
|
||||
* or there isn't enough room in the APDU to fit the data.
|
||||
*
|
||||
* @param service_request [in] The contents of the service request.
|
||||
* @param service_len [in] The length of the service_request.
|
||||
* @param src [in] BACNET_ADDRESS of the source of the message
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void handler_read_property_multiple(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
|
||||
@@ -266,6 +266,18 @@ static void PrintReadPropertyMultipleData(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Handler for a ReadPropertyMultiple ACK.
|
||||
* @ingroup DSRPM
|
||||
* For each read property, print out the ACK'd data for debugging,
|
||||
* and free the request data items from linked property list.
|
||||
*
|
||||
* @param service_request [in] The contents of the service request.
|
||||
* @param service_len [in] The length of the service_request.
|
||||
* @param src [in] BACNET_ADDRESS of the source of the message
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void handler_read_property_multiple_ack(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
|
||||
@@ -41,6 +41,25 @@
|
||||
|
||||
/** @file h_wp.c Handles Write Property requests. */
|
||||
|
||||
|
||||
/** Handler for a WriteProperty Service request.
|
||||
* @ingroup DSWP
|
||||
* This handler will be invoked by apdu_handler() if it has been enabled
|
||||
* by a call to apdu_set_confirmed_handler().
|
||||
* This handler builds a response packet, which is
|
||||
* - an Abort if
|
||||
* - the message is segmented
|
||||
* - if decoding fails
|
||||
* - an ACK if Device_Write_Property() succeeds
|
||||
* - an Error if Device_Write_Property() fails
|
||||
* or there isn't enough room in the APDU to fit the data.
|
||||
*
|
||||
* @param service_request [in] The contents of the service request.
|
||||
* @param service_len [in] The length of the service_request.
|
||||
* @param src [in] BACNET_ADDRESS of the source of the message
|
||||
* @param service_data [in] The BACNET_CONFIRMED_SERVICE_DATA information
|
||||
* decoded from the APDU header of this message.
|
||||
*/
|
||||
void handler_write_property(
|
||||
uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
@@ -123,8 +142,7 @@ void handler_write_property(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Perform basic validation of Write Property argument based on
|
||||
/** Perform basic validation of Write Property argument based on
|
||||
* the assumption that it is a string. Check for correct data type,
|
||||
* correct encoding (fixed here as ANSI X34),correct length, and
|
||||
* finally if it is allowed to be empty.
|
||||
@@ -163,8 +181,7 @@ bool WPValidateString(
|
||||
return(bResult);
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform simple validation of type of Write Property argument based
|
||||
/** Perform simple validation of type of Write Property argument based
|
||||
* the expected type vs the actual. Set up error response if the
|
||||
* validation fails. Cuts out reams of repeated code in the object code.
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,19 @@
|
||||
|
||||
/** @file s_rp.c Send Read Property request. */
|
||||
|
||||
/* returns invoke id of 0 if device is not bound or no tsm available */
|
||||
/** Sends a Read Property request.
|
||||
* @ingroup DSRP
|
||||
*
|
||||
* @param device_id [in] ID of the destination device
|
||||
* @param object_type [in] Type of the object whose property is to be read.
|
||||
* @param object_instance [in] Instance # of the object to be read.
|
||||
* @param object_property [in] Property to be read, but not ALL, REQUIRED, or OPTIONAL.
|
||||
* @param array_index [in] Optional: if the Property is an array,
|
||||
* - 0 for the array size
|
||||
* - 1 to n for individual array members
|
||||
* - -1 for the full array to be read.
|
||||
* @return invoke id of outgoing message, or 0 if device is not bound or no tsm available
|
||||
*/
|
||||
uint8_t Send_Read_Property_Request(
|
||||
uint32_t device_id, /* destination device */
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
|
||||
@@ -45,7 +45,16 @@
|
||||
|
||||
/** @file s_rpm.c Send Read Property Multiple request. */
|
||||
|
||||
/* returns invoke id of 0 if device is not bound or no tsm available */
|
||||
/** Sends a Read Property Multiple request.
|
||||
* @ingroup DSRPM
|
||||
*
|
||||
* @param pdu [out] Buffer to build the outgoing message into
|
||||
* @param max_pdu [in] Length of the pdu buffer.
|
||||
* @param device_id [in] ID of the destination device
|
||||
* @param read_access_data [in] Ptr to structure with the linked list of
|
||||
* properties to be read.
|
||||
* @return invoke id of outgoing message, or 0 if device is not bound or no tsm available
|
||||
*/
|
||||
uint8_t Send_Read_Property_Multiple_Request(
|
||||
uint8_t * pdu,
|
||||
size_t max_pdu,
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/** @file s_wp.c Send a Write Property request. */
|
||||
|
||||
/* returns the invoke ID for confirmed request, or zero on failure */
|
||||
/** returns the invoke ID for confirmed request, or zero on failure */
|
||||
uint8_t Send_Write_Property_Request_Data(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
@@ -125,6 +125,20 @@ uint8_t Send_Write_Property_Request_Data(
|
||||
return invoke_id;
|
||||
}
|
||||
|
||||
|
||||
/** Sends a Write Property request.
|
||||
* @ingroup DSWP
|
||||
*
|
||||
* @param device_id [in] ID of the destination device
|
||||
* @param object_type [in] Type of the object whose property is to be written.
|
||||
* @param object_instance [in] Instance # of the object to be written.
|
||||
* @param object_property [in] Property to be written.
|
||||
* @param object_value [in] The value to be written to the property.
|
||||
* @param priority [in] Write priority of 1 (highest) to 16 (lowest)
|
||||
* @param array_index [in] Optional: if the Property is an array,
|
||||
* the index from 1 to n for the individual array member to be written.
|
||||
* @return invoke id of outgoing message, or 0 on failure.
|
||||
*/
|
||||
uint8_t Send_Write_Property_Request(
|
||||
uint32_t device_id,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
|
||||
@@ -45,51 +45,51 @@ typedef struct BACnet_Read_Range_Data {
|
||||
uint32_t array_index;
|
||||
uint8_t *application_data;
|
||||
int application_data_len;
|
||||
BACNET_BIT_STRING ResultFlags; /* FIRST_ITEM, LAST_ITEM, MORE_ITEMS */
|
||||
int RequestType; /* Index, sequence or time based request */
|
||||
int Overhead; /* How much space the baggage takes in the response */
|
||||
BACNET_BIT_STRING ResultFlags; /**< FIRST_ITEM, LAST_ITEM, MORE_ITEMS. */
|
||||
int RequestType; /**< Index, sequence or time based request. */
|
||||
int Overhead; /**< How much space the baggage takes in the response. */
|
||||
uint32_t ItemCount;
|
||||
uint32_t FirstSequence;
|
||||
union { /* Pick the appropriate data type */
|
||||
union { /**< Pick the appropriate data type. */
|
||||
uint32_t RefIndex;
|
||||
uint32_t RefSeqNum;
|
||||
BACNET_DATE_TIME RefTime;
|
||||
} Range;
|
||||
int32_t Count; /* SIGNED value as +ve vs -ve is important */
|
||||
int32_t Count; /**< SIGNED value as +ve vs -ve is important. */
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
} BACNET_READ_RANGE_DATA;
|
||||
|
||||
/* Defines to indicate which type of read range request it is
|
||||
/** Defines to indicate which type of read range request it is.
|
||||
Not really a bit map but we do it like this to allow quick
|
||||
checking of request against capabilities for the property */
|
||||
|
||||
#define RR_BY_POSITION 1
|
||||
#define RR_BY_SEQUENCE 2
|
||||
#define RR_BY_TIME 4
|
||||
#define RR_READ_ALL 8 /* Read all of array - so don't send any range in the request */
|
||||
#define RR_ARRAY_OF_LISTS 16 /* For info functionality indicates array of lists if set */
|
||||
#define RR_READ_ALL 8 /**< Read all of array - so don't send any range in the request */
|
||||
#define RR_ARRAY_OF_LISTS 16 /**< For info functionality indicates array of lists if set */
|
||||
|
||||
/* Bit String Enumerations */
|
||||
/** Bit String Enumerations */
|
||||
typedef enum {
|
||||
RESULT_FLAG_FIRST_ITEM = 0,
|
||||
RESULT_FLAG_LAST_ITEM = 1,
|
||||
RESULT_FLAG_MORE_ITEMS = 2
|
||||
} BACNET_RESULT_FLAGS;
|
||||
|
||||
/* Defines for ReadRange packet overheads to allow us to determine how
|
||||
/** Defines for ReadRange packet overheads to allow us to determine how
|
||||
* much space is left for actual payload:
|
||||
*
|
||||
* Overhead is comprised of:
|
||||
* 1. PDU Type + invoke ID + service type = 3 bytes
|
||||
* 2. Object ID = 5 bytes
|
||||
* 3. Object Property = 2 bytes if property is 0-255, 3 if property is
|
||||
* 256-65535 – theoretical max of 5 bytes but how likely is that?
|
||||
* 4. Optional array index = 2 bytes if index is 0-255, 3 if index is
|
||||
* 256-65535 – theoretical max of 5 bytes but how likely is that?
|
||||
* 5. Flags = 3 bytes
|
||||
* 6. Opening and closing tag for data = 2 bytes
|
||||
* 7. firstSequenceNumber [6] Unsigned32 OPTIONAL -- used only if 'Item Count' > 0
|
||||
* - 1. PDU Type + invoke ID + service type = 3 bytes
|
||||
* - 2. Object ID = 5 bytes
|
||||
* - 3. Object Property = 2 bytes if property is 0-255, 3 if property is
|
||||
* 256-65535 � theoretical max of 5 bytes but how likely is that?
|
||||
* - 4. Optional array index = 2 bytes if index is 0-255, 3 if index is
|
||||
* 256-65535 � theoretical max of 5 bytes but how likely is that?
|
||||
* - 5. Flags = 3 bytes
|
||||
* - 6. Opening and closing tag for data = 2 bytes
|
||||
* - 7. firstSequenceNumber [6] Unsigned32 OPTIONAL -- used only if 'Item Count' > 0
|
||||
* and the request was either of type 'By Sequence Number' or 'By Time'
|
||||
* = minimum of 2 bytes, maximum of 5 bytes.
|
||||
*
|
||||
@@ -105,10 +105,10 @@ typedef enum {
|
||||
#define RR_1ST_SEQ_OVERHEAD 5
|
||||
#define RR_INDEX_OVERHEAD 3 /* or 5 if paranoid */
|
||||
|
||||
/* Define pointer to function type for handling ReadRange request.
|
||||
/** Define pointer to function type for handling ReadRange request.
|
||||
This function will take the following parameters:
|
||||
1. A pointer to a buffer of at least MAX_APDU bytes to build the response in.
|
||||
2. A pointer to a BACNET_READ_RANGE_DATA structure with all the request
|
||||
- 1. A pointer to a buffer of at least MAX_APDU bytes to build the response in.
|
||||
- 2. A pointer to a BACNET_READ_RANGE_DATA structure with all the request
|
||||
information in it. The function is responsible for applying the request
|
||||
to the property in question and returning the response. */
|
||||
|
||||
@@ -116,7 +116,7 @@ typedef int (*rr_handler_function) (
|
||||
uint8_t *apdu,
|
||||
BACNET_READ_RANGE_DATA *pRequest);
|
||||
|
||||
/* Structure to return the type of requests a given object property can
|
||||
/** Structure to return the type of requests a given object property can
|
||||
* accept and the address of the function to handle the request */
|
||||
|
||||
typedef struct rrpropertyinfo {
|
||||
@@ -124,7 +124,7 @@ typedef struct rrpropertyinfo {
|
||||
rr_handler_function Handler;
|
||||
} RR_PROP_INFO;
|
||||
|
||||
/* Function pointer for ReadRange information retrieval function */
|
||||
/** Function pointer for ReadRange information retrieval function */
|
||||
|
||||
typedef bool (*rr_info_function) (
|
||||
BACNET_READ_RANGE_DATA *pRequest, /* Info on the request */
|
||||
@@ -154,5 +154,21 @@ uint8_t Send_ReadRange_Request(
|
||||
uint32_t device_id, /* destination device */
|
||||
BACNET_READ_RANGE_DATA * read_access_data);
|
||||
|
||||
|
||||
/** @defgroup Trend Trending BIBBs
|
||||
* These BIBBs prescribe the BACnet capabilities required to interoperably
|
||||
* perform the trending functions enumerated in clause 22.2.1.4 for the
|
||||
* BACnet devices defined therein.
|
||||
*/
|
||||
|
||||
/** @defgroup TrendReadRange Trending -Read Range Service (eg, in T-VMT)
|
||||
* @ingroup Trend
|
||||
* 15.8 ReadRange Service <br>
|
||||
* The ReadRange service is used by a client BACnet-user to read a specific
|
||||
* range of data items representing a subset of data available within a
|
||||
* specified object property.
|
||||
* The service may be used with any list or array of lists property.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -114,4 +114,19 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** @defgroup DataShare Data Sharing BIBBs
|
||||
* These BIBBs prescribe the BACnet capabilities required to interoperably
|
||||
* perform the data sharing functions enumerated in 22.2.1.1 for the BACnet
|
||||
* devices defined therein.
|
||||
*/
|
||||
|
||||
/** @defgroup DSRP Data Sharing -Read Property Service (DS-RP)
|
||||
* @ingroup DataShare
|
||||
* 15.5 ReadProperty Service <br>
|
||||
* The ReadProperty service is used by a client BACnet-user to request the
|
||||
* value of one property of one BACnet Object. This service allows read access
|
||||
* to any property of any object, whether a BACnet-defined object or not.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -191,4 +191,18 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** @defgroup DSRPM Data Sharing -Read Property Multiple Service (DS-RPM)
|
||||
* @ingroup DataShare
|
||||
* 15.7 ReadPropertyMultiple Service <br>
|
||||
* The ReadPropertyMultiple service is used by a client BACnet-user to request
|
||||
* the values of one or more specified properties of one or more BACnet Objects.
|
||||
* This service allows read access to any property of any object, whether a
|
||||
* BACnet-defined object or not. The user may read a single property of a single
|
||||
* object, a list of properties of a single object, or any number of properties
|
||||
* of any number of objects.
|
||||
* A 'Read Access Specification' with the property identifier ALL can be used to
|
||||
* learn the implemented properties of an object along with their values.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "bacdcode.h"
|
||||
#include "bacapp.h"
|
||||
|
||||
/* write property can have application tagged data, or context tagged data,
|
||||
/** @note: write property can have application tagged data, or context tagged data,
|
||||
or even complex data types (i.e. opening and closing tag around data).
|
||||
It could also have more than one value or element. */
|
||||
|
||||
@@ -92,4 +92,17 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** @defgroup DSWP Data Sharing - Write Property Service (DS-WP)
|
||||
* @ingroup DataShare
|
||||
* 15.9 WriteProperty Service <br>
|
||||
* The WriteProperty service is used by a client BACnet-user to modify the
|
||||
* value of a single specified property of a BACnet object. This service
|
||||
* potentially allows write access to any property of any object, whether a
|
||||
* BACnet-defined object or not. Some implementors may wish to restrict write
|
||||
* access to certain properties of certain objects. In such cases, an attempt
|
||||
* to modify a restricted property shall result in the return of an error of
|
||||
* 'Error Class' PROPERTY and 'Error Code' WRITE_ACCESS_DENIED.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user