diff --git a/bacnet-stack/BACnet-stack.doxyfile b/bacnet-stack/BACnet-stack.doxyfile index 94325096..d379fff5 100644 --- a/bacnet-stack/BACnet-stack.doxyfile +++ b/bacnet-stack/BACnet-stack.doxyfile @@ -271,7 +271,7 @@ EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. -EXTRACT_STATIC = NO +EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. @@ -506,7 +506,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = include src demo/server ports/linux demo/handler demo/object +INPUT = include src ports/linux demo/handler demo/object demo/server demo/epics # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -1108,7 +1108,7 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = FOR_DOXYGEN +PREDEFINED = FOR_DOXYGEN # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/bacnet-stack/demo/epics/bacepics.h b/bacnet-stack/demo/epics/bacepics.h new file mode 100755 index 00000000..3dc673f8 --- /dev/null +++ b/bacnet-stack/demo/epics/bacepics.h @@ -0,0 +1,90 @@ +/************************************************************************** +* +* Copyright (C) 2006 Steve Karg +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* +*********************************************************************/ + +#ifndef BACEPICS_H_ +#define BACEPICS_H_ + +/** @file epics/bacepics.h Header for tool to generate EPICS-usable output. */ + + +/** @defgroup BACEPICS Tool to generate EPICS-usable output. + * @ingroup Demos + * This tool will generate a list of Objects and their properties for use in + * an EPICS file. + * You will still need to provide the front part of the EPICS (see file + * demo/server/epics_vts3.tpi) which cannot be easily determined by observation, + * but this tool communicates with the test device and does the grunt work of + * creating the list of Objects and the supported properties for + * each of those Objects. + * + * Usage: + * ./bacepics [-v] 1234 + * + * - where the device instance to be addressed is 1234, + * - and the optional -v prints values out rather than the '?' that + * the EPICS format for VTS3 wants. + * + * The tool follows an optimal approach which will use efficient communication + * means if available or else fall back to simple-minded methods. + * Starting with the Device Object, the tool will + * - Try to fetch ALL the Properties with RPM + * - If RPM is not supported, will use coded properties in demo/object folder + * - If response is too big to fit (without segmentation), then will fetch + * ALL again with array index of 0, which should result mostly in errors + * but will provide the list of supported properties. + * - If that succeeds, build the list of properties to be accessed.
+ * - If no RPM or failed to get ALL properties from the target device, then + * fetch the coded Required and Optional properties from the demo/object + * folder for this object type, and use this to build the list of + * properties to be accessed. + * - If the Fetch All succeeded, print the values for each property + * - Otherwise, for each property in the list for this object, + * - Request the single property value with ReadProperty (RP) + * - From the response, print the property's value + * The Device Object will have fetched the Object List property and built a list + * of objects from that; use it now to cycle through each other Object and + * repeat the above process to get and print out their property values. + */ + +/** The allowed States of the bacepics State Machine. + * Important to distinguish the request from the response phases as well + * as which approach will get all the properties for us. + * @ingroup BACEPICS + */ +typedef enum { + /** Initial state to establish a binding with the target device. */ + INITIAL_BINDING, + /** Getting ALL properties and values at once with RPM. */ + GET_ALL_REQUEST, GET_ALL_RESPONSE, + /** Getting ALL properties with array index = 0, just to get the list. */ + GET_LIST_OF_ALL_REQUEST, GET_LIST_OF_ALL_RESPONSE, + /** Processing the properties individually with ReadProperty. */ + GET_PROPERTY_REQUEST, GET_PROPERTY_RESPONSE, + /** Done with this Object; move onto the next. */ + NEXT_OBJECT +} EPICS_STATES; + + +#endif /* BACEPICS_H_ */ diff --git a/bacnet-stack/demo/epics/main.c b/bacnet-stack/demo/epics/main.c index 00ed5612..2792c910 100644 --- a/bacnet-stack/demo/epics/main.c +++ b/bacnet-stack/demo/epics/main.c @@ -23,7 +23,9 @@ * *********************************************************************/ -/* command line tool that sends a BACnet service, and displays the reply */ +/** @file epics/main.c Command line tool to build a list of Objects and + * Properties that can be used with VTS3 EPICS files. */ + #include #include #include @@ -54,6 +56,12 @@ #include "keylist.h" #include "bacepics.h" + +/* (Doxygen note: The next two lines pull all the following Javadoc + * into the BACEPICS module.) */ +/** @addtogroup BACEPICS + * @{ */ + /* buffer used for receive */ static uint8_t Rx_Buf[MAX_MPDU] = { 0 }; @@ -724,6 +732,19 @@ int CheckCommandLineArgs( return 0; /* All OK if we reach here */ } +/** Main function of the bacepics program. + * + * @see Device_Set_Object_Instance_Number, Keylist_Create, address_init, + * dlenv_init, address_bind_request, Send_WhoIs, + * tsm_timer_milliseconds, datalink_receive, npdu_handler, + * Send_Read_Property_Multiple_Request, + * + * + * @param argc [in] Arg count. + * @param argv [in] Takes one or two arguments: an optional -v "Show Values" + * switch, and the Device Instance #. + * @return 0 on success. + */ int main( int argc, char *argv[]) @@ -1027,3 +1048,6 @@ int main( return 0; } + +/*@}*/ /* End group BACEPICS */ + diff --git a/bacnet-stack/demo/server/main.c b/bacnet-stack/demo/server/main.c index 0eca9670..b01cfadc 100644 --- a/bacnet-stack/demo/server/main.c +++ b/bacnet-stack/demo/server/main.c @@ -51,11 +51,11 @@ /* include the device object */ #include "device.h" -/** @file server/main.c Example server application using the BACnet Stack */ +/** @file server/main.c Example server application using the BACnet Stack. */ /* (Doxygen note: The next two lines pull all the following Javadoc * into the ServerDemo module.) */ -/** @ingroup ServerDemo */ +/** @addtogroup ServerDemo */ /*@{*/ /** Buffer used for receiving */ @@ -184,4 +184,4 @@ int main( } } -/*@}*/ /* End group ServerDemo */ +/* @} */ /* End group ServerDemo */ diff --git a/bacnet-stack/demo/server/server.h b/bacnet-stack/demo/server/server.h index 118da1c1..492f4268 100644 --- a/bacnet-stack/demo/server/server.h +++ b/bacnet-stack/demo/server/server.h @@ -27,7 +27,7 @@ #define SERVER_H_ /** @file server/server.h Header for example server (ie, BACnet Device) - * using the BACnet Stack */ + * using the BACnet Stack. */ /** @defgroup Demos Demos of Servers and Clients * Most of the folders under the /demo folder contain demonstration (ie, sample) @@ -37,14 +37,12 @@ * described in the various BIBBs and Object Framework modules. */ -/** @defgroup ServerDemo Demo of a BACnet Server (Device) +/** @defgroup ServerDemo Demo of a BACnet Server (Device). * @ingroup Demos * This is a basic demonstration of a simple BACnet Device consisting of * the services and properties shown in its EPICS * (see file demo/server/epics_vts3.tpi) */ -/** @file server/epics_vts3.tpi EPICS file for the example server - * that can be loaded into VTS3 */ #endif /* SERVER_H_ */