-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Did some basic design of the networking package, and created a DOCUME…
…NTATION.md file.
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Thermocontroller | ||
================ | ||
An interactive client/server setup for environmental control. | ||
##Creators | ||
Aimee Dipietro, Jonathan Huang, David Paquette, Jonathan Roemer | ||
##Summary | ||
Thermocontroller is an interactive server/client setup for environmental control. The user sends a command to the command and control server, which forwards that command to the client device. Both the client and server software is built to be deployed on a Raspberry Pi running GNU/Linux, with the client using the GPIO pins to interact with external devices. | ||
##Main Package | ||
The methods in Main prompt the user for which mode they want to run the program in. | ||
##Server Package | ||
The server package is the core of Thermocontroller, as it handles all user authentication, configuration storage, and communication with the thermostat devices. | ||
##UI Package | ||
The UI package provides a graphical frontend for the server capabilities. | ||
##Thermostat | ||
The thermostat package deals with received commands from the server, and directly interfaces with devices through the GPIO pins. | ||
##Networking | ||
The networking package is shared between both the server and the thermostat packages. It handles all network communication, and forwards commands. | ||
##Testing | ||
The testing packages contains our various JUnit test files, which were used for validation throughout the development process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
package networking; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | ||
import java.net.ServerSocket; | ||
import java.net.Socket; | ||
|
||
public class Network { | ||
// Listen on port 7777 | ||
private static final int PORT = 7777; | ||
|
||
public static void serverCurrentTemperatureListener() throws Exception { | ||
ServerSocket listener = new ServerSocket(PORT); | ||
try { | ||
while (true) { | ||
Socket socket = listener.accept(); | ||
try { | ||
BufferedReader input = | ||
new BufferedReader(new InputStreamReader(socket.getInputStream())); | ||
String currentTemperature = input.readLine(); | ||
System.out.printf("The current temperature is:", currentTemperature); | ||
} finally { | ||
socket.close(); | ||
} | ||
} | ||
} | ||
finally { | ||
listener.close(); | ||
} | ||
} | ||
|
||
|
||
} | ||
} |