From: rtrimana Date: Fri, 2 Mar 2018 21:57:05 +0000 (-0800) Subject: Minor adjustments/cleanups for SpeakerController application X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=commitdiff_plain;h=058289ead2515827d0d8ac324f045bf36aa522e1;ds=sidebyside Minor adjustments/cleanups for SpeakerController application --- diff --git a/benchmarks/Java/SpeakerController/SpeakerController.java b/benchmarks/Java/SpeakerController/SpeakerController.java index 00b6dba..9a5cc83 100644 --- a/benchmarks/Java/SpeakerController/SpeakerController.java +++ b/benchmarks/Java/SpeakerController/SpeakerController.java @@ -150,27 +150,19 @@ public class SpeakerController extends UnicastRemoteObject implements GPSGateway // Get the speaker objects one by one assuming that we could have // more than one speaker per room for (SpeakerSmart speakers : roomSpeakerRel.get(room)) { - // System.out.println("DEBUG: Turn on speaker!"); - - //try { - - // start the speaker playback if the speaker is not playing yet - if (!speakers.getPlaybackState()) { - - System.out.println("Turning a speaker On in room: " + room.getRoomID()); - speakers.startPlayback(); - speakers.setPosition(currentPosition); - - } else { - // get average of the positions - currPosTotal += speakers.getPosition(); - currPosCount++; - } - - - //} catch (RemoteException e) { - // e.printStackTrace(); - //} + System.out.println("DEBUG: Turn on speaker!"); + // start the speaker playback if the speaker is not playing yet + if (!speakers.getPlaybackState()) { + + System.out.println("Turning a speaker On in room: " + room.getRoomID()); + speakers.startPlayback(); + speakers.setPosition(currentPosition); + + } else { + // get average of the positions + currPosTotal += speakers.getPosition(); + currPosCount++; + } } if (currPosCount != 0) { @@ -183,11 +175,7 @@ public class SpeakerController extends UnicastRemoteObject implements GPSGateway // we were kind of far so update all the positions for (SpeakerSmart speakers : roomSpeakerRel.get(room)) { - //try { - speakers.setPosition(currentPosOfSpeakers); - //} catch (RemoteException e) { - // e.printStackTrace(); - //} + speakers.setPosition(currentPosOfSpeakers); } } @@ -253,15 +241,15 @@ public class SpeakerController extends UnicastRemoteObject implements GPSGateway // If we have new data, we update the speaker streaming if (newDataAvailable.get()) { - // System.out.println("DEBUG: New data is available!!!"); - // System.out.println("DEBUG: Ring status: " + ringStatus); + System.out.println("DEBUG: New data is available!!!"); + System.out.println("DEBUG: Ring status: " + ringStatus); // Check for ring status first if (ringStatus) { // Turn off all speakers if ring status is true (phone is ringing) for (RoomSmart room : audioRooms.values()) { - // System.out.println("DEBUG: Update status off for speakers! Phone is ringing!!!"); + System.out.println("DEBUG: Update status off for speakers! Phone is ringing!!!"); // Turn off speaker roomSpeakersOnOffStatus.put(room, false); } @@ -272,27 +260,22 @@ public class SpeakerController extends UnicastRemoteObject implements GPSGateway // Check for every room for (RoomSmart room : audioRooms.values()) { - //try { - // Turn on the right speaker based on room ID sent from phone app - // Stream audio to a speaker based on room ID - if (room.getRoomID() == roomIdentifier) { + // Turn on the right speaker based on room ID sent from phone app + // Stream audio to a speaker based on room ID + if (room.getRoomID() == roomIdentifier) { - // System.out.println("DEBUG: This room ID: " + room.getRoomID()); - // System.out.println("DEBUG: Turn on the speaker(s) in this room!!!"); - // Set speaker status to on - roomSpeakersOnOffStatus.put(room, true); + System.out.println("DEBUG: This room ID: " + room.getRoomID()); + System.out.println("DEBUG: Turn on the speaker(s) in this room!!!"); + // Set speaker status to on + roomSpeakersOnOffStatus.put(room, true); - } else { - // for the rooms whose IDs aren't equal to roomIdentifier + } else { + // for the rooms whose IDs aren't equal to roomIdentifier - // System.out.println("DEBUG: Turn on speaker!"); - // Set speaker status to off - roomSpeakersOnOffStatus.put(room, false); - } - - //} catch (RemoteException ex) { - // ex.printStackTrace(); - //} + System.out.println("DEBUG: Turn on speaker!"); + // Set speaker status to off + roomSpeakersOnOffStatus.put(room, false); + } } } // Finish processing data - put this back to false @@ -407,14 +390,9 @@ public class SpeakerController extends UnicastRemoteObject implements GPSGateway // Setup the cameras, start them all and assign each one a motion detector for (GPSGatewaySmart gw : gpsSet.values()) { - //try { - // initialize, register callback, and start the gateway - gw.init(); - gw.registerCallback(this); - gw.start(); - //} catch (RemoteException ex) { - // ex.printStackTrace(); - //} + gw.init(); + gw.registerCallback(this); + gw.start(); } diff --git a/benchmarks/other/PhoneInterface/SpeakerLocator/app/src/main/res/values/strings.xml b/benchmarks/other/PhoneInterface/SpeakerLocator/app/src/main/res/values/strings.xml index d05272a..edc98d6 100644 --- a/benchmarks/other/PhoneInterface/SpeakerLocator/app/src/main/res/values/strings.xml +++ b/benchmarks/other/PhoneInterface/SpeakerLocator/app/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ SpeakerLocator Settings - 192.168.2.191 + 192.168.1.191 b0:b9:8a:73:69:f4 b0:b9:8a:73:69:f3 00:24:98:9a:92:ef