Finished draft HAL integration for lights type only

This commit is contained in:
bwssystems
2016-05-21 16:49:12 -05:00
parent 8a468b8352
commit e43473734e
6 changed files with 69 additions and 19 deletions

View File

@@ -10,6 +10,7 @@ import com.bwssystems.HABridge.hue.HueMulator;
import com.bwssystems.HABridge.upnp.UpnpListener;
import com.bwssystems.HABridge.upnp.UpnpSettingsResource;
import com.bwssystems.NestBridge.NestHome;
import com.bwssystems.hal.HalHome;
import com.bwssystems.harmony.HarmonyHome;
import com.bwssystems.hue.HueHome;
@@ -36,6 +37,7 @@ public class HABridge {
HarmonyHome harmonyHome;
NestHome nestHome;
HueHome hueHome;
HalHome halHome;
HueMulator theHueMulator;
UpnpSettingsResource theSettingResponder;
UpnpListener theUpnpListener;
@@ -66,8 +68,10 @@ public class HABridge {
nestHome = new NestHome(bridgeSettings.getBridgeSettingsDescriptor());
//setup the hue passtrhu configuration if available
hueHome = new HueHome(bridgeSettings.getBridgeSettingsDescriptor());
//setup the hal configuration if available
halHome = new HalHome(bridgeSettings.getBridgeSettingsDescriptor());
// setup the class to handle the resource setup rest api
theResources = new DeviceResource(bridgeSettings.getBridgeSettingsDescriptor(), harmonyHome, nestHome, hueHome);
theResources = new DeviceResource(bridgeSettings.getBridgeSettingsDescriptor(), harmonyHome, nestHome, hueHome, halHome);
// setup the class to handle the hue emulator rest api
theHueMulator = new HueMulator(bridgeSettings.getBridgeSettingsDescriptor(), theResources.getDeviceRepository(), harmonyHome, nestHome, hueHome);
theHueMulator.setupServer();

View File

@@ -44,7 +44,7 @@ public class DeviceResource {
private HalHome halHome;
private static final Set<String> supportedVerbs = new HashSet<>(Arrays.asList("get", "put", "post"));
public DeviceResource(BridgeSettingsDescriptor theSettings, HarmonyHome theHarmonyHome, NestHome aNestHome, HueHome aHueHome) {
public DeviceResource(BridgeSettingsDescriptor theSettings, HarmonyHome theHarmonyHome, NestHome aNestHome, HueHome aHueHome, HalHome aHalHome) {
this.deviceRepository = new DeviceRepository(theSettings.getUpnpDeviceDb());
if(theSettings.isValidVera())
@@ -68,7 +68,7 @@ public class DeviceResource {
this.hueHome = null;
if(theSettings.isValidHal())
this.hueHome = aHueHome;
this.halHome = aHalHome;
else
this.halHome = null;

View File

@@ -21,7 +21,7 @@ public class HalHome {
hals = new HashMap<String, HalInfo>();
if(!bridgeSettings.isValidHal())
return;
Iterator<NamedIP> theList = bridgeSettings.getHarmonyAddress().getDevices().iterator();
Iterator<NamedIP> theList = bridgeSettings.getHaladdress().getDevices().iterator();
while(theList.hasNext()) {
NamedIP aHal = theList.next();
try {

View File

@@ -221,6 +221,9 @@ public final class TextStringFormatter {
public static String forQuerySpace(String aURL) {
return aURL.replace(" ", "\u0020");
}
public static String forQuerySpaceUrl(String aURL) {
return aURL.replace(" ", "%20");
}
/**
* Synonym for <tt>URLEncoder.encode(String, "UTF-8")</tt>.
*