From 21eb26acc74389104a347aa2406322cc73197a9c Mon Sep 17 00:00:00 2001 From: Jonathan Roemer Date: Fri, 6 Feb 2015 23:00:01 -0500 Subject: [PATCH] Did some basic design of the networking package, and created a DOCUMENTATION.md file. --- DOCUMENTATION.md | 19 +++++++++++++++++++ README.md | 2 +- bin/networking/Network.class | Bin 268 -> 1422 bytes src/networking/Network.java | 30 +++++++++++++++++++++++++++++- 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 DOCUMENTATION.md 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 fd23e35e654ef541b8023b6bf85e3ddfa1785c84..ebbbde7be63fd589e7227b7252439ef30606a8f6 100644 GIT binary patch literal 1422 zcmZWpSyR(c7(KTOffBHQlufaUV!@^EON*%BRw)H(#bJC3;UbZebkY>`7xAnQFe9VP z_~>tP#B-Cj7Mx6TbHDw3-}(CM&$k}{?qEqnNTAo2-j3sLTK0!@A^6k~5r}^@wvBYz zpm<^RqclB%$l}6MNkHTTx@H}_>KV4TY?Ny<42&8AZBv$QdD8;n)WkB)XPq?}Ll|8; zIuH{$mA7nJsBNuEw`8oAC6nhJ(q^@z z$*qcX4X@_PyjAt2EnR`w^G~L%cos|4&@a&U4@y&`VL+hYS1?Vw=m#x2=BD&wNMJ~n zJWLF!+{CgHoY8R>qr_;KDmH_rCi4H>eaEbZq(H)#T26YVw!SW1xwa&YHR)=&ATZR> z?CQ(%(kk} z0)d_ulYkfuXQ_#EBF!corw9Fe>kVk(wAv7#4y|yweMQeOH|LFtzcCsX8olw&N*k`T z6YN*4=+sGk!#t|F2ooD2U41cnhs8&8e55Zd_@YG3*8q$JH#@QhCGL;vEN zbn~qoK;u(<>wy8{=;5scy>t$tkKYk$POC7Yiym#1ygfi-rDxRG$Kc%L9!By9IJa_u z^D9^OFt(40eO#Ttx`%Y(D{l8bjC@CUC48;8hwQsu=$Qzuo(@G0)vB9vUH^!1u=*L6Ob{Yei!62UV%n?i;BPieumbmQ- z+9V-#;x+Xzc#G5LC0-HK7=3e;hZv~`bMy;io)+VX{6?pS#1U>F#8V@sgoZ-5cc1_lNb27!rO26AjRnR%Hdc8m22lE*iShcn@aBKt$FfnieNsu%HP%}4>o;fiy3W M$H>43B$*ia0qpP(y8r+H 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