summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-09-18 11:54:58 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-09-27 14:44:43 +0800
commitc44bb7286b88ffdeb81b8cabff9a2b1e211369e9 (patch)
tree0b5ee27e148fdfecb6ab877dbc6400d9ad75ac3a
parent53e81f3c04043a36a2b6965876b5faaf1524feb4 (diff)
binding: hvac: add initial binding
This is the split out binding from the HVAC package. Bug-AGL: SPEC-1757 Change-Id: If8499ac811491fac204a213768f27f584dd996e1 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--.gitmodules3
-rw-r--r--.gitreview5
-rw-r--r--CMakeLists.txt21
-rw-r--r--LICENSE54
-rw-r--r--binding/CMakeLists.txt35
-rw-r--r--binding/hvac-demo-binding.c798
m---------conf.d/app-templates0
-rwxr-xr-xconf.d/autobuild/agl/autobuild60
-rwxr-xr-xconf.d/autobuild/linux/autobuild60
-rw-r--r--conf.d/cmake/config.cmake148
-rw-r--r--conf.d/wgt/config.xml.in23
11 files changed, 1207 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..b545da1
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "conf.d/app-templates"]
+ path = conf.d/app-templates
+ url = https://gerrit.automotivelinux.org/gerrit/apps/app-templates
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..a0bec2a
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.automotivelinux.org
+port=29418
+project=apps/agl-service-hvac
+defaultbranch=master
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b485097
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,21 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
+
+include(${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/config.cmake)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..31c692a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,54 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
diff --git a/binding/CMakeLists.txt b/binding/CMakeLists.txt
new file mode 100644
index 0000000..96de16d
--- /dev/null
+++ b/binding/CMakeLists.txt
@@ -0,0 +1,35 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+# contrib: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Add target to project dependency list
+PROJECT_TARGET_ADD(afm-hvac-binding)
+
+ # Define project Targets
+ add_library(afm-hvac-binding MODULE hvac-demo-binding.c)
+
+ # Binder exposes a unique public entry point
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ PREFIX "lib"
+ LABELS "BINDING"
+ LINK_FLAGS ${BINDINGS_LINK_FLAG}
+ OUTPUT_NAME ${TARGET_NAME}
+ )
+
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(${TARGET_NAME} ${link_libraries})
diff --git a/binding/hvac-demo-binding.c b/binding/hvac-demo-binding.c
new file mode 100644
index 0000000..ec09472
--- /dev/null
+++ b/binding/hvac-demo-binding.c
@@ -0,0 +1,798 @@
+/*
+ * Copyright (C) 2015, 2016 "IoT.bzh"
+ * Copyright (C) 2016 Konsulko Group
+ * Author "Romain Forlot"
+ * Author "Jose Bolo"
+ * Author "Scott Murray <scott.murray@konsulko.com>"
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <linux/can.h>
+#include <math.h>
+#include <json-c/json.h>
+
+#define AFB_BINDING_VERSION 2
+#include <afb/afb-binding.h>
+
+#define RED "/sys/class/leds/blinkm-3-9-red/brightness"
+#define GREEN "/sys/class/leds/blinkm-3-9-green/brightness"
+#define BLUE "/sys/class/leds/blinkm-3-9-blue/brightness"
+
+#define CAN_DEV "vcan0"
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+static const struct afb_binding_interface *interface;
+static struct afb_event event;
+
+/*****************************************************************************************/
+/*****************************************************************************************/
+/** **/
+/** **/
+/** SECTION: UTILITY FUNCTIONS **/
+/** **/
+/** **/
+/*****************************************************************************************/
+/*****************************************************************************************/
+
+/*
+ * @brief Retry a function 3 times
+ *
+ * @param int function(): function that return an int wihtout any parameter
+ *
+ * @ return : 0 if ok, -1 if failed
+ *
+ */
+static int retry( int(*func)())
+{
+ int i;
+
+ for (i=0;i<4;i++)
+ {
+ if ( (*func)() >= 0)
+ {
+ return 0;
+ }
+ usleep(100000);
+ }
+ return -1;
+}
+
+/*****************************************************************************************/
+/*****************************************************************************************/
+/** **/
+/** **/
+/** SECTION: HANDLE CAN DEVICE **/
+/** **/
+/** **/
+/*****************************************************************************************/
+/*****************************************************************************************/
+
+// Initialize CAN hvac array that will be sent trough the socket
+static struct {
+ const char *name;
+ uint8_t value;
+} hvac_values[] = {
+ { "LeftTemperature", 21 },
+ { "RightTemperature", 21 },
+ { "Temperature", 21 },
+ { "FanSpeed", 0 },
+ { "ACEnabled", 0 },
+ { "LeftLed", 15 },
+ { "RightLed", 15 }
+};
+
+// Holds RGB combinations for each temperature
+static struct {
+ const int temperature;
+ const int rgb[3];
+} degree_colours[] = {
+ {15, {0, 0, 229} },
+ {16, {22, 0, 204} },
+ {17, {34, 0, 189} },
+ {18, {46, 0, 175} },
+ {19, {58, 0, 186} },
+ {20, {70, 0, 146} },
+ {21, {82, 0, 131} },
+ {22, {104, 0, 116} },
+ {23, {116, 0, 102} },
+ {24, {128, 0, 87} },
+ {25, {140, 0, 73} },
+ {26, {152, 0, 58} },
+ {27, {164, 0, 43} },
+ {28, {176, 0, 29} },
+ {29, {188, 0, 14} },
+ {30, {201, 0, 5} }
+};
+
+struct can_handler {
+ int socket;
+ bool simulation;
+ char *send_msg;
+ struct sockaddr_can txAddress;
+};
+
+struct led_paths {
+ char *red;
+ char *green;
+ char *blue;
+}led_paths_values = {
+ .red = RED,
+ .green = GREEN,
+ .blue = BLUE
+};
+
+static struct can_handler can_handler = { .socket = -1, .simulation = false, .send_msg = "SENDING CAN FRAME"};
+
+static int open_can_dev_helper()
+{
+ struct ifreq ifr;
+
+ AFB_DEBUG("CAN Handler socket : %d", can_handler.socket);
+ close(can_handler.socket);
+
+ can_handler.socket = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+ if (can_handler.socket < 0)
+ {
+ AFB_ERROR("socket could not be created");
+ }
+ else
+ {
+ // Attempts to open a socket to CAN bus
+ strcpy(ifr.ifr_name, CAN_DEV);
+ if(ioctl(can_handler.socket, SIOCGIFINDEX, &ifr) < 0)
+ {
+ AFB_ERROR("ioctl failed");
+ }
+ else
+ {
+ can_handler.txAddress.can_family = AF_CAN;
+ can_handler.txAddress.can_ifindex = ifr.ifr_ifindex;
+
+ // And bind it to txAddress
+ if (bind(can_handler.socket, (struct sockaddr *)&can_handler.txAddress, sizeof(can_handler.txAddress)) < 0)
+ {
+ AFB_ERROR("bind failed");
+ }
+ else {
+ return 0;
+ }
+ }
+ close(can_handler.socket);
+ can_handler.socket = -1;
+ }
+ return -1;
+}
+
+static int open_can_dev()
+{
+ int rc = retry(open_can_dev_helper);
+ if(rc < 0)
+ {
+ AFB_ERROR("Open of interface %s failed. Falling back to simulation mode", CAN_DEV);
+ can_handler.socket = 0;
+ can_handler.simulation = true;
+ can_handler.send_msg = "FAKE CAN FRAME";
+ rc = 0;
+ }
+ return rc;
+}
+
+// Get original get temperature function from cpp hvacplugin code
+static uint8_t to_can_temp(uint8_t value)
+{
+ int result = ((0xF0 - 0x10) / 15) * (value - 15) + 0x10;
+ if (result < 0x10)
+ result = 0x10;
+ if (result > 0xF0)
+ result = 0xF0;
+
+ return (uint8_t)result;
+}
+
+static uint8_t read_temp_left_zone()
+{
+ return hvac_values[0].value;
+}
+
+static uint8_t read_temp_right_zone()
+{
+ return hvac_values[1].value;
+}
+
+static uint8_t read_temp_left_led()
+{
+ return hvac_values[5].value;
+}
+
+static uint8_t read_temp_right_led()
+{
+ return hvac_values[6].value;
+}
+
+static uint8_t read_temp()
+{
+ return (uint8_t)(((int)read_temp_left_zone() + (int)read_temp_right_zone()) >> 1);
+}
+
+static uint8_t read_fanspeed()
+{
+ return hvac_values[3].value;
+}
+
+/*
+ * @param: None
+ *
+ * @brief: Parse JSON configuration file for blinkm path
+ */
+static int parse_config()
+{
+ struct json_object *ledtemp = NULL;
+ struct json_object *jobj = json_object_from_file("/etc/hvac.json");
+
+ // Check if .json file has been parsed as a json_object
+ if (!jobj) {
+ AFB_ERROR("JSON file could not be opened!\n");
+ return 1;
+ }
+
+ // Check if json_object with key "ledtemp" has been found in .json file
+ if (!json_object_object_get_ex(jobj, "ledtemp", &ledtemp)){
+ AFB_ERROR("Key not found!\n");
+ return 1;
+ }
+
+ // Extract directory paths for each LED colour
+ json_object_object_foreach(ledtemp, key, value) {
+ if (strcmp(key, "red") == 0) {
+ led_paths_values.red = json_object_get_string(value);
+ } else if (strcmp(key, "green") == 0) {
+ led_paths_values.green = json_object_get_string(value);
+ } else if (strcmp(key, "blue") == 0) {
+ led_paths_values.blue = json_object_get_string(value);
+ }
+ }
+
+ // return 0 if all succeeded
+ return 0;
+
+}
+
+/*
+ * @brief Writing to LED for both temperature sliders
+ */
+static int temp_write_led()
+{
+
+ int rc = -1, red_value, green_value, blue_value;
+ int right_temp;
+ int left_temp;
+
+ left_temp = read_temp_left_led() - 15;
+ right_temp = read_temp_right_led() - 15;
+
+ // Calculates average colour value taken from the temperature toggles
+ red_value = (degree_colours[left_temp].rgb[0] + degree_colours[right_temp].rgb[0]) / 2;
+ green_value = (degree_colours[left_temp].rgb[1] + degree_colours[right_temp].rgb[1]) / 2;
+ blue_value = (degree_colours[left_temp].rgb[2] + degree_colours[right_temp].rgb[2]) / 2;
+
+ // default path: /sys/class/leds/blinkm-3-9-red/brightness
+ FILE* r = fopen(led_paths_values.red, "w");
+ if(r){
+ fprintf(r, "%d", red_value);
+ fclose(r);
+ } else {
+ AFB_ERROR("Unable to open red LED path!\n");
+ return -1;
+ }
+
+ // default path: /sys/class/leds/blinkm-3-9-green/brightness
+ FILE* g = fopen(led_paths_values.green, "w");
+ if(g){
+ fprintf(g, "%d", green_value);
+ fclose(g);
+ } else {
+ AFB_ERROR("Unable to open green LED path!\n");
+ return -1;
+ }
+
+ // default path: /sys/class/leds/blinkm-3-9-blue/brightness
+ FILE* b = fopen(led_paths_values.blue, "w");
+ if(b){
+ fprintf(b, "%d", blue_value);
+ fclose(b);
+ } else {
+ AFB_ERROR("Unable to open blue LED path!\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * @brief Get temperature of left toggle in HVAC system
+ *
+ * @param struct afb_req : an afb request structure
+ *
+ */
+static void temp_left_zone_led(struct afb_req request)
+{
+ int i = 5, rc, x, changed;
+ double d;
+ struct json_object *query, *val;
+ uint8_t values[sizeof hvac_values / sizeof *hvac_values];
+ uint8_t saves[sizeof hvac_values / sizeof *hvac_values];
+
+ AFB_WARNING("In temp_left_zone_led.");
+
+ query = afb_req_json(request);
+
+ /* records initial values */
+ AFB_WARNING("Records initial values");
+ values[i] = saves[i] = hvac_values[i].value;
+
+
+ if (json_object_object_get_ex(query, hvac_values[i].name, &val))
+ {
+ AFB_WARNING("Value of values[i] = %d", values[i]);
+ AFB_WARNING("We got it. Tests if it is an int or double.");
+ if (json_object_is_type(val, json_type_int)) {
+ x = json_object_get_int(val);
+ AFB_WARNING("We get an int: %d",x);
+ }
+ else if (json_object_is_type(val, json_type_double)) {
+ d = json_object_get_double(val);
+ x = (int)round(d);
+ AFB_WARNING("We get a double: %f => %d",d,x);
+ }
+ else {
+ afb_req_fail_f(request, "bad-request",
+ "argument '%s' isn't integer or double", hvac_values[i].name);
+ return;
+ }
+ if (x < 0 || x > 255)
+ {
+ afb_req_fail_f(request, "bad-request",
+ "argument '%s' is out of bounds", hvac_values[i].name);
+ return;
+ }
+ if (values[i] != x) {
+ values[i] = (uint8_t)x;
+ changed = 1;
+ AFB_WARNING("%s changed to %d", hvac_values[i].name,x);
+ }
+ }
+ else {
+ AFB_WARNING("%s not found in query!",hvac_values[i].name);
+ }
+
+
+ if (changed) {
+ hvac_values[i].value = values[i]; // update structure at line 102
+ AFB_WARNING("WRITE_LED: value: %d", hvac_values[i].value);
+ rc = temp_write_led();
+ if (rc >= 0)
+ afb_req_success(request, NULL, NULL);
+ else if (retry(temp_write_led)) {
+ /* restore initial values */
+ hvac_values[i].value = saves[i];
+ afb_req_fail(request, "error", "I2C error");
+ }
+ }
+}
+
+/*
+ * @brief Get temperature of right toggle in HVAC system
+ *
+ * @param struct afb_req : an afb request structure
+ *
+ */
+static void temp_right_zone_led(struct afb_req request)
+{
+ int i = 6, rc, x, changed;
+ double d;
+ struct json_object *query, *val;
+ uint8_t values[sizeof hvac_values / sizeof *hvac_values];
+ uint8_t saves[sizeof hvac_values / sizeof *hvac_values];
+
+ AFB_WARNING("In temp_right_zone_led.");
+
+ query = afb_req_json(request);
+
+ /* records initial values */
+ AFB_WARNING("Records initial values");
+ values[i] = saves[i] = hvac_values[i].value;
+
+
+ if (json_object_object_get_ex(query, hvac_values[i].name, &val))
+ {
+ AFB_WARNING("Value of values[i] = %d", values[i]);
+ AFB_WARNING("We got it. Tests if it is an int or double.");
+ if (json_object_is_type(val, json_type_int)) {
+ x = json_object_get_int(val);
+ AFB_WARNING("We get an int: %d",x);
+ }
+ else if (json_object_is_type(val, json_type_double)) {
+ d = json_object_get_double(val);
+ x = (int)round(d);
+ AFB_WARNING("We get a double: %f => %d",d,x);
+ }
+ else {
+ afb_req_fail_f(request, "bad-request",
+ "argument '%s' isn't integer or double", hvac_values[i].name);
+ return;
+ }
+ if (x < 0 || x > 255)
+ {
+ afb_req_fail_f(request, "bad-request",
+ "argument '%s' is out of bounds", hvac_values[i].name);
+ return;
+ }
+ if (values[i] != x) {
+ values[i] = (uint8_t)x;
+ changed = 1;
+ AFB_WARNING("%s changed to %d", hvac_values[i].name,x);
+ }
+ }
+ else {
+ AFB_WARNING("%s not found in query!", hvac_values[i].name);
+ }
+
+
+ if (changed) {
+ hvac_values[i].value = values[i]; // update structure at line 102
+ AFB_WARNING("WRITE_LED: value: %d", hvac_values[i].value);
+ rc = temp_write_led();
+ if (rc >= 0)
+ afb_req_success(request, NULL, NULL);
+ else if (retry(temp_write_led)) {
+ /* restore initial values */
+ hvac_values[i].value = saves[i];
+ afb_req_fail(request, "error", "I2C error");
+ }
+ }
+}
+
+static int write_can()
+{
+ struct can_frame txCanFrame;
+ int rc = 0;
+
+ rc = can_handler.socket;
+ if (rc >= 0)
+ {
+ // Hardcoded can_id and dlc (data lenght code)
+ txCanFrame.can_id = 0x30;
+ txCanFrame.can_dlc = 8;
+ txCanFrame.data[0] = to_can_temp(read_temp_left_zone());
+ txCanFrame.data[1] = to_can_temp(read_temp_right_zone());
+ txCanFrame.data[2] = to_can_temp(read_temp());
+ txCanFrame.data[3] = 0xf0;
+ txCanFrame.data[4] = read_fanspeed();
+ txCanFrame.data[5] = 1;
+ txCanFrame.data[6] = 0;
+ txCanFrame.data[7] = 0;
+
+ AFB_DEBUG("%s: %d %d [%02x %02x %02x %02x %02x %02x %02x %02x]\n",
+ can_handler.send_msg,
+ txCanFrame.can_id, txCanFrame.can_dlc,
+ txCanFrame.data[0], txCanFrame.data[1], txCanFrame.data[2], txCanFrame.data[3],
+ txCanFrame.data[4], txCanFrame.data[5], txCanFrame.data[6], txCanFrame.data[7]);
+
+ if(!can_handler.simulation)
+ {
+ rc = (int)sendto(can_handler.socket, &txCanFrame, sizeof(struct can_frame), 0,
+ (struct sockaddr*)&can_handler.txAddress, sizeof(can_handler.txAddress));
+ if (rc < 0)
+ {
+ AFB_ERROR("Sending CAN frame failed.");
+ }
+ }
+ }
+ else
+ {
+ AFB_ERROR("socket not initialized. Attempt to reopen can device socket.");
+ open_can_dev();
+ }
+ return rc;
+}
+
+/*****************************************************************************************/
+/*****************************************************************************************/
+/** **/
+/** **/
+/** SECTION: BINDING VERBS IMPLEMENTATION **/
+/** **/
+/** **/
+/*****************************************************************************************/
+/*****************************************************************************************/
+
+/*
+ * @brief Get fan speed HVAC system
+ *
+ * @param struct afb_req : an afb request structure
+ *
+ */
+static void get_fanspeed(struct afb_req request)
+{
+ json_object *ret_json;
+ uint8_t fanspeed = read_fanspeed();
+
+ ret_json = json_object_new_object();
+ json_object_object_add(ret_json, "FanSpeed", json_object_new_int(fanspeed));
+
+ afb_req_success(request, ret_json, NULL);
+}
+
+/*
+ * @brief Read Consign right zone temperature for HVAC system
+ *
+ * @param struct afb_req : an afb request structure
+ *
+ */
+static void get_temp_right_zone(struct afb_req request)
+{
+ json_object *ret_json;
+ uint8_t temp = read_temp_right_zone();
+
+ ret_json = json_object_new_object();
+ json_object_object_add(ret_json, "RightTemperature", json_object_new_int(temp));
+
+ afb_req_success(request, ret_json, NULL);
+}
+
+/*
+ * @brief Read Consign left zone temperature for HVAC system
+ *
+ * @param struct afb_req : an afb request structure
+ *
+ */
+static void get_temp_left_zone(struct afb_req request)
+{
+ json_object *ret_json;
+ uint8_t temp = read_temp_left_zone();
+
+ ret_json = json_object_new_object();
+ json_object_object_add(ret_json, "LeftTemperature", json_object_new_int(temp));
+
+ afb_req_success(request, ret_json, NULL);
+}
+
+/*
+ * @brief Read all values
+ *
+ * @param struct afb_req : an afb request structure
+ *
+ */
+static void get(struct afb_req request)
+{
+ AFB_DEBUG("Getting all values");
+ json_object *ret_json;
+
+ ret_json = json_object_new_object();
+ json_object_object_add(ret_json, "LeftTemperature", json_object_new_int(read_temp_left_zone()));
+ json_object_object_add(ret_json, "RightTemperature", json_object_new_int(read_temp_right_zone()));
+ json_object_object_add(ret_json, "FanSpeed", json_object_new_int(read_fanspeed()));
+
+ afb_req_success(request, ret_json, NULL);
+}
+
+/*
+ * @brief Set a component value using a json object retrieved from request
+ *
+ * @param struct afb_req : an afb request structure
+ *
+ */
+static void set(struct afb_req request)
+{
+ int i, rc, x, changed;
+ double d;
+ struct json_object *query, *val;
+ uint8_t values[sizeof hvac_values / sizeof *hvac_values];
+ uint8_t saves[sizeof hvac_values / sizeof *hvac_values];
+
+ /* records initial values */
+ AFB_DEBUG("Records initial values");
+ i = (int)(sizeof hvac_values / sizeof *hvac_values);
+ while (i) {
+ i--;
+ values[i] = saves[i] = hvac_values[i].value;
+ }
+
+ /* Loop getting arguments */
+ query = afb_req_json(request);
+ changed = 0;
+ i = (int)(sizeof hvac_values / sizeof *hvac_values);
+ AFB_DEBUG("Looping for args. i: %d", i);
+ while (i)
+ {
+ i--;
+ AFB_DEBUG("Searching... query: %s, i: %d, comp: %s", json_object_to_json_string(query), i, hvac_values[i].name);
+ if (json_object_object_get_ex(query, hvac_values[i].name, &val))
+ {
+ AFB_DEBUG("We got it. Tests if it is an int or double.");
+ if (json_object_is_type(val, json_type_int)) {
+ x = json_object_get_int(val);
+ AFB_DEBUG("We get an int: %d",x);
+ }
+ else if (json_object_is_type(val, json_type_double)) {
+ d = json_object_get_double(val);
+ x = (int)round(d);
+ AFB_DEBUG("We get a double: %f => %d",d,x);
+ }
+ else {
+ afb_req_fail_f(request, "bad-request",
+ "argument '%s' isn't integer or double", hvac_values[i].name);
+ return;
+ }
+ if (x < 0 || x > 255)
+ {
+ afb_req_fail_f(request, "bad-request",
+ "argument '%s' is out of bounds", hvac_values[i].name);
+ return;
+ }
+ if (values[i] != x) {
+ values[i] = (uint8_t)x;
+ changed = 1;
+ AFB_DEBUG("%s changed to %d",hvac_values[i].name,x);
+ }
+ }
+ else {
+ AFB_DEBUG("%s not found in query!",hvac_values[i].name);
+ }
+ }
+
+ /* attemps to set new values */
+ AFB_DEBUG("Diff: %d", changed);
+ if (changed)
+ {
+ i = (int)(sizeof hvac_values / sizeof *hvac_values);
+ while (i) {
+ i--;
+ hvac_values[i].value = values[i];
+ }
+ rc = write_can();
+ if (rc >= 0)
+ afb_req_success(request, NULL, NULL);
+ else if (retry(write_can)) {
+ /* restore initial values */
+ i = (int)(sizeof hvac_values / sizeof *hvac_values);
+ while (i) {
+ i--;
+ hvac_values[i].value = saves[i];
+ }
+ afb_req_fail(request, "error", "CAN error");
+ }
+ }
+ else {
+ afb_req_success(request, NULL, "No changes");
+ }
+}
+
+int bindingServicePreInit(struct afb_service service)
+{
+ return open_can_dev();
+}
+
+int bindingServiceInit(struct afb_service service)
+{
+ event = afb_daemon_make_event("language");
+ if(parse_config() != 0)
+ AFB_WARNING("Default values are being used!\n");
+ if(afb_daemon_require_api("identity", 1))
+ return -1;
+ return afb_service_call_sync("identity", "subscribe", NULL, NULL);
+}
+
+void onEvent(const char *event_name, struct json_object *object)
+{
+ json_object *args, *language = json_object_new_object();
+ json_object *id_evt_name, *current_identity;
+
+ AFB_NOTICE("Event '%s' received: %s", event_name,
+ json_object_to_json_string_ext(object, JSON_C_TO_STRING_PRETTY));
+
+ if (json_object_object_get_ex(object, "eventName", &id_evt_name) &&
+ !strcmp(json_object_get_string(id_evt_name), "login") &&
+ !afb_service_call_sync("identity", "get", NULL, &current_identity)) {
+ json_object *response;
+ if (! json_object_object_get_ex(current_identity, "response", &response) || ! json_object_object_get_ex(response, "graphPreferredLanguage", &language)) {
+ language = json_object_new_string("en_US");
+ }
+ afb_event_broadcast(event, language);
+ }
+}
+
+// TODO: Have to change session management flag to AFB_SESSION_CHECK to use token auth
+static const struct afb_verb_v2 _afb_verbs_v2_hvac[]= {
+ {
+ .verb = "get_temp_left_zone",
+ .callback = get_temp_left_zone,
+ .auth = NULL,
+ .info = "Get the left zone temperature",
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "get_temp_right_zone",
+ .callback = get_temp_right_zone,
+ .auth = NULL,
+ .info = "Get the right zone temperature",
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "get_fanspeed",
+ .callback = get_fanspeed,
+ .auth = NULL,
+ .info = "Read fan speed",
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "get",
+ .callback = get,
+ .auth = NULL,
+ .info = "Read all speed",
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "set",
+ .callback = set,
+ .auth = NULL,
+ .info = "Set a HVAC component value",
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "temp_left_zone_led",
+ .callback = temp_left_zone_led,
+ .auth = NULL,
+ .info = "Turn on LED on left temperature zone",
+ .session = AFB_SESSION_NONE_V2
+ },
+ {
+ .verb = "temp_right_zone_led",
+ .callback = temp_right_zone_led,
+ .auth = NULL,
+ .info = "Turn on LED on left temperature zone",
+ .session = AFB_SESSION_NONE_V2
+
+ },
+ {
+ .verb = NULL,
+ .callback = NULL,
+ .auth = NULL,
+ .info = NULL,
+ .session = 0
+ }
+};
+
+const struct afb_binding_v2 afbBindingV2 = {
+ .api = "hvac",
+ .specification = NULL,
+ .info = "HVAC service",
+ .verbs = _afb_verbs_v2_hvac,
+ .preinit = bindingServicePreInit,
+ .init = bindingServiceInit,
+ .onevent = onEvent,
+ .noconcurrency = 0
+};
diff --git a/conf.d/app-templates b/conf.d/app-templates
new file mode 160000
+Subproject 76e12e76c7065fb3440312af3e54eae9d40c525
diff --git a/conf.d/autobuild/agl/autobuild b/conf.d/autobuild/agl/autobuild
new file mode 100755
index 0000000..759f6be
--- /dev/null
+++ b/conf.d/autobuild/agl/autobuild
@@ -0,0 +1,60 @@
+#!/usr/bin/make -f
+# Copyright (C) 2015, 2016 "IoT.bzh"
+# Author "Romain Forlot" <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+THISFILE := $(lastword $(MAKEFILE_LIST))
+BUILD_DIR := $(abspath $(dir $(THISFILE)/../../../../..)/build)
+DEST := ${BUILD_DIR}/target
+
+.PHONY: all clean distclean configure build package help
+
+all: help
+
+help:
+ @echo "List of targets available:"
+ @echo ""
+ @echo "- all"
+ @echo "- clean"
+ @echo "- distclean"
+ @echo "- configure"
+ @echo "- build"
+ @echo "- package"
+ @echo ""
+ @echo "Usage: ./conf.d/autobuild/agl/autobuild package DEST=${HOME}/opt"
+ @echo "Don't use your build dir as DEST as wgt file is generated at this location"
+
+clean:
+ @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean
+
+distclean:
+ @rm -rf ${BUILD_DIR}
+
+configure: ${BUILD_DIR}/Makefile
+
+build: configure
+ @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all
+
+package: build
+ @mkdir -p ${BUILD_DIR}/$@/bin
+ @mkdir -p ${BUILD_DIR}/$@/etc
+ @mkdir -p ${BUILD_DIR}/$@/lib
+ @mkdir -p ${BUILD_DIR}/$@/htdocs
+ @mkdir -p ${BUILD_DIR}/$@/data
+ @cmake --build ${BUILD_DIR} --target widget
+ @mkdir -p ${DEST} && cp ${BUILD_DIR}/*wgt ${DEST}
+
+${BUILD_DIR}/Makefile:
+ @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
+ @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..)
diff --git a/conf.d/autobuild/linux/autobuild b/conf.d/autobuild/linux/autobuild
new file mode 100755
index 0000000..759f6be
--- /dev/null
+++ b/conf.d/autobuild/linux/autobuild
@@ -0,0 +1,60 @@
+#!/usr/bin/make -f
+# Copyright (C) 2015, 2016 "IoT.bzh"
+# Author "Romain Forlot" <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+THISFILE := $(lastword $(MAKEFILE_LIST))
+BUILD_DIR := $(abspath $(dir $(THISFILE)/../../../../..)/build)
+DEST := ${BUILD_DIR}/target
+
+.PHONY: all clean distclean configure build package help
+
+all: help
+
+help:
+ @echo "List of targets available:"
+ @echo ""
+ @echo "- all"
+ @echo "- clean"
+ @echo "- distclean"
+ @echo "- configure"
+ @echo "- build"
+ @echo "- package"
+ @echo ""
+ @echo "Usage: ./conf.d/autobuild/agl/autobuild package DEST=${HOME}/opt"
+ @echo "Don't use your build dir as DEST as wgt file is generated at this location"
+
+clean:
+ @([ -d ${BUILD_DIR} ] && make -C ${BUILD_DIR} clean) || echo Nothing to clean
+
+distclean:
+ @rm -rf ${BUILD_DIR}
+
+configure: ${BUILD_DIR}/Makefile
+
+build: configure
+ @cmake --build ${BUILD_DIR} ${BUILD_ARGS} --target all
+
+package: build
+ @mkdir -p ${BUILD_DIR}/$@/bin
+ @mkdir -p ${BUILD_DIR}/$@/etc
+ @mkdir -p ${BUILD_DIR}/$@/lib
+ @mkdir -p ${BUILD_DIR}/$@/htdocs
+ @mkdir -p ${BUILD_DIR}/$@/data
+ @cmake --build ${BUILD_DIR} --target widget
+ @mkdir -p ${DEST} && cp ${BUILD_DIR}/*wgt ${DEST}
+
+${BUILD_DIR}/Makefile:
+ @[ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}
+ @[ -f ${BUILD_DIR}/Makefile ] || (cd ${BUILD_DIR} && cmake ${CONFIGURE_ARGS} ..)
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
new file mode 100644
index 0000000..23144f1
--- /dev/null
+++ b/conf.d/cmake/config.cmake
@@ -0,0 +1,148 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Project Info
+# ------------------
+set(PROJECT_NAME agl-service-hvac)
+set(PROJECT_PRETTY_NAME "AFM binding for HVAC interface")
+set(PROJECT_DESCRIPTION "Binding for HVAC interface")
+set(PROJECT_VERSION "1.0")
+set(PROJECT_ICON "icon.png")
+set(PROJECT_LICENSE "APL2.0")
+set(PROJECT_LANGUAGES,"C")
+
+# Where are stored default templates files from submodule or subtree app-templates in your project tree
+# relative to the root project directory
+set(PROJECT_APP_TEMPLATES_DIR "conf.d/app-templates")
+
+# Where are stored your external libraries for your project. This is 3rd party library that you don't maintain
+# but used and must be built and linked.
+# set(PROJECT_LIBDIR "libs")
+
+# Where are stored data for your application. Pictures, static resources must be placed in that folder.
+# set(PROJECT_RESOURCES "data")
+
+# Which directories inspect to find CMakeLists.txt target files
+# set(PROJECT_SRC_DIR_PATTERN "*")
+
+# Compilation Mode (DEBUG, RELEASE)
+# ----------------------------------
+set(CMAKE_BUILD_TYPE "RELEASE")
+
+# Kernel selection if needed. You can choose between a
+# mandatory version to impose a minimal version.
+# Or check Kernel minimal version and just print a Warning
+# about missing features and define a preprocessor variable
+# to be used as preprocessor condition in code to disable
+# incompatibles features. Preprocessor define is named
+# KERNEL_MINIMAL_VERSION_OK.
+#
+# NOTE*** FOR NOW IT CHECKS KERNEL Yocto environment and
+# Yocto SDK Kernel version.
+# -----------------------------------------------
+#set(kernel_mandatory_version 4.8)
+
+# Compiler selection if needed. Impose a minimal version.
+# -----------------------------------------------
+set (gcc_minimal_version 4.9)
+
+# PKG_CONFIG required packages
+# -----------------------------
+set (PKG_REQUIRED_LIST
+ json-c
+ libsystemd>=222
+ afb-daemon
+)
+
+# Customize link option
+# -----------------------------
+list (APPEND link_libraries -pthread)
+
+# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
+# ---------------------------------------------------------------------
+set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
+set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
+
+# Optional location for config.xml.in
+# -----------------------------------
+set(WIDGET_CONFIG_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/wgt/config.xml.in)
+
+# Mandatory widget Mimetype specification of the main unit
+# --------------------------------------------------------------------------
+# Choose between :
+#- text/html : HTML application,
+# content.src designates the home page of the application
+#
+#- application/vnd.agl.native : AGL compatible native,
+# content.src designates the relative path of the binary.
+#
+# - application/vnd.agl.service: AGL service, content.src is not used.
+#
+#- ***application/x-executable***: Native application,
+# content.src designates the relative path of the binary.
+# For such application, only security setup is made.
+#
+set(WIDGET_TYPE application/vnd.agl.service)
+
+# Mandatory Widget entry point file of the main unit
+# --------------------------------------------------------------
+# This is the file that will be executed, loaded,
+# at launch time by the application framework.
+#
+set(WIDGET_ENTRY_POINT lib/libafm-hvac-binding.so)
+
+# Print a helper message when every thing is finished
+# ----------------------------------------------------
+set(CLOSING_MESSAGE "Test with: afb-daemon --rootdir=\$\$(pwd)/package --binding=\$\$(pwd)/package/${WIDGET_ENTRY_POINT} --port=1234 --tracereq=common --token=\"1\" --verbose")
+set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")
+
+# Optional dependencies order
+# ---------------------------
+#set(EXTRA_DEPENDENCIES_ORDER)
+
+# Optional Extra global include path
+# -----------------------------------
+#set(EXTRA_INCLUDE_DIRS)
+
+# Optional extra libraries
+# -------------------------
+#set(EXTRA_LINK_LIBRARIES)
+
+# Optional force binding installation
+# ------------------------------------
+# set(BINDINGS_INSTALL_PREFIX PrefixPath )
+
+# Optional force binding Linking flag
+# ------------------------------------
+# set(BINDINGS_LINK_FLAG LinkOptions )
+
+# Optional force package prefix generation, like widget
+# -----------------------------------------------------
+# set(PKG_PREFIX DestinationPath)
+
+# Optional Application Framework security token
+# and port use for remote debugging.
+#------------------------------------------------------------
+#set(AFB_TOKEN "" CACHE PATH "Default AFB_TOKEN")
+#set(AFB_REMPORT "1234" CACHE PATH "Default AFB_TOKEN")
+
+# This include is mandatory and MUST happens at the end
+# of this file, else you expose you to unexpected behavior
+# -----------------------------------------------------------
+include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake)
diff --git a/conf.d/wgt/config.xml.in b/conf.d/wgt/config.xml.in
new file mode 100644
index 0000000..f95efb7
--- /dev/null
+++ b/conf.d/wgt/config.xml.in
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="@PROJECT_NAME@" version="@PROJECT_VERSION@">
+ <name>@PROJECT_NAME@</name>
+ <icon src="@PROJECT_ICON@"/>
+ <content src="@WIDGET_ENTRY_POINT@" type="@WIDGET_TYPE@"/>
+ <description>@PROJECT_DESCRIPTION@</description>
+ <author>@PROJECT_AUTHOR@ &lt;@PROJECT_AUTHOR_MAIL@&gt;</author>
+ <license>@PROJECT_LICENSE@</license>
+
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:hidden" value="required" />
+ <param name="urn:AGL:permission::public:no-htdocs" value="required" />
+ </feature>
+
+ <feature name="urn:AGL:widget:provided-api">
+ <param name="HVAC" value="ws" />
+ </feature>
+
+ <feature name="urn:AGL:widget:required-api">
+ <param name="identity" value="ws" />
+ <param name="@WIDGET_ENTRY_POINT@" value="local" />
+ </feature>
+</widget>