Skip to content

Commit

Permalink
Hardcoded 192.168.1.2 for the server and 192.168.1.3 for testing and,…
Browse files Browse the repository at this point in the history
… possibly, demo. If I have multicast working reliably by Friday, I'll switch it over. Method defnitions have not changed, so those can be relied on by any other packages. The IP strings are just ignored by the method.
  • Loading branch information
pid1 committed Apr 27, 2015
1 parent 2e78879 commit 380858c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/server/server.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public String getDevicesFromEmail(String email) {
// Sends the desired temperature on port sendDesiredTempPORT
public void sendDesiredTemp(String desiredTemperature, String thermostatIP) throws Exception {
// Opens a sending port
Socket sender = new Socket(thermostatIP, 7002);
// Replace this with the thermostatIP string if we get multicast working
Socket sender = new Socket("192.168.1.3", 7002);
try {
while (true) {
// Instantiate a printwriter so we can write to the output stream
Expand Down
8 changes: 5 additions & 3 deletions src/thermostat/ThermostatDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class ThermostatDevice extends ThermostatNetworking implements Deviceable
private Timer clock;
private String serialNumber;
String desiredTempString;
String serverIP;
// Threaded listener thread
Thread thermostatListener;

Expand Down Expand Up @@ -58,7 +59,7 @@ public void sensorUpdateEvent(Sensorable sensor) {
private void updateServer(DataObject<String> dataReading){
//this.sendIP("192.168.1.2");
try {
this.sendCurrentTemp(dataReading.getValue());
this.sendCurrentTemp(dataReading.getValue(), serverIP);
} catch(Exception e){
System.out.println("Error sending to server");
}
Expand Down Expand Up @@ -91,10 +92,11 @@ public void sendIP(String ipAddress) {
*/

// CONVERT THIS TO INT
public void sendCurrentTemp(String currentTemp) throws IOException {
public void sendCurrentTemp(String currentTemp, String serverIP) throws IOException {
// Sends the current temperature on port sendCurrentTempPORT
// Open a sending port
Socket sender = new Socket("192.168.1.3", 7000);
// Replace this with the serverIP string if we get multicast working
Socket sender = new Socket("192.168.1.2", 7000);
try {
while (true) {
// Instantiate a printwriter so we can write to the output stream
Expand Down

0 comments on commit 380858c

Please sign in to comment.