mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 00:10:20 +00:00
ADded more for editing special get/put/post and started addimg more to
bridge settings in UI.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.bwssystems.HABridge</groupId>
|
||||
<artifactId>ha-bridge</artifactId>
|
||||
<version>0.4.1</version>
|
||||
<version>0.4.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li><a href="http://www.bwssystems.com" target="_blank">Developed by BWS Systems</a></li>
|
||||
<li><a href="http://www.amazon.com/echo" target="_blank">Amazon Echo</a></li>
|
||||
<li><a href="#">HA Bridge Version 0.4.1</a></li>
|
||||
<li><a href="#">HA Bridge Version 0.4.2</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
@@ -52,6 +52,40 @@
|
||||
ng-click="testUrl(device.offUrl)">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-http-verb">Http Verb
|
||||
</label>
|
||||
|
||||
<div class="col-xs-8 col-sm-7">
|
||||
<input type="text" class="form-control" id="device-http-verb"
|
||||
ng-model="device.httpVerb" placeholder="Http Verb, i.e. GET/PUT/POST">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<label class="col-xs-12 col-sm-2 control-label" for="device-content-type">Name
|
||||
</label>
|
||||
|
||||
<div class="col-xs-8 col-sm-7">
|
||||
<input type="text" class="form-control" id="device-content-type"
|
||||
ng-model="device.contentType" placeholder="Content type, i.e. application/json">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<label class="col-xs-12 col-sm-2 control-label"
|
||||
for="device-content-body">Content Body </label>
|
||||
|
||||
<div class="col-xs-8 col-sm-7">
|
||||
<textarea rows="3" class="form-control" id="device-content-body"
|
||||
ng-model="device.contentBody" placeholder="Content Body for specific GET/PUT/POST type"></textarea>
|
||||
</div>
|
||||
<div class="clearfix visible-xs"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user