Skip to content

Commit

Permalink
Networking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pid1 committed Apr 24, 2015
1 parent cc9fc1a commit 40c76ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/networking/ServerNetworking.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public void receiveMutlticast(int receiveMulticastPORT) throws Exception {
// Opens the receiving port
MulticastSocket multicastReceiver = new MulticastSocket(receiveMulticastPORT);
// Join the All Hosts network segment, as defined by RFC 5771

multicastReceiver.joinGroup(InetAddress.getByName("224.0.0.1"));
// Instantiate the DatagramPacket and buffer size
DatagramPacket packet;
Expand Down
4 changes: 2 additions & 2 deletions src/server/server.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public boolean createUser(String email, String password, String ip) {
}

public boolean createThermostat(String serial, String name, String desiredTemp) {
// TODO Auto-generated method stub
return false;
dataStorage.createThermostat(serial, name, desiredTemp);
return true;
}

public boolean createThermostat(String serialnumber, String name, String ip, String currenttemp, String desiredtemp){
Expand Down
11 changes: 11 additions & 0 deletions src/thermostat/ThermostatDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class ThermostatDevice extends ThermostatNetworking implements Deviceable
int receiveDesiredTempPORT = 7001;
// Send mutlicast packets to notify the server that the device exists
int sendMulticastPORT = 7002;
// Server IP address
String serverIP;

public ThermostatDevice(Integer updateIntervalInSeconds){
try {
Expand All @@ -44,6 +46,9 @@ public ThermostatDevice(Integer updateIntervalInSeconds){

this.clock = new Timer(updateIntervalInSeconds*1000, this);
this.clock.start();

// String serverIP = this.getServerIP();

}

public void sensorUpdateEvent(Sensorable sensor) {
Expand All @@ -68,4 +73,10 @@ public void actionPerformed(ActionEvent e) {
}
}

/*
public String getServerIP() {
return
}
*/

}

0 comments on commit 40c76ee

Please sign in to comment.