Bugfix/writeproperty app known property (#450)
* Fix write-property app known property option * Fix write-property app priority handling --------- Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
+11
-7
@@ -249,7 +249,8 @@ int main(int argc, char *argv[])
|
|||||||
char *value_string = NULL;
|
char *value_string = NULL;
|
||||||
bool status = false;
|
bool status = false;
|
||||||
int args_remaining = 0, tag_value_arg = 0, i = 0;
|
int args_remaining = 0, tag_value_arg = 0, i = 0;
|
||||||
BACNET_APPLICATION_TAG property_tag;
|
long property_tag;
|
||||||
|
long priority;
|
||||||
uint8_t context_tag = 0;
|
uint8_t context_tag = 0;
|
||||||
int argi = 0;
|
int argi = 0;
|
||||||
|
|
||||||
@@ -288,7 +289,12 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Target_Object_Property = object_property;
|
Target_Object_Property = object_property;
|
||||||
Target_Object_Property_Priority = (uint8_t)strtol(argv[5], NULL, 0);
|
priority = strtol(argv[5], NULL, 0);
|
||||||
|
if ((priority < BACNET_MIN_PRIORITY) ||
|
||||||
|
(priority > BACNET_MAX_PRIORITY)) {
|
||||||
|
priority = BACNET_NO_PRIORITY;
|
||||||
|
}
|
||||||
|
Target_Object_Property_Priority = priority;
|
||||||
Target_Object_Property_Index = strtol(argv[6], NULL, 0);
|
Target_Object_Property_Index = strtol(argv[6], NULL, 0);
|
||||||
if (Target_Object_Property_Index == -1) {
|
if (Target_Object_Property_Index == -1) {
|
||||||
Target_Object_Property_Index = BACNET_ARRAY_ALL;
|
Target_Object_Property_Index = BACNET_ARRAY_ALL;
|
||||||
@@ -341,7 +347,7 @@ int main(int argc, char *argv[])
|
|||||||
property_tag = bacapp_known_property_tag(
|
property_tag = bacapp_known_property_tag(
|
||||||
Target_Object_Type, Target_Object_Property);
|
Target_Object_Type, Target_Object_Property);
|
||||||
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
||||||
fprintf(stderr, "Error: tag=%u - it must be less than %u\n",
|
fprintf(stderr, "Error: tag=%ld - it must be less than %u\n",
|
||||||
property_tag, MAX_BACNET_APPLICATION_TAG);
|
property_tag, MAX_BACNET_APPLICATION_TAG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -354,11 +360,9 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* FIXME: show the expected entry format for the tag */
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error: unable to parse the known property"
|
"Error: parser for property %s is not implemented\n",
|
||||||
" \"%s\"\r\n",
|
bactext_property_name(Target_Object_Property));
|
||||||
value_string);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-9
@@ -279,7 +279,8 @@ int main(int argc, char *argv[])
|
|||||||
BACNET_PROPERTY_VALUE *wpm_property;
|
BACNET_PROPERTY_VALUE *wpm_property;
|
||||||
char *value_string = NULL;
|
char *value_string = NULL;
|
||||||
bool status = false;
|
bool status = false;
|
||||||
BACNET_APPLICATION_TAG property_tag;
|
long property_tag;
|
||||||
|
long priority;
|
||||||
uint8_t context_tag = 0;
|
uint8_t context_tag = 0;
|
||||||
unsigned object_type = 0;
|
unsigned object_type = 0;
|
||||||
unsigned property_id = 0;
|
unsigned property_id = 0;
|
||||||
@@ -394,8 +395,12 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* Priority */
|
/* Priority */
|
||||||
wpm_property->priority =
|
priority = strtol(argv[tag_value_arg], NULL, 0);
|
||||||
(uint8_t)strtol(argv[tag_value_arg], NULL, 0);
|
if ((priority < BACNET_MIN_PRIORITY) ||
|
||||||
|
(priority > BACNET_MAX_PRIORITY)) {
|
||||||
|
priority = BACNET_NO_PRIORITY;
|
||||||
|
}
|
||||||
|
wpm_property->priority = priority;
|
||||||
tag_value_arg++;
|
tag_value_arg++;
|
||||||
args_remaining--;
|
args_remaining--;
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
@@ -429,14 +434,15 @@ int main(int argc, char *argv[])
|
|||||||
tag_value_arg++;
|
tag_value_arg++;
|
||||||
args_remaining--;
|
args_remaining--;
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
printf("tag=%u value=%s\n", property_tag, value_string);
|
printf("tag=%ld value=%s\n", property_tag, value_string);
|
||||||
}
|
}
|
||||||
if (property_tag < 0) {
|
if (property_tag < 0) {
|
||||||
property_tag =
|
property_tag =
|
||||||
bacapp_known_property_tag(wpm_object->object_type,
|
bacapp_known_property_tag(wpm_object->object_type,
|
||||||
wpm_property->propertyIdentifier);
|
wpm_property->propertyIdentifier);
|
||||||
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
||||||
fprintf(stderr, "Error: tag=%u - it must be less than %u\n",
|
fprintf(stderr,
|
||||||
|
"Error: tag=%ld - it must be less than %u\n",
|
||||||
property_tag, MAX_BACNET_APPLICATION_TAG);
|
property_tag, MAX_BACNET_APPLICATION_TAG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -450,11 +456,10 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* FIXME: show the expected entry format for the tag */
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error: unable to parse the known property"
|
"Error: parser for property %s is not implemented\n",
|
||||||
" \"%s\"\r\n",
|
bactext_property_name(
|
||||||
value_string);
|
wpm_property->propertyIdentifier));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
wpm_property->value.next = NULL;
|
wpm_property->value.next = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user