added ReadPropertyMultiple client demo application, bacrpm.

This commit is contained in:
skarg
2008-11-23 22:25:08 +00:00
parent 815d8f8dbb
commit 7921d2f811
22 changed files with 772 additions and 77 deletions
+19
View File
@@ -89,6 +89,25 @@ typedef struct BACnet_Application_Data_Value {
struct BACnet_Application_Data_Value *next;
} BACNET_APPLICATION_DATA_VALUE;
struct BACnet_Property_Reference;
typedef struct BACnet_Property_Reference {
BACNET_PROPERTY_ID propertyIdentifier;
int32_t propertyArrayIndex; /* optional */
BACNET_APPLICATION_DATA_VALUE *value;
/* simple linked list */
struct BACnet_Property_Reference *next;
} BACNET_PROPERTY_REFERENCE;
struct BACnet_Property_Value;
typedef struct BACnet_Property_Value {
BACNET_PROPERTY_ID propertyIdentifier;
int32_t propertyArrayIndex;
BACNET_APPLICATION_DATA_VALUE value;
uint8_t priority;
/* simple linked list */
struct BACnet_Property_Value *next;
} BACNET_PROPERTY_VALUE;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
+6
View File
@@ -33,6 +33,7 @@
#include "npdu.h"
#include "bacapp.h"
#include "bacenum.h"
#include "rpm.h"
#ifdef __cplusplus
extern "C" {
@@ -74,6 +75,11 @@ extern "C" {
uint32_t object_instance,
BACNET_PROPERTY_ID object_property,
int32_t array_index);
uint8_t Send_Read_Property_Multiple_Request(
uint8_t * pdu,
size_t max_pdu,
uint32_t device_id, /* destination device */
BACNET_READ_ACCESS_DATA *read_access_data);
/* returns the invoke ID for confirmed request, or 0 if failed */
uint8_t Send_Write_Property_Request(
-15
View File
@@ -38,16 +38,6 @@
#include <stdbool.h>
#include "bacapp.h"
struct BACnet_Property_Value;
typedef struct BACnet_Property_Value {
BACNET_PROPERTY_ID propertyIdentifier;
uint32_t propertyArrayIndex;
BACNET_APPLICATION_DATA_VALUE value;
uint8_t priority;
/* simple linked list */
struct BACnet_Property_Value *next;
} BACNET_PROPERTY_VALUE;
typedef struct BACnet_COV_Data {
uint32_t subscriberProcessIdentifier;
uint32_t initiatingDeviceIdentifier;
@@ -57,11 +47,6 @@ typedef struct BACnet_COV_Data {
BACNET_PROPERTY_VALUE *listOfValues;
} BACNET_COV_DATA;
typedef struct BACnet_Property_Reference {
BACNET_PROPERTY_ID propertyIdentifier;
unsigned propertyArrayIndex; /* optional */
} BACNET_PROPERTY_REFERENCE;
typedef struct BACnet_Subscribe_COV_Data {
uint32_t subscriberProcessIdentifier;
BACNET_OBJECT_ID monitoredObjectIdentifier;
+6
View File
@@ -136,6 +136,12 @@ extern "C" {
BACNET_ADDRESS * src,
BACNET_CONFIRMED_SERVICE_DATA * service_data);
void handler_read_property_multiple_ack(
uint8_t * service_request,
uint16_t service_len,
BACNET_ADDRESS * src,
BACNET_CONFIRMED_SERVICE_ACK_DATA * service_data);
/* Encodes the property APDU and returns the length,
or sets the error, and returns -1 */
/* resides in h_rp.c */
+60
View File
@@ -0,0 +1,60 @@
/*####COPYRIGHTBEGIN####
-------------------------------------------
Copyright (C) 2005 by Steve Karg
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
The Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307
USA.
As a special exception, if other files instantiate templates or
use macros or inline functions from this file, or you compile
this file and link it with other works to produce a work based
on this file, this file does not by itself cause the resulting
work to be covered by the GNU General Public License. However
the source code for this file must still be made available in
accordance with section (3) of the GNU General Public License.
This exception does not invalidate any other reasons why a work
based on this file might be covered by the GNU General Public
License.
-------------------------------------------
####COPYRIGHTEND####*/
/* Functional Description: Memory copy function */
#ifndef MEMCOPY_H
#define MEMCOPY_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* copy len bytes from src to offset of dest if there is enough space. */
/* returns 0 if there is not enough space, or the number of bytes copied. */
size_t memcopy(
void * dest,
void * src,
size_t offset, /* where in dest to put the data */
size_t len, /* amount of data to copy */
size_t max); /* total size of destination */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
+16 -1
View File
@@ -40,6 +40,16 @@
#include "bacdef.h"
#include "bacapp.h"
struct BACnet_Read_Access_Data;
typedef struct BACnet_Read_Access_Data {
BACNET_OBJECT_TYPE object_type;
uint32_t object_instance;
/* simple linked list of values */
BACNET_PROPERTY_REFERENCE *listOfProperties;
struct BACnet_Read_Access_Data *next;
} BACNET_READ_ACCESS_DATA;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -68,6 +78,12 @@ extern "C" {
int rpm_encode_apdu_object_end(
uint8_t * apdu);
int rpm_encode_apdu(
uint8_t * apdu,
size_t max_apdu,
uint8_t invoke_id,
BACNET_READ_ACCESS_DATA *read_access_data);
/* decode the object portion of the service request only */
int rpm_decode_object_id(
uint8_t * apdu,
@@ -129,7 +145,6 @@ extern "C" {
unsigned apdu_len,
BACNET_PROPERTY_ID * object_property,
int32_t * array_index);
#ifdef TEST
#include "ctest.h"
int rpm_decode_apdu(
+14 -10
View File
@@ -55,32 +55,36 @@ extern "C" {
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 */
char *data, /* data block */
unsigned size); /* actual size, in bytes, of the data block or array of data */
/* returns true if size==0, false if size > 0 */
bool sbuf_empty(
STATIC_BUFFER const *b);
/* returns the data block, or NULL if not initialized */
char *sbuf_data(
STATIC_BUFFER const *b);
/* returns the max size of the data block */
unsigned sbuf_size(
STATIC_BUFFER * b);
/* returns the number of bytes used in the data block */
unsigned sbuf_count(
STATIC_BUFFER * b);
/* returns true if successful, false if not enough room to append data */
/* returns true if successful, false if not enough room to append data */
bool sbuf_put(
STATIC_BUFFER * b, /* static buffer structure */
unsigned offset, /* where to start */
char *data, /* number of bytes used */
char *data, /* data to add */
unsigned data_size); /* how many to add */
/* returns true if successful, false if not enough room to append data */
/* 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 */
unsigned data_size); /* how many to add */
/* returns true if successful, false if not enough room to append data */
char *data, /* data to append */
unsigned data_size); /* how many to append */
/* returns true if successful, false if count is bigger than size */
bool sbuf_truncate(
STATIC_BUFFER * b, /* static buffer structure */
unsigned count); /* total number of bytes in use */
unsigned count); /* new number of bytes used in buffer */
#ifdef __cplusplus
}