diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 0000000..f02fe70 --- /dev/null +++ b/DOCUMENTATION.md @@ -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. \ No newline at end of file diff --git a/README.md b/README.md index 5941af6..a40529e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 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. +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. Extensive documenation is provided in the DOCUMENATION.md file. ##License Thermocontroller is licensed under the GPLv3. diff --git a/bin/networking/Network.class b/bin/networking/Network.class index fd23e35..ebbbde7 100644 Binary files a/bin/networking/Network.class and b/bin/networking/Network.class differ diff --git a/src/networking/Network.java b/src/networking/Network.java index b9342fa..d768955 100644 --- a/src/networking/Network.java +++ b/src/networking/Network.java @@ -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(); + } + } + -} +} \ No newline at end of file