From eecf0f9875f249609705cdd3c0c938ead0a962e3 Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 2 Sep 2015 16:42:40 -0500 Subject: [PATCH] ADded more for editing special get/put/post and started addimg more to bridge settings in UI. --- pom.xml | 2 +- .../bwssystems/HABridge/BridgeSettings.java | 6 +-- src/main/resources/public/index.html | 2 +- src/main/resources/public/scripts/app.js | 38 +++++++++++++++---- .../resources/public/views/editdevice.html | 34 +++++++++++++++++ 5 files changed, 70 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 63c34e5..0869e31 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 0.4.1 + 0.4.2 jar HA Bridge diff --git a/src/main/java/com/bwssystems/HABridge/BridgeSettings.java b/src/main/java/com/bwssystems/HABridge/BridgeSettings.java index 1e0757b..865de8c 100644 --- a/src/main/java/com/bwssystems/HABridge/BridgeSettings.java +++ b/src/main/java/com/bwssystems/HABridge/BridgeSettings.java @@ -6,7 +6,7 @@ public class BridgeSettings { private String upnpresponseport; private String upnpdevicedb; private String veraaddress; - private boolean upnpStrict; + private boolean upnpstrict; private boolean traceupnp; private boolean vtwocompatibility; @@ -42,10 +42,10 @@ public class BridgeSettings { } public boolean isUpnpStrict() { - return upnpStrict; + return upnpstrict; } public void setUpnpStrict(boolean upnpStrict) { - this.upnpStrict = upnpStrict; + this.upnpstrict = upnpStrict; } public boolean isTraceupnp() { return traceupnp; diff --git a/src/main/resources/public/index.html b/src/main/resources/public/index.html index 60dfe3f..a752c56 100644 --- a/src/main/resources/public/index.html +++ b/src/main/resources/public/index.html @@ -36,7 +36,7 @@ diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index cf6cd68..0871caa 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -36,6 +36,9 @@ app.factory('BridgeSettings', function() { BridgeSettings.upnpdevicedb = ""; BridgeSettings.upnpresponseport = ""; BridgeSettings.veraaddress = ""; + BridgeSettings.upnpstrict = ""; + BridgeSettings.traceupnp = ""; + BridgeSettings.vtwocompatibility = ""; BridgeSettings.setupnpconfigaddress = function(aconfigaddress){ BridgeSettings.upnpconfigaddress = aconfigaddress; @@ -56,6 +59,15 @@ app.factory('BridgeSettings', function() { BridgeSettings.setveraaddress = function(averaaddress){ BridgeSettings.veraaddress = averaaddress; }; + BridgeSettings.setupnpstrict = function(aupnpstrict){ + BridgeSettings.upnpstrict = aupnpstrict; + }; + BridgeSettings.settraceupnp = function(atraceupnp){ + BridgeSettings.traceupnp = atraceupnp; + }; + BridgeSettings.setvtwocompatibility = function(avtwocompatibility){ + BridgeSettings.vtwocompatibility = avtwocompatibility; + }; return BridgeSettings; }); @@ -92,6 +104,9 @@ app.service('bridgeService', function ($http, BridgeSettings) { self.BridgeSettings.setupnpdevicedb(response.data.upnpdevicedb); self.BridgeSettings.setupnpresponseport(response.data.upnpresponseport); self.BridgeSettings.setveraaddress(response.data.veraaddress); + self.BridgeSettings.settraceupnp(response.data.traceupnp); + self.BridgeSettings.setupnpstrict(response.data.upnpstrict); + self.BridgeSettings.setvtwocompatibility(response.data.vtwocompatibility); }, function (error) { if (error.data) { @@ -141,7 +156,7 @@ app.service('bridgeService', function ($http, BridgeSettings) { ); }; - this.addDevice = function (id, name, type, onUrl, offUrl) { + this.addDevice = function (id, name, type, onUrl, offUrl, httpVerb, contentType, contentBody) { this.state.error = ""; if (id) { var putUrl = this.state.base + "/" + id; @@ -150,7 +165,10 @@ app.service('bridgeService', function ($http, BridgeSettings) { name: name, deviceType: type, onUrl: onUrl, - offUrl: offUrl + offUrl: offUrl, + httpVerb: httpVerb, + contentType: contentType, + contentBody: contentBody }).then( function (response) { self.viewDevices(); @@ -167,7 +185,10 @@ app.service('bridgeService', function ($http, BridgeSettings) { name: name, deviceType: type, onUrl: onUrl, - offUrl: offUrl + offUrl: offUrl, + httpVerb: httpVerb, + contentType: contentType, + contentBody: contentBody }).then( function (response) { self.viewDevices(); @@ -197,8 +218,8 @@ app.service('bridgeService', function ($http, BridgeSettings) { ); }; - this.editDevice = function (id, name, onUrl, offUrl) { - self.state.device = {id: id, name: name, onUrl: onUrl, offUrl: offUrl}; + this.editDevice = function (id, name, onUrl, offUrl, httpVerb, contentType, contentBody) { + self.state.device = {id: id, name: name, onUrl: onUrl, offUrl: offUrl, httpVerb: httpVerb, contentType: contentType, contentBody: contentBody}; }; }); @@ -224,7 +245,7 @@ app.controller('ViewingController', function ($scope, $location, bridgeService, bridgeService.viewDevices(); }; $scope.editDevice = function (device) { - bridgeService.editDevice(device.id, device.name, device.onUrl, device.offUrl); + bridgeService.editDevice(device.id, device.name, device.onUrl, device.offUrl, device.httpVerb, device.contentType, device.contentBody); $location.path('/editdevice'); }; }); @@ -303,13 +324,16 @@ app.controller('AddingController', function ($scope, bridgeService, BridgeSettin }; $scope.addDevice = function () { - bridgeService.addDevice($scope.device.id, $scope.device.name, $scope.device.deviceType, $scope.device.onUrl, $scope.device.offUrl).then( + bridgeService.addDevice($scope.device.id, $scope.device.name, $scope.device.deviceType, $scope.device.onUrl, $scope.device.offUrl, $scope.device.httpVerb, $scope.device.contentType, $scope.device.contentBody).then( function () { $scope.device.id = ""; $scope.device.name = ""; $scope.device.onUrl = ""; $scope.device.deviceType = "switch"; $scope.device.offUrl = ""; + $scope.device.httpVerb = ""; + $scope.device.contentType = ""; + $scope.device.contentBody = ""; }, function (error) { } diff --git a/src/main/resources/public/views/editdevice.html b/src/main/resources/public/views/editdevice.html index e93b858..4741cbd 100644 --- a/src/main/resources/public/views/editdevice.html +++ b/src/main/resources/public/views/editdevice.html @@ -52,6 +52,40 @@ ng-click="testUrl(device.offUrl)">Test +
+
+ + +
+ +
+
+
+
+
+ + +
+ +
+
+
+
+
+ + +
+ +
+
+
+