Added some function documentation and a little more support for Structured Views.
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "txbuf.h"
|
#include "txbuf.h"
|
||||||
@@ -44,11 +45,18 @@
|
|||||||
|
|
||||||
/** @file h_rpm_a.c Handles Read Property Multiple Acknowledgments. */
|
/** @file h_rpm_a.c Handles Read Property Multiple Acknowledgments. */
|
||||||
|
|
||||||
/* returns the number of bytes decoded, or -1 on error */
|
/** Decode the received RPM data and make a linked list of the results.
|
||||||
/* note: initial the linked list of read_access_data */
|
* @ingroup DSRPM
|
||||||
static int rpm_ack_decode_service_request(
|
*
|
||||||
|
* @param apdu [in] The received apdu data.
|
||||||
|
* @param apdu_len [in] Total length of the apdu.
|
||||||
|
* @param read_access_data [out] Pointer to the head of the linked list
|
||||||
|
* where the RPM data is to be stored.
|
||||||
|
* @return The number of bytes decoded, or -1 on error
|
||||||
|
*/
|
||||||
|
int rpm_ack_decode_service_request(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int apdu_len, /* total length of the apdu */
|
int apdu_len,
|
||||||
BACNET_READ_ACCESS_DATA * read_access_data)
|
BACNET_READ_ACCESS_DATA * read_access_data)
|
||||||
{
|
{
|
||||||
int decoded_len = 0; /* return value */
|
int decoded_len = 0; /* return value */
|
||||||
@@ -63,6 +71,7 @@ static int rpm_ack_decode_service_request(
|
|||||||
BACNET_APPLICATION_DATA_VALUE *value;
|
BACNET_APPLICATION_DATA_VALUE *value;
|
||||||
BACNET_APPLICATION_DATA_VALUE *old_value;
|
BACNET_APPLICATION_DATA_VALUE *old_value;
|
||||||
|
|
||||||
|
assert( read_access_data != NULL );
|
||||||
rpm_object = read_access_data;
|
rpm_object = read_access_data;
|
||||||
old_rpm_object = rpm_object;
|
old_rpm_object = rpm_object;
|
||||||
while (rpm_object && apdu_len) {
|
while (rpm_object && apdu_len) {
|
||||||
|
|||||||
@@ -826,8 +826,11 @@ void Device_Inc_Database_Revision(
|
|||||||
Database_Revision++;
|
Database_Revision++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Since many network clients depend on the object list */
|
/** Get the total count of objects supported by this Device Object.
|
||||||
/* for discovery, it must be consistent! */
|
* @note Since many network clients depend on the object list
|
||||||
|
* for discovery, it must be consistent!
|
||||||
|
* @return The count of objects, for all supported Object types.
|
||||||
|
*/
|
||||||
unsigned Device_Object_List_Count(
|
unsigned Device_Object_List_Count(
|
||||||
void)
|
void)
|
||||||
{
|
{
|
||||||
@@ -846,6 +849,16 @@ unsigned Device_Object_List_Count(
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Lookup the Object at the given array index in the Device's Object List.
|
||||||
|
* Even though we don't keep a single linear array of objects in the Device,
|
||||||
|
* this method acts as though we do and works through a virtual, concatenated
|
||||||
|
* array of all of our object type arrays.
|
||||||
|
*
|
||||||
|
* @param array_index [in] The desired array index (1 to N)
|
||||||
|
* @param object_type [out] The object's type, if found.
|
||||||
|
* @param instance [out] The object's instance number, if found.
|
||||||
|
* @return True if found, else false.
|
||||||
|
*/
|
||||||
bool Device_Object_List_Identifier(
|
bool Device_Object_List_Identifier(
|
||||||
unsigned array_index,
|
unsigned array_index,
|
||||||
int *object_type,
|
int *object_type,
|
||||||
|
|||||||
@@ -40,68 +40,11 @@
|
|||||||
/** @defgroup ServerDemo Demo of a BACnet Server (Device)
|
/** @defgroup ServerDemo Demo of a BACnet Server (Device)
|
||||||
* @ingroup Demos
|
* @ingroup Demos
|
||||||
* This is a basic demonstration of a simple BACnet Device consisting of
|
* This is a basic demonstration of a simple BACnet Device consisting of
|
||||||
* the services and properties shown in its PICS (output provided by
|
* the services and properties shown in its EPICS
|
||||||
* the demo/epics/epics program):
|
* (see file demo/server/epics_vts3.tpi)
|
||||||
* @verbatim
|
|
||||||
List of Objects in test device:
|
|
||||||
{
|
|
||||||
object-identifier: (Device, 1234)
|
|
||||||
object-name: "SimpleServer"
|
|
||||||
object-type: Device
|
|
||||||
system-status: operational
|
|
||||||
vendor-name: "BACnet Stack at SourceForge"
|
|
||||||
vendor-identifier: 260
|
|
||||||
model-name: "GNU"
|
|
||||||
firmware-version: "0.5.5"
|
|
||||||
application-software-version: "1.0"
|
|
||||||
protocol-version: 1
|
|
||||||
protocol-revision: 5
|
|
||||||
protocol-services-supported: {
|
|
||||||
false,false,false,false, # ,,,,
|
|
||||||
false, true, true, true, # , Subscribe-COV, Atomic-Read-File, Atomic-Write-File,
|
|
||||||
false,false,false,false, # ,,,,
|
|
||||||
true,false, true, true, # Read-Property,, Read-Property-Multiple, Write-Property,
|
|
||||||
false, true,false,false, # , Device-Communication-Control,,,
|
|
||||||
true,false,false,false, # Reinitialize-Device,,,,
|
|
||||||
false,false,false,false, # ,,,,
|
|
||||||
true,false,false,false, # COV-Notification,,,,
|
|
||||||
true, true, true,false, # Time-Synchronization, Who-Has, Who-Is,,
|
|
||||||
true,false,false,false # UTC-Time-Synchronization,,,,
|
|
||||||
}
|
|
||||||
protocol-object-types-supported: {
|
|
||||||
true, true, true, true, # Analog Input, Analog Output, Analog Value, Binary Input,
|
|
||||||
true, true,false,false, # Binary Output, Binary Value,,,
|
|
||||||
true,false, true,false, # Device,, File,,
|
|
||||||
false, true, true,false, # , Multi-State Input, Multi-State Output,,
|
|
||||||
false,false,false,false, # ,,,,
|
|
||||||
true, true,false,false, # Trendlog, Life Safety Point,,,
|
|
||||||
false,false,false,false, # ,,,,
|
|
||||||
true,false,false,false, # Load-Control,,,,
|
|
||||||
false,false,false,false, # ,,,,
|
|
||||||
false,false # ,,
|
|
||||||
}
|
|
||||||
object-list: {(Device, 1234),(Analog Input, 0),(Analog Input, 1),
|
|
||||||
(Analog Input, 2),(Analog Input, 3),(Analog Output, 0),(Analog Output, 1),
|
|
||||||
(Analog Output, 2),(Analog Output, 3),(Analog Value, 0),(Analog Value, 1),
|
|
||||||
(Analog Value, 2),(Analog Value, 3),(Binary Input, 0),(Binary Input, 1),
|
|
||||||
(Binary Input, 2),(Binary Input, 3),(Binary Input, 4),(Binary Output, 0),
|
|
||||||
(Binary Output, 1),(Binary Output, 2),(Binary Output, 3),(Binary Value, 0),
|
|
||||||
(Binary Value, 1),(Binary Value, 2),(Binary Value, 3),(Binary Value, 4),
|
|
||||||
(Binary Value, 5),(Binary Value, 6),(Binary Value, 7),(Binary Value, 8),
|
|
||||||
(Binary Value, 9),(Life Safety Point, 0),(Life Safety Point, 1),(Life Safety Point, 2),
|
|
||||||
(Life Safety Point, 3),(Life Safety Point, 4),(Life Safety Point, 5),(Life Safety Point, 6),
|
|
||||||
(Load-Control, 0),(Load-Control, 1),(Load-Control, 2),(Load-Control, 3),
|
|
||||||
(Multi-State Output, 0),(Multi-State Output, 1),(Multi-State Output, 2),(Multi-State Output, 3),
|
|
||||||
(Multi-State Input, 0),(Trendlog, 0),(Trendlog, 1),(Trendlog, 2),
|
|
||||||
(Trendlog, 3),(Trendlog, 4),(Trendlog, 5),(Trendlog, 6),
|
|
||||||
(Trendlog, 7),(File, 0),(File, 1),(File, 2)}
|
|
||||||
max-apdu-length-accepted: 1476
|
|
||||||
segmentation-supported: no-segmentation
|
|
||||||
apdu-timeout: 3000
|
|
||||||
number-of-APDU-retries: 3
|
|
||||||
device-address-binding: Null
|
|
||||||
database-revision: 1
|
|
||||||
} @endverbatim
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @file server/epics_vts3.tpi EPICS file for the example server
|
||||||
|
* that can be loaded into VTS3 */
|
||||||
|
|
||||||
#endif /* SERVER_H_ */
|
#endif /* SERVER_H_ */
|
||||||
|
|||||||
@@ -167,6 +167,12 @@ extern "C" {
|
|||||||
BACNET_ADDRESS * src,
|
BACNET_ADDRESS * src,
|
||||||
BACNET_CONFIRMED_SERVICE_ACK_DATA * service_data);
|
BACNET_CONFIRMED_SERVICE_ACK_DATA * service_data);
|
||||||
|
|
||||||
|
/* Decode the received RPM data and make a linked list of the results. */
|
||||||
|
int rpm_ack_decode_service_request(
|
||||||
|
uint8_t * apdu,
|
||||||
|
int apdu_len,
|
||||||
|
BACNET_READ_ACCESS_DATA * read_access_data);
|
||||||
|
|
||||||
/* Encodes the property APDU and returns the length,
|
/* 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 */
|
/* resides in h_rp.c */
|
||||||
|
|||||||
@@ -517,6 +517,7 @@ BACNET_APPLICATION_TAG bacapp_context_tag_type(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_LIST_OF_GROUP_MEMBERS:
|
case PROP_LIST_OF_GROUP_MEMBERS:
|
||||||
|
/* Sequence of ReadAccessSpecification */
|
||||||
switch (tag_number) {
|
switch (tag_number) {
|
||||||
case 0:
|
case 0:
|
||||||
tag = BACNET_APPLICATION_TAG_OBJECT_ID;
|
tag = BACNET_APPLICATION_TAG_OBJECT_ID;
|
||||||
@@ -555,6 +556,18 @@ BACNET_APPLICATION_TAG bacapp_context_tag_type(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PROP_SUBORDINATE_LIST:
|
||||||
|
/* BACnetARRAY[N] of BACnetDeviceObjectReference */
|
||||||
|
switch (tag_number) {
|
||||||
|
case 0: /* Optional Device ID */
|
||||||
|
case 1: /* Object ID */
|
||||||
|
tag = BACNET_APPLICATION_TAG_OBJECT_ID;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,8 +347,8 @@ INDTEXT_DATA bacnet_property_names[] = {
|
|||||||
,
|
,
|
||||||
{PROP_FILE_TYPE, "file-type"}
|
{PROP_FILE_TYPE, "file-type"}
|
||||||
,
|
,
|
||||||
{PROP_FIRMWARE_REVISION, "firmware-version"}
|
{PROP_FIRMWARE_REVISION, "firmware-revision"}
|
||||||
,
|
, /* VTS wants "revision", not "version" */
|
||||||
{PROP_HIGH_LIMIT, "high-limit"}
|
{PROP_HIGH_LIMIT, "high-limit"}
|
||||||
,
|
,
|
||||||
{PROP_INACTIVE_TEXT, "inactive-text"}
|
{PROP_INACTIVE_TEXT, "inactive-text"}
|
||||||
|
|||||||
@@ -207,6 +207,18 @@ int rp_ack_encode_apdu(
|
|||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Decode the ReadProperty reply and store the result for one Property in a
|
||||||
|
* BACNET_READ_PROPERTY_DATA structure.
|
||||||
|
* This leaves the value(s) in the application_data buffer to be decoded later;
|
||||||
|
* the application_data field points into the apdu buffer (is not allocated).
|
||||||
|
*
|
||||||
|
* @param apdu [in] The apdu portion of the ACK reply.
|
||||||
|
* @param apdu_len [in] The total length of the apdu.
|
||||||
|
* @param rpdata [out] The structure holding the partially decoded result.
|
||||||
|
* @return Number of decoded bytes (could be less than apdu_len),
|
||||||
|
* or -1 on decoding error.
|
||||||
|
*/
|
||||||
int rp_ack_decode_service_request(
|
int rp_ack_decode_service_request(
|
||||||
uint8_t * apdu,
|
uint8_t * apdu,
|
||||||
int apdu_len, /* total length of the apdu */
|
int apdu_len, /* total length of the apdu */
|
||||||
|
|||||||
+10
-2
@@ -282,7 +282,10 @@ void tsm_free_invoke_id(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if the invoke ID has been made free */
|
/** Check if the invoke ID has been made free by the Transaction State Machine.
|
||||||
|
* @param invokeID [in] The invokeID to be checked, normally of last message sent.
|
||||||
|
* @return True if it is free (done with), False if still pending in the TSM.
|
||||||
|
*/
|
||||||
bool tsm_invoke_id_free(
|
bool tsm_invoke_id_free(
|
||||||
uint8_t invokeID)
|
uint8_t invokeID)
|
||||||
{
|
{
|
||||||
@@ -296,7 +299,12 @@ bool tsm_invoke_id_free(
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see if the invoke ID has failed get a confirmation */
|
/** See if we failed get a confirmation for the message associated
|
||||||
|
* with this invoke ID.
|
||||||
|
* @param invokeID [in] The invokeID to be checked, normally of last message sent.
|
||||||
|
* @return True if already failed, False if done or segmented or still waiting
|
||||||
|
* for a confirmation.
|
||||||
|
*/
|
||||||
bool tsm_invoke_id_failed(
|
bool tsm_invoke_id_failed(
|
||||||
uint8_t invokeID)
|
uint8_t invokeID)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user