// 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) {
// 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);
}
}
// 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);
}
// 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
// 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();
}