Fixed the problems from the WriteProperty changes. Compiles cleanly. Needs tested.
This commit is contained in:
@@ -210,8 +210,6 @@ int bacapp_decode_context_data(uint8_t * apdu,
|
|||||||
int tag_len = 0;
|
int tag_len = 0;
|
||||||
uint8_t tag_number = 0;
|
uint8_t tag_number = 0;
|
||||||
uint32_t len_value_type = 0;
|
uint32_t len_value_type = 0;
|
||||||
int object_type = 0;
|
|
||||||
uint32_t instance = 0;
|
|
||||||
|
|
||||||
/* FIXME: use max_apdu_len! */
|
/* FIXME: use max_apdu_len! */
|
||||||
(void) max_apdu_len;
|
(void) max_apdu_len;
|
||||||
|
|||||||
@@ -80,7 +80,9 @@ uint8_t Send_Write_Property_Request(uint32_t device_id, /* destination device */
|
|||||||
data.object_instance = object_instance;
|
data.object_instance = object_instance;
|
||||||
data.object_property = object_property;
|
data.object_property = object_property;
|
||||||
data.array_index = array_index;
|
data.array_index = array_index;
|
||||||
bacapp_copy(&data.value, object_value);
|
data.application_data_len =
|
||||||
|
bacapp_encode_application_data(
|
||||||
|
&data.application_data[0],object_value);
|
||||||
data.priority = priority;
|
data.priority = priority;
|
||||||
len = wp_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
len = wp_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
invoke_id, &data);
|
invoke_id, &data);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "address.h"
|
#include "address.h"
|
||||||
#include "bacdef.h"
|
#include "bacdef.h"
|
||||||
|
#include "bacapp.h"
|
||||||
#include "datalink.h"
|
#include "datalink.h"
|
||||||
#include "bacdcode.h"
|
#include "bacdcode.h"
|
||||||
#include "npdu.h"
|
#include "npdu.h"
|
||||||
@@ -221,6 +222,8 @@ bool bacfile_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)
|
||||||
{
|
{
|
||||||
bool status = false; /* return value */
|
bool status = false; /* return value */
|
||||||
|
int len = 0;
|
||||||
|
BACNET_APPLICATION_DATA_VALUE value;
|
||||||
|
|
||||||
if (!bacfile_valid_instance(wp_data->object_instance)) {
|
if (!bacfile_valid_instance(wp_data->object_instance)) {
|
||||||
*error_class = ERROR_CLASS_OBJECT;
|
*error_class = ERROR_CLASS_OBJECT;
|
||||||
@@ -229,6 +232,12 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* decode the some of the request */
|
/* decode the some of the request */
|
||||||
|
len = bacapp_decode_application_data(
|
||||||
|
wp_data->application_data,
|
||||||
|
wp_data->application_data_len,
|
||||||
|
&value);
|
||||||
|
/* FIXME: len < application_data_len: more data? */
|
||||||
|
/* FIXME: len == 0: unable to decode? */
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_ARCHIVE:
|
case PROP_ARCHIVE:
|
||||||
/* 12.13.8 Archive
|
/* 12.13.8 Archive
|
||||||
@@ -237,8 +246,8 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
property shall be logical TRUE only if no changes have been
|
property shall be logical TRUE only if no changes have been
|
||||||
made to the file data by internal processes or through File
|
made to the file data by internal processes or through File
|
||||||
Access Services since the last time the object was archived. */
|
Access Services since the last time the object was archived. */
|
||||||
if (wp_data->value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
|
if (value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
|
||||||
if (wp_data->value.type.Boolean) {
|
if (value.type.Boolean) {
|
||||||
/* FIXME: do something to wp_data->object_instance */
|
/* FIXME: do something to wp_data->object_instance */
|
||||||
} else {
|
} else {
|
||||||
/* FIXME: do something to wp_data->object_instance */
|
/* FIXME: do something to wp_data->object_instance */
|
||||||
@@ -252,8 +261,8 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
/* If the file size can be changed by writing to the file,
|
/* If the file size can be changed by writing to the file,
|
||||||
and File_Access_Method is STREAM_ACCESS, then this property
|
and File_Access_Method is STREAM_ACCESS, then this property
|
||||||
shall be writable. */
|
shall be writable. */
|
||||||
if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
||||||
/* FIXME: do something with wp_data->value.type.Unsigned
|
/* FIXME: do something with value.type.Unsigned
|
||||||
to wp_data->object_instance */
|
to wp_data->object_instance */
|
||||||
} else {
|
} else {
|
||||||
*error_class = ERROR_CLASS_PROPERTY;
|
*error_class = ERROR_CLASS_PROPERTY;
|
||||||
|
|||||||
@@ -854,10 +854,9 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
Character_String);
|
Character_String);
|
||||||
if (encoding == CHARACTER_ANSI_X34) {
|
if (encoding == CHARACTER_ANSI_X34) {
|
||||||
status =
|
status =
|
||||||
Device_Set_Object_Name(characterstring_value(&wp_data->
|
Device_Set_Object_Name(
|
||||||
value.type.Character_String),
|
characterstring_value(&value.type.Character_String),
|
||||||
characterstring_length(&value.type.
|
characterstring_length(&value.type.Character_String));
|
||||||
Character_String));
|
|
||||||
if (!status) {
|
if (!status) {
|
||||||
*error_class = ERROR_CLASS_PROPERTY;
|
*error_class = ERROR_CLASS_PROPERTY;
|
||||||
*error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
|
*error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ int wp_decode_service_request(uint8_t * apdu,
|
|||||||
int type = 0; /* for decoding */
|
int type = 0; /* for decoding */
|
||||||
int property = 0; /* for decoding */
|
int property = 0; /* for decoding */
|
||||||
uint32_t unsigned_value = 0;
|
uint32_t unsigned_value = 0;
|
||||||
|
int i = 0; /* loop counter */
|
||||||
|
|
||||||
/* check for value pointers */
|
/* check for value pointers */
|
||||||
if (apdu_len && data) {
|
if (apdu_len && data) {
|
||||||
@@ -131,6 +132,10 @@ int wp_decode_service_request(uint8_t * apdu,
|
|||||||
apdu_len-len, property);
|
apdu_len-len, property);
|
||||||
/* a tag number of 3 is not extended so only one octet */
|
/* a tag number of 3 is not extended so only one octet */
|
||||||
len++;
|
len++;
|
||||||
|
/* copy the data from the APDU */
|
||||||
|
for (i = 0; i < data->application_data_len; i++) {
|
||||||
|
data->application_data[i] = apdu[len+i];
|
||||||
|
}
|
||||||
/* add on the data length */
|
/* add on the data length */
|
||||||
len += data->application_data_len;
|
len += data->application_data_len;
|
||||||
if (!decode_is_closing_tag_number(&apdu[len], 3))
|
if (!decode_is_closing_tag_number(&apdu[len], 3))
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ typedef struct BACnet_Write_Property_Data {
|
|||||||
uint32_t object_instance;
|
uint32_t object_instance;
|
||||||
BACNET_PROPERTY_ID object_property;
|
BACNET_PROPERTY_ID object_property;
|
||||||
int32_t array_index; /* use BACNET_ARRAY_ALL when not setting */
|
int32_t array_index; /* use BACNET_ARRAY_ALL when not setting */
|
||||||
uint8_t *application_data;
|
uint8_t application_data[MAX_APDU];
|
||||||
int application_data_len;
|
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;
|
} BACNET_WRITE_PROPERTY_DATA;
|
||||||
|
|||||||
Reference in New Issue
Block a user