Bugfix/code clean using gcc warnings (#371)

* Enable extra GCC warnings to discover subtle bugs

* convert c++ comments to c comments

* cleanup pedantic compiler warnings

* Compile apps with GNU89 GNU99 GNU11 and GNU17

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-12-25 21:43:51 -06:00
committed by GitHub
parent 0728bc4390
commit b91735af13
66 changed files with 990 additions and 847 deletions
+31 -31
View File
@@ -161,76 +161,76 @@ static void print_help(char *filename)
"BACnet Device Object Instance number that you are trying to\n"
"communicate to. This number will be used to try and bind with\n"
"the device using Who-Is and I-Am services. For example, if you were\n"
"writing to Device Object 123, the device-instance would be 123.\n"
"\n"
"writing to Device Object 123, the device-instance would be 123.\n");
printf("\n");
printf(
"object-type:\n"
"The object type is object that you are reading. It\n"
"can be defined either as the object-type name string\n"
"as defined in the BACnet specification, or as the\n"
"integer value of the enumeration BACNET_OBJECT_TYPE\n"
"in bacenum.h. For example if you were reading Analog\n"
"Output 2, the object-type would be analog-output or 1.\n"
"\n"
"Output 2, the object-type would be analog-output or 1.\n");
printf("\n");
printf(
"object-instance:\n"
"This is the object instance number of the object that you are \n"
"writing to. For example, if you were writing to Analog Output 2, \n"
"the object-instance would be 2.\n"
"\n"
"the object-instance would be 2.\n");
printf("\n");
printf(
"property:\n"
"The property of the object that you are reading. It\n"
"can be defined either as the property name string as\n"
"defined in the BACnet specification, or as an integer\n"
"value of the enumeration BACNET_PROPERTY_ID in\n"
"bacenum.h. For example, if you were reading the Present\n"
"Value property, use present-value or 85 as the property.\n"
"\n"
"Value property, use present-value or 85 as the property.\n");
printf("\n");
printf(
"priority:\n"
"This parameter is used for setting the priority of the\n"
"write. If Priority 0 is given, no priority is sent. The BACnet \n"
"standard states that the value is written at the lowest \n"
"priority (16) if the object property supports priorities\n"
"when no priority is sent.\n"
"\n"
"when no priority is sent.\n");
printf("\n");
printf(
"index\n"
"This integer parameter is the index number of an array.\n"
"If the property is an array, individual elements can be written\n"
"to if supported. If this parameter is -1, the index is ignored.\n"
"\n"
"to if supported. If this parameter is -1, the index is ignored.\n");
printf("\n");
printf(
"tag:\n"
"Tag is the integer value of the enumeration BACNET_APPLICATION_TAG \n"
"in bacenum.h. It is the data type of the value that you are\n"
"writing. For example, if you were writing a REAL value, you would \n"
"use a tag of 4.\n"
"Context tags are created using two tags in a row. The context tag\n"
"is preceded by a C. Ctag tag. C2 4 creates a context 2 tagged REAL.\n"
"\n"
"is preceded by a C, and followed by the application tag.\n"
"Ctag atag. C2 4 creates a context 2 tagged REAL.\n");
printf("\n");
printf(
"value:\n"
"The value is an ASCII representation of some type of data that you\n"
"are writing. It is encoded using the tag information provided. For\n"
"example, if you were writing a REAL value of 100.0, you would use \n"
"100.0 as the value.\n"
"\n"
"Here is a brief overview of BACnet property and tags:\n"
"Certain properties are expected to be written with certain \n"
"application tags, so you probably need to know which ones to use\n"
"with each property of each object. It is almost safe to say that\n"
"given a property and an object and a table, the tag could be looked\n"
"up automatically. There may be a few exceptions to this, such as\n"
"the Any property type in the schedule object and the Present Value\n"
"accepting REAL, BOOLEAN, NULL, etc. Perhaps it would be simpler for\n"
"the demo to use this kind of table - but I also wanted to be able\n"
"to do negative testing by passing the wrong tag and have the server\n"
"return a reject message.\n"
"\nExample:\n"
"100.0 as the value.\n");
printf("\n");
printf(
"Example:\n"
"If you want send a value of 100 to the Present-Value in\n"
"Analog Output 0 of Device 123 at priority 16,\n"
"send the one of following commands:\n"
"%s 123 analog-output 0 present-value 16 -1 4 100\n"
"%s 123 1 0 85 16 -1 4 100\n"
"%s 123 1 0 85 16 -1 4 100\n",
filename, filename);
printf(
"To send a relinquish command to the same object:\n"
"%s 123 analog-output 0 present-value 16 -1 0 0\n"
"%s 123 1 0 85 16 -1 0 0\n",
filename, filename, filename, filename);
filename, filename);
}
int main(int argc, char *argv[])
@@ -362,7 +362,7 @@ int main(int argc, char *argv[])
return 1;
}
// Print the written value (for debug)
/* Print the written value (for debug) */
#if 0
fprintf(stderr, "Writing: ");
BACNET_OBJECT_PROPERTY_VALUE dummy_opv = {