Changed WhoHas and I-Have to use CharacterString instead of forcing ANSI X34 and C Strings. Affected all demos and ports object name, so I changed the object name function name to make sure it was noticed.

This commit is contained in:
skarg
2011-03-24 16:53:02 +00:00
parent 75d88abf77
commit deab12a5e1
74 changed files with 1566 additions and 850 deletions
+17 -14
View File
@@ -40,36 +40,39 @@
/** Local function which responds with either the requested object name
* or object ID, if the Device has a match.
* @param data [in] The decoded who-has payload from the request.
* @param data [in] The decoded who-has payload from the request.
*/
static void match_name_or_object(
BACNET_WHO_HAS_DATA * data)
{
char *object_name = NULL;
int object_type = 0;
uint32_t object_instance = 0;
bool found = false;
BACNET_CHARACTER_STRING object_name;
/* do we have such an object? If so, send an I-Have.
note: we should have only 1 of such an object */
if (data->object_name) {
if (data->is_object_name) {
/* valid name in my device? */
object_name = characterstring_value(&data->object.name);
found =
Device_Valid_Object_Name(object_name, &object_type,
Device_Valid_Object_Name(&data->object.name, &object_type,
&object_instance);
if (found)
if (found) {
Send_I_Have(Device_Object_Instance_Number(),
(BACNET_OBJECT_TYPE) object_type, object_instance,
object_name);
&data->object.name);
}
} else {
/* valid object in my device? */
object_name =
Device_Valid_Object_Id(data->object.identifier.type,
data->object.identifier.instance);
if (object_name)
/* valid object_name copy in my device? */
found = Device_Object_Name_Copy(
data->object.identifier.type,
data->object.identifier.instance,
&object_name);
if (found) {
Send_I_Have(Device_Object_Instance_Number(),
(BACNET_OBJECT_TYPE) data->object.identifier.type,
data->object.identifier.instance, object_name);
data->object.identifier.instance, &object_name);
}
}
}
@@ -108,7 +111,7 @@ void handler_who_has(
#ifdef BAC_ROUTING
/** Handler for Who-Has requests in the virtual routing setup,
/** Handler for Who-Has requests in the virtual routing setup,
* with broadcast I-Have response.
* Will respond if the device Object ID matches, and we have
* the Object or Object Name requested.
+2 -2
View File
@@ -57,7 +57,7 @@ void Send_I_Have(
uint32_t device_id,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
const char *object_name)
BACNET_CHARACTER_STRING *object_name)
{
int len = 0;
int pdu_len = 0;
@@ -84,7 +84,7 @@ void Send_I_Have(
data.device_id.instance = device_id;
data.object_id.type = object_type;
data.object_id.instance = object_instance;
characterstring_init_ansi(&data.object_name, object_name);
characterstring_copy(&data.object_name, object_name);
len = ihave_encode_apdu(&Handler_Transmit_Buffer[pdu_len], &data);
pdu_len += len;
/* send the data */
+2 -2
View File
@@ -83,7 +83,7 @@ void Send_WhoHas_Name(
/* encode the APDU portion of the packet */
data.low_limit = low_limit;
data.high_limit = high_limit;
data.object_name = true;
data.is_object_name = true;
characterstring_init_ansi(&data.object.name, object_name);
len = whohas_encode_apdu(&Handler_Transmit_Buffer[pdu_len], &data);
pdu_len += len;
@@ -138,7 +138,7 @@ void Send_WhoHas_Object(
/* encode the APDU portion of the packet */
data.low_limit = low_limit;
data.high_limit = high_limit;
data.object_name = false;
data.is_object_name = false;
data.object.identifier.type = object_type;
data.object.identifier.instance = object_instance;
len = whohas_encode_apdu(&Handler_Transmit_Buffer[pdu_len], &data);