Updated upnp response listener code. Updated hue api. Updated input

areas for urls to be textareas to handle long strings. Added sorting to
all lists.
This commit is contained in:
Admin
2015-08-31 16:44:38 -05:00
parent eee0394f20
commit 6c99358f95
10 changed files with 130 additions and 43 deletions

View File

@@ -44,7 +44,7 @@ public class HueMulator {
public HueMulator(DeviceRepository aDeviceRepository){
httpClient = HttpClients.createMinimal();
httpClient = HttpClients.createDefault();
mapper = new ObjectMapper(); //armzilla: work around Echo incorrect content type and breaking mapping. Map manually
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
repository = aDeviceRepository;

View File

@@ -63,14 +63,8 @@ public class UpnpListener {
DatagramPacket packet = new DatagramPacket(buf, buf.length);
upnpMulticastSocket.receive(packet);
String packetString = new String(packet.getData());
log.debug("Got SSDP packet from " + packet.getAddress().getHostAddress() + ":" + packet.getPort() + " body : " + packetString);
if(isSSDPDiscovery(packetString)){
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
log.error("could not sleep");
}
log.debug("Got SSDP Discovery packet from " + packet.getAddress().getHostAddress() + ":" + packet.getPort());
sendUpnpResponse(responseSocket, packet.getAddress(), packet.getPort());
}
}
@@ -91,7 +85,8 @@ public class UpnpListener {
protected boolean isSSDPDiscovery(String body){
// log.debug("Check if this is a MAN ssdp-discover packet for a upnp basic device: " + body);
//Only respond to discover request for upnp basic device from echo, the others are for the wemo
if(body != null && body.startsWith("M-SEARCH * HTTP/1.1") && body.contains("MAN: \"ssdp:discover\"")&& body.contains("ST: urn:schemas-upnp-org:device:basic:1")){
// other check: && body.contains("ST: urn:schemas-upnp-org:device:basic:1")
if(body != null && body.startsWith("M-SEARCH * HTTP/1.1") && body.contains("MAN: \"ssdp:discover\"")){
return true;
}
return false;