Update HTML test page to new template. Added Config file selection from UI.
[apps/agl-service-unicens.git] / ucs2-interface / ucs-xml / UcsXml.h
index 883a9ff..b36e007 100644 (file)
-/*
- * Unicens XML Parser
- *
- * Copyright (C) 2017 Microchip Technology Germany II GmbH & Co. KG
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * You may also obtain this software under a propriety license from Microchip.
- * Please contact Microchip for further information.
- *
- */
-#ifndef UCSXML_H_
-#define UCSXML_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "ucs_api.h"
-
-/** Structure holding informations to startup Unicens (UCS).
- *  Pass all these variables to the UCS manager structure, but not pInternal.
- *  */
-typedef struct
-{
-    /** The amount of bytes assigned to the async channel*/
-    uint16_t packetBw;
-    /** Array of routes */
-    Ucs_Rm_Route_t *pRoutes;
-    /** Route array size */
-    uint16_t routesSize;
-    /** Array of nodes */
-    Ucs_Rm_Node_t *pNod;
-    /** Node array size */
-    uint16_t nodSize;
-    /** Internal data, to be ignored */
-    void *pInternal;
-} UcsXmlVal_t;
-
-/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
-/*                            Public API                                */
-/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
-
-/**
- * \brief Initializes Unicens XML parser module, parses the given string and 
- *        generate the data needed to run Unicens (UCS) library.
- *
- * \note In case of errors the callback UcsXml_CB_OnError will be raised.
- * \param xmlString - Zero terminated XML string. The string will not be used
- *                    after this function call.
- * \return Structure holding the needed data for UCS. NULL, if there was an error.
- *         The structure will be created dynamically, to free the data call UcsXml_FreeVal.
- */
-UcsXmlVal_t *UcsXml_Parse(const char *xmlString);
-
-/**
- * \brief Frees the given structure, generated by UcsXml_Parse. 
- *
- * \note In case of errors the callback UcsXml_CB_OnError will be raised.
- * \param val - The structure to be freed.
- */
-void UcsXml_FreeVal(UcsXmlVal_t *val);
-
-/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
-/*                        CALLBACK SECTION                              */
-/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
-
-/**
- * \brief Callback whenever a parser error occurs. The message is human readable.
- * \note This function must be implemented by the integrator.
- *
- * \param format - Zero terminated format string (following printf rules)
- * \param vargsCnt - Amount of parameters stored in "..."
- */
-extern void UcsXml_CB_OnError(const char format[], uint16_t vargsCnt, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
+/*------------------------------------------------------------------------------------------------*/\r
+/* Unicens XML Parser                                                                             */\r
+/* Copyright 2017, Microchip Technology Inc. and its subsidiaries.                                */\r
+/*                                                                                                */\r
+/* Redistribution and use in source and binary forms, with or without                             */\r
+/* modification, are permitted provided that the following conditions are met:                    */\r
+/*                                                                                                */\r
+/* 1. Redistributions of source code must retain the above copyright notice, this                 */\r
+/*    list of conditions and the following disclaimer.                                            */\r
+/*                                                                                                */\r
+/* 2. Redistributions in binary form must reproduce the above copyright notice,                   */\r
+/*    this list of conditions and the following disclaimer in the documentation                   */\r
+/*    and/or other materials provided with the distribution.                                      */\r
+/*                                                                                                */\r
+/* 3. Neither the name of the copyright holder nor the names of its                               */\r
+/*    contributors may be used to endorse or promote products derived from                        */\r
+/*    this software without specific prior written permission.                                    */\r
+/*                                                                                                */\r
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"                    */\r
+/* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE                      */\r
+/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE                 */\r
+/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE                   */\r
+/* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL                     */\r
+/* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR                     */\r
+/* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER                     */\r
+/* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,                  */\r
+/* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE                  */\r
+/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */\r
+/*------------------------------------------------------------------------------------------------*/\r
+#ifndef UCSXML_H_\r
+#define UCSXML_H_\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#include <stdbool.h>\r
+#include <stdint.h>\r
+#include "ucs_api.h"\r
+\r
+/** Structure holding informations to startup Unicens (UCS).\r
+ *  Pass all these variables to the UCS manager structure, but not pInternal.\r
+ *  */\r
+typedef struct\r
+{\r
+    /** The amount of bytes assigned to the async channel*/\r
+    uint16_t packetBw;\r
+    /** Array of routes */\r
+    Ucs_Rm_Route_t *pRoutes;\r
+    /** Route array size */\r
+    uint16_t routesSize;\r
+    /** Array of nodes */\r
+    Ucs_Rm_Node_t *pNod;\r
+    /** Node array size */\r
+    uint16_t nodSize;\r
+    /** Internal data, to be ignored */\r
+    void *pInternal;\r
+} UcsXmlVal_t;\r
+\r
+/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/\r
+/*                            Public API                                */\r
+/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/\r
+\r
+/**\r
+ * \brief Initializes Unicens XML parser module, parses the given string and\r
+ *        generate the data needed to run Unicens (UCS) library.\r
+ *\r
+ * \note In case of errors the callback UcsXml_CB_OnError will be raised.\r
+ * \param xmlString - Zero terminated XML string. The string will not be used\r
+ *                    after this function call.\r
+ * \return Structure holding the needed data for UCS. NULL, if there was an error.\r
+ *         The structure will be created dynamically, to free the data call UcsXml_FreeVal.\r
+ */\r
+UcsXmlVal_t *UcsXml_Parse(const char *xmlString);\r
+\r
+/**\r
+ * \brief Frees the given structure, generated by UcsXml_Parse.\r
+ *\r
+ * \note In case of errors the callback UcsXml_CB_OnError will be raised.\r
+ * \param val - The structure to be freed.\r
+ */\r
+void UcsXml_FreeVal(UcsXmlVal_t *val);\r
+\r
+/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/\r
+/*                        CALLBACK SECTION                              */\r
+/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/\r
+\r
+/**\r
+ * \brief Callback whenever a parser error occurs. The message is human readable.\r
+ * \note This function must be implemented by the integrator.\r
+ *\r
+ * \param format - Zero terminated format string (following printf rules)\r
+ * \param vargsCnt - Amount of parameters stored in "..."\r
+ */\r
+extern void UcsXml_CB_OnError(const char format[], uint16_t vargsCnt, ...);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
 #endif /* UCSXML_H_ */
\ No newline at end of file