Added some function documentation and a little more support for Structured Views.

This commit is contained in:
tbrennan3
2010-04-15 20:45:22 +00:00
parent f9d900fdca
commit c5977b8933
8 changed files with 76 additions and 72 deletions
+13 -4
View File
@@ -25,6 +25,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include "config.h"
#include "config.h"
#include "txbuf.h"
@@ -44,11 +45,18 @@
/** @file h_rpm_a.c Handles Read Property Multiple Acknowledgments. */
/* returns the number of bytes decoded, or -1 on error */
/* note: initial the linked list of read_access_data */
static int rpm_ack_decode_service_request(
/** Decode the received RPM data and make a linked list of the results.
* @ingroup DSRPM
*
* @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,
int apdu_len, /* total length of the apdu */
int apdu_len,
BACNET_READ_ACCESS_DATA * read_access_data)
{
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 *old_value;
assert( read_access_data != NULL );
rpm_object = read_access_data;
old_rpm_object = rpm_object;
while (rpm_object && apdu_len) {
+15 -2
View File
@@ -826,8 +826,11 @@ void Device_Inc_Database_Revision(
Database_Revision++;
}
/* Since many network clients depend on the object list */
/* for discovery, it must be consistent! */
/** Get the total count of objects supported by this Device Object.
* @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(
void)
{
@@ -846,6 +849,16 @@ unsigned Device_Object_List_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(
unsigned array_index,
int *object_type,
+5 -62
View File
@@ -40,68 +40,11 @@
/** @defgroup ServerDemo Demo of a BACnet Server (Device)
* @ingroup Demos
* This is a basic demonstration of a simple BACnet Device consisting of
* the services and properties shown in its PICS (output provided by
* the demo/epics/epics program):
* @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
* the services and properties shown in its EPICS
* (see file demo/server/epics_vts3.tpi)
*/
/** @file server/epics_vts3.tpi EPICS file for the example server
* that can be loaded into VTS3 */
#endif /* SERVER_H_ */
+6
View File
@@ -167,6 +167,12 @@ extern "C" {
BACNET_ADDRESS * src,
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,
or sets the error, and returns -1 */
/* resides in h_rp.c */
+13
View File
@@ -517,6 +517,7 @@ BACNET_APPLICATION_TAG bacapp_context_tag_type(
}
break;
case PROP_LIST_OF_GROUP_MEMBERS:
/* Sequence of ReadAccessSpecification */
switch (tag_number) {
case 0:
tag = BACNET_APPLICATION_TAG_OBJECT_ID;
@@ -555,6 +556,18 @@ BACNET_APPLICATION_TAG bacapp_context_tag_type(
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:
break;
}
+2 -2
View File
@@ -347,8 +347,8 @@ INDTEXT_DATA bacnet_property_names[] = {
,
{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_INACTIVE_TEXT, "inactive-text"}
+12
View File
@@ -207,6 +207,18 @@ int rp_ack_encode_apdu(
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(
uint8_t * apdu,
int apdu_len, /* total length of the apdu */
+10 -2
View File
@@ -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(
uint8_t invokeID)
{
@@ -296,7 +299,12 @@ bool tsm_invoke_id_free(
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(
uint8_t invokeID)
{