@ -0,0 +1,5 @@ | |||||
{ | |||||
"qr": "127.0.0.3", | |||||
"intersection": "127.0.0.1", | |||||
"ambulance": "127.0.0.1" | |||||
} |
@ -0,0 +1,12 @@ | |||||
{ | |||||
"usernames": { | |||||
"qr": "admin", | |||||
"ambulance": "yigit", | |||||
"intersection": "admin" | |||||
}, | |||||
"passwords": { | |||||
"qr": "admin", | |||||
"ambulance": "Ygtclksbl1", | |||||
"intersection": "admin" | |||||
} | |||||
} |
@ -0,0 +1,5 @@ | |||||
{ | |||||
"qr": "127.0.0.1", | |||||
"intersection": "127.0.0.1", | |||||
"ambulance": "127.0.0.1" | |||||
} |
@ -1,54 +0,0 @@ | |||||
int pins[] = {13,8,9,10,11,12}; | |||||
int light_pin = 0; | |||||
void setup() { | |||||
for(int i = 0; i<6; i++){ | |||||
pinMode(pins[i],OUTPUT); | |||||
} | |||||
} | |||||
void loop() { | |||||
while(Serial.read() != '/'){ | |||||
continue; | |||||
} | |||||
char prev = '!'; | |||||
char cur = '!'; | |||||
String data = ""; | |||||
while(Serial.read() != '/'){ | |||||
if(cur == '!' || prev != cur){ | |||||
prev = cur; | |||||
data += cur; | |||||
} | |||||
cur = Serial.read() | |||||
} | |||||
for(int i = 0; i<2;i++){ | |||||
switch(data[i]){ | |||||
case "g": | |||||
digitalWrite(pins[i*3],HIGH); | |||||
digitalWrite(pins[(i*2)+1],LOW); | |||||
digitalWrite(pins[(i*2)+2],LOW); | |||||
break; | |||||
case "y": | |||||
digitalWrite(pins[i*3],LOW); | |||||
digitalWrite(pins[(i*2)+1],HIGH); | |||||
digitalWrite(pins[(i*2)+1],LOW); | |||||
break; | |||||
case "r": | |||||
digitalWrite(pins[i*3],LOW); | |||||
digitalWrite(pins[(i*2)+1],LOW); | |||||
digitalWrite(pins[(i*2)+1],HIGH); | |||||
break; | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,17 @@ | |||||
<?php | |||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') { | |||||
system("python /home/pi/Desktop/MyCity/bus_stop/qr_reader/main.py > /dev/null 2>&1 &"); | |||||
}else{ | |||||
echo " | |||||
<html> | |||||
<body> | |||||
<button type=\"button\" onclick=\"Http = new XMLHttpRequest(); | |||||
Http.open(\"POST\",\".\"); | |||||
Http.send(); | |||||
\" >Click Me!</button> | |||||
</body> | |||||
</html> | |||||
"; | |||||
} | |||||
?> |
@ -0,0 +1,16 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="CompilerConfiguration"> | |||||
<annotationProcessing> | |||||
<profile name="Maven default annotation processors profile" enabled="true"> | |||||
<sourceOutputDir name="target/generated-sources/annotations" /> | |||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> | |||||
<outputRelativeToContentRoot value="true" /> | |||||
<module name="master_app" /> | |||||
</profile> | |||||
</annotationProcessing> | |||||
<bytecodeTargetLevel> | |||||
<module name="master_app" target="11" /> | |||||
</bytecodeTargetLevel> | |||||
</component> | |||||
</project> |
@ -0,0 +1,6 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="Encoding"> | |||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" /> | |||||
</component> | |||||
</project> |
@ -0,0 +1,13 @@ | |||||
<component name="libraryTable"> | |||||
<library name="Maven: com.hierynomus:sshj:0.27.0"> | |||||
<CLASSES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/com/hierynomus/sshj/0.27.0/sshj-0.27.0.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC> | |||||
<root url="jar://$MAVEN_REPOSITORY$/com/hierynomus/sshj/0.27.0/sshj-0.27.0-javadoc.jar!/" /> | |||||
</JAVADOC> | |||||
<SOURCES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/com/hierynomus/sshj/0.27.0/sshj-0.27.0-sources.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</component> |
@ -0,0 +1,13 @@ | |||||
<component name="libraryTable"> | |||||
<library name="Maven: com.jcraft:jzlib:1.1.3"> | |||||
<CLASSES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/com/jcraft/jzlib/1.1.3/jzlib-1.1.3.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC> | |||||
<root url="jar://$MAVEN_REPOSITORY$/com/jcraft/jzlib/1.1.3/jzlib-1.1.3-javadoc.jar!/" /> | |||||
</JAVADOC> | |||||
<SOURCES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/com/jcraft/jzlib/1.1.3/jzlib-1.1.3-sources.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</component> |
@ -0,0 +1,13 @@ | |||||
<component name="libraryTable"> | |||||
<library name="Maven: net.i2p.crypto:eddsa:0.2.0"> | |||||
<CLASSES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/net/i2p/crypto/eddsa/0.2.0/eddsa-0.2.0.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC> | |||||
<root url="jar://$MAVEN_REPOSITORY$/net/i2p/crypto/eddsa/0.2.0/eddsa-0.2.0-javadoc.jar!/" /> | |||||
</JAVADOC> | |||||
<SOURCES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/net/i2p/crypto/eddsa/0.2.0/eddsa-0.2.0-sources.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</component> |
@ -0,0 +1,13 @@ | |||||
<component name="libraryTable"> | |||||
<library name="Maven: org.bouncycastle:bcpkix-jdk15on:1.60"> | |||||
<CLASSES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/bouncycastle/bcpkix-jdk15on/1.60/bcpkix-jdk15on-1.60.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/bouncycastle/bcpkix-jdk15on/1.60/bcpkix-jdk15on-1.60-javadoc.jar!/" /> | |||||
</JAVADOC> | |||||
<SOURCES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/bouncycastle/bcpkix-jdk15on/1.60/bcpkix-jdk15on-1.60-sources.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</component> |
@ -0,0 +1,13 @@ | |||||
<component name="libraryTable"> | |||||
<library name="Maven: org.bouncycastle:bcprov-jdk15on:1.60"> | |||||
<CLASSES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/bouncycastle/bcprov-jdk15on/1.60/bcprov-jdk15on-1.60.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/bouncycastle/bcprov-jdk15on/1.60/bcprov-jdk15on-1.60-javadoc.jar!/" /> | |||||
</JAVADOC> | |||||
<SOURCES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/bouncycastle/bcprov-jdk15on/1.60/bcprov-jdk15on-1.60-sources.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</component> |
@ -0,0 +1,13 @@ | |||||
<component name="libraryTable"> | |||||
<library name="Maven: org.json:json:20180813"> | |||||
<CLASSES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20180813/json-20180813.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20180813/json-20180813-javadoc.jar!/" /> | |||||
</JAVADOC> | |||||
<SOURCES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/json/json/20180813/json-20180813-sources.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</component> |
@ -0,0 +1,13 @@ | |||||
<component name="libraryTable"> | |||||
<library name="Maven: org.slf4j:slf4j-api:1.7.7"> | |||||
<CLASSES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7-javadoc.jar!/" /> | |||||
</JAVADOC> | |||||
<SOURCES> | |||||
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7-sources.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</component> |
@ -0,0 +1,13 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="MavenProjectsManager"> | |||||
<option name="originalFiles"> | |||||
<list> | |||||
<option value="$PROJECT_DIR$/pom.xml" /> | |||||
</list> | |||||
</option> | |||||
</component> | |||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK"> | |||||
<output url="file://$PROJECT_DIR$/classes" /> | |||||
</component> | |||||
</project> |
@ -0,0 +1,8 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="ProjectModuleManager"> | |||||
<modules> | |||||
<module fileurl="file://$PROJECT_DIR$/master_app.iml" filepath="$PROJECT_DIR$/master_app.iml" /> | |||||
</modules> | |||||
</component> | |||||
</project> |
@ -0,0 +1,124 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="Palette2"> | |||||
<group name="Swing"> | |||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> | |||||
</item> | |||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> | |||||
</item> | |||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> | |||||
</item> | |||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> | |||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> | |||||
</item> | |||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> | |||||
<initial-values> | |||||
<property name="text" value="Button" /> | |||||
</initial-values> | |||||
</item> | |||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | |||||
<initial-values> | |||||
<property name="text" value="RadioButton" /> | |||||
</initial-values> | |||||
</item> | |||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | |||||
<initial-values> | |||||
<property name="text" value="CheckBox" /> | |||||
</initial-values> | |||||
</item> | |||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> | |||||
<initial-values> | |||||
<property name="text" value="Label" /> | |||||
</initial-values> | |||||
</item> | |||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |||||
<preferred-size width="150" height="-1" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |||||
<preferred-size width="150" height="-1" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |||||
<preferred-size width="150" height="-1" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |||||
<preferred-size width="150" height="50" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |||||
<preferred-size width="150" height="50" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |||||
<preferred-size width="150" height="50" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> | |||||
</item> | |||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |||||
<preferred-size width="150" height="50" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> | |||||
<preferred-size width="150" height="50" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |||||
<preferred-size width="150" height="50" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | |||||
<preferred-size width="200" height="200" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | |||||
<preferred-size width="200" height="200" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | |||||
</item> | |||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | |||||
</item> | |||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> | |||||
</item> | |||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> | |||||
</item> | |||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> | |||||
<preferred-size width="-1" height="20" /> | |||||
</default-constraints> | |||||
</item> | |||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> | |||||
</item> | |||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> | |||||
</item> | |||||
</group> | |||||
</component> | |||||
</project> |
@ -0,0 +1,6 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="VcsDirectoryMappings"> | |||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> | |||||
</component> | |||||
</project> |
@ -0,0 +1,396 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="ChangeListManager"> | |||||
<list default="true" id="24ff8bd6-3070-46f7-873a-f9e195fe0913" name="Default Changelist" comment=""> | |||||
<change afterPath="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/userinfo.json" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/Main.java" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/../sender.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sender.py" afterDir="false" /> | |||||
</list> | |||||
<ignored path="$PROJECT_DIR$/classes/" /> | |||||
<ignored path="$PROJECT_DIR$/target/" /> | |||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | |||||
<option name="SHOW_DIALOG" value="false" /> | |||||
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |||||
<option name="LAST_RESOLUTION" value="IGNORE" /> | |||||
</component> | |||||
<component name="DefaultGradleProjectSettings"> | |||||
<option name="isMigrated" value="true" /> | |||||
</component> | |||||
<component name="FileEditorManager"> | |||||
<leaf> | |||||
<file pinned="false" current-in-tab="false"> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="183"> | |||||
<caret line="140" column="16" selection-start-line="140" selection-start-column="16" selection-end-line="140" selection-end-column="16" /> | |||||
<folding> | |||||
<element signature="e#4796#4797#0" expanded="true" /> | |||||
<element signature="e#4861#4862#0" expanded="true" /> | |||||
</folding> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</file> | |||||
<file pinned="false" current-in-tab="false"> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/Main.java"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="45"> | |||||
<caret line="7" selection-start-line="7" selection-end-line="7" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</file> | |||||
<file pinned="false" current-in-tab="true"> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/managementForm.java"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="126"> | |||||
<caret line="230" column="8" lean-forward="true" selection-start-line="230" selection-start-column="8" selection-end-line="230" selection-end-column="8" /> | |||||
<folding> | |||||
<element signature="e#2329#2330#0" expanded="true" /> | |||||
<element signature="e#2392#2393#0" expanded="true" /> | |||||
<element signature="e#2595#2596#0" expanded="true" /> | |||||
<element signature="e#2655#2656#0" expanded="true" /> | |||||
<element signature="e#4365#4366#0" expanded="true" /> | |||||
<element signature="e#4429#4430#0" expanded="true" /> | |||||
<element signature="e#4638#4639#0" expanded="true" /> | |||||
<element signature="e#4705#4706#0" expanded="true" /> | |||||
<element signature="e#4965#4966#0" expanded="true" /> | |||||
<element signature="e#5035#5036#0" expanded="true" /> | |||||
<element signature="e#5248#5249#0" expanded="true" /> | |||||
<element signature="e#5315#5316#0" expanded="true" /> | |||||
<element signature="e#5510#5511#0" expanded="true" /> | |||||
<element signature="e#5570#5571#0" expanded="true" /> | |||||
<element signature="e#6025#6026#0" expanded="true" /> | |||||
<element signature="e#6091#6092#0" expanded="true" /> | |||||
<element signature="e#14079#14080#0" expanded="true" /> | |||||
<element signature="e#14148#14149#0" expanded="true" /> | |||||
</folding> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</file> | |||||
<file pinned="false" current-in-tab="false"> | |||||
<entry file="jar://$MAVEN_REPOSITORY$/org/json/json/20180813/json-20180813.jar!/org/json/JSONObject.class"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="170"> | |||||
<caret line="62" column="91" selection-start-line="62" selection-start-column="91" selection-end-line="62" selection-end-column="91" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</file> | |||||
<file pinned="false" current-in-tab="false"> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/ips.json"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="60"> | |||||
<caret line="4" column="1" lean-forward="true" selection-start-line="4" selection-start-column="1" selection-end-line="4" selection-end-column="1" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</file> | |||||
<file pinned="false" current-in-tab="false"> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/userinfo.json"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="72"> | |||||
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</file> | |||||
</leaf> | |||||
</component> | |||||
<component name="Git.Settings"> | |||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." /> | |||||
</component> | |||||
<component name="IdeDocumentHistory"> | |||||
<option name="CHANGED_PATHS"> | |||||
<list> | |||||
<option value="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/Main.java" /> | |||||
<option value="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/managementForm.java" /> | |||||
<option value="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/userinfo.json" /> | |||||
</list> | |||||
</option> | |||||
</component> | |||||
<component name="ProjectConfigurationFiles"> | |||||
<option name="files"> | |||||
<list> | |||||
<option value="$PROJECT_DIR$/.idea/compiler.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/misc.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/vcs.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/encodings.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/modules.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/libraries/Maven__com_hierynomus_sshj_0_27_0.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/libraries/Maven__com_jcraft_jzlib_1_1_3.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/libraries/Maven__net_i2p_crypto_eddsa_0_2_0.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/libraries/Maven__org_bouncycastle_bcpkix_jdk15on_1_60.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/libraries/Maven__org_bouncycastle_bcprov_jdk15on_1_60.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/libraries/Maven__org_json_json_20180813.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_7.xml" /> | |||||
<option value="$PROJECT_DIR$/.idea/uiDesigner.xml" /> | |||||
</list> | |||||
</option> | |||||
</component> | |||||
<component name="ProjectFrameBounds" extendedState="6"> | |||||
<option name="x" value="53" /> | |||||
<option name="y" value="27" /> | |||||
<option name="width" value="1590" /> | |||||
<option name="height" value="900" /> | |||||
</component> | |||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> | |||||
<component name="ProjectView"> | |||||
<navigator proportions="" version="1"> | |||||
<foldersAlwaysOnTop value="true" /> | |||||
</navigator> | |||||
<panes> | |||||
<pane id="ProjectPane"> | |||||
<subPane> | |||||
<expand> | |||||
<path> | |||||
<item name="master_app" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="master_app" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
<path> | |||||
<item name="master_app" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="master_app" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="src" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
<path> | |||||
<item name="master_app" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="master_app" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="src" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="main" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
<path> | |||||
<item name="master_app" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="master_app" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="src" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="main" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="java" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
<path> | |||||
<item name="master_app" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="master_app" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="src" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="main" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="java" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="master_app" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
</expand> | |||||
<select /> | |||||
</subPane> | |||||
</pane> | |||||
<pane id="PackagesPane" /> | |||||
<pane id="Scope" /> | |||||
</panes> | |||||
</component> | |||||
<component name="PropertiesComponent"> | |||||
<property name="WebServerToolWindowFactoryState" value="false" /> | |||||
<property name="android.sdk.path" value="$USER_HOME$/Android/Sdk" /> | |||||
<property name="aspect.path.notification.shown" value="true" /> | |||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../MyCity" /> | |||||
<property name="node.js.detected.package.eslint" value="true" /> | |||||
<property name="node.js.path.for.package.eslint" value="project" /> | |||||
<property name="node.js.selected.package.eslint" value="(autodetect)" /> | |||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> | |||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" /> | |||||
<property name="nodejs_package_manager_path" value="npm" /> | |||||
</component> | |||||
<component name="RunDashboard"> | |||||
<option name="ruleStates"> | |||||
<list> | |||||
<RuleState> | |||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | |||||
</RuleState> | |||||
<RuleState> | |||||
<option name="name" value="StatusDashboardGroupingRule" /> | |||||
</RuleState> | |||||
</list> | |||||
</option> | |||||
</component> | |||||
<component name="RunManager"> | |||||
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> | |||||
<option name="MAIN_CLASS_NAME" value="me.yigitcolakoglu.master_app.Main" /> | |||||
<module name="master_app" /> | |||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app" /> | |||||
<extension name="coverage"> | |||||
<pattern> | |||||
<option name="PATTERN" value="me.yigitcolakoglu.master_app.*" /> | |||||
<option name="ENABLED" value="true" /> | |||||
</pattern> | |||||
</extension> | |||||
<method v="2"> | |||||
<option name="Make" enabled="true" /> | |||||
</method> | |||||
</configuration> | |||||
<recent_temporary> | |||||
<list> | |||||
<item itemvalue="Application.Main" /> | |||||
</list> | |||||
</recent_temporary> | |||||
</component> | |||||
<component name="SvnConfiguration"> | |||||
<configuration /> | |||||
</component> | |||||
<component name="TaskManager"> | |||||
<task active="true" id="Default" summary="Default task"> | |||||
<changelist id="24ff8bd6-3070-46f7-873a-f9e195fe0913" name="Default Changelist" comment="" /> | |||||
<created>1558719783811</created> | |||||
<option name="number" value="Default" /> | |||||
<option name="presentableId" value="Default" /> | |||||
<updated>1558719783811</updated> | |||||
<workItem from="1558719786984" duration="2491000" /> | |||||
</task> | |||||
<servers /> | |||||
</component> | |||||
<component name="TimeTrackingManager"> | |||||
<option name="totallyTimeSpent" value="2491000" /> | |||||
</component> | |||||
<component name="ToolWindowManager"> | |||||
<frame x="0" y="23" width="1920" height="1031" extended-state="6" /> | |||||
<layout> | |||||
<window_info id="Designer" /> | |||||
<window_info id="Image Layers" /> | |||||
<window_info id="Capture Tool" /> | |||||
<window_info id="UI Designer" /> | |||||
<window_info id="Favorites" side_tool="true" /> | |||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2497332" /> | |||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> | |||||
<window_info anchor="bottom" id="Terminal" /> | |||||
<window_info anchor="bottom" id="Docker" show_stripe_button="false" /> | |||||
<window_info anchor="bottom" id="Event Log" side_tool="true" /> | |||||
<window_info anchor="bottom" id="Messages" /> | |||||
<window_info anchor="bottom" id="Tail" /> | |||||
<window_info anchor="bottom" id="Database Changes" /> | |||||
<window_info anchor="bottom" id="Version Control" /> | |||||
<window_info anchor="bottom" id="Message" order="0" /> | |||||
<window_info anchor="bottom" id="Find" order="1" /> | |||||
<window_info anchor="bottom" id="Run" order="2" /> | |||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> | |||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | |||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | |||||
<window_info anchor="bottom" id="TODO" order="6" /> | |||||
<window_info anchor="right" id="Maven" /> | |||||
<window_info anchor="right" id="Palette" /> | |||||
<window_info anchor="right" id="Google Cloud Storage" show_stripe_button="false" /> | |||||
<window_info anchor="right" id="SciView" /> | |||||
<window_info anchor="right" id="Database" /> | |||||
<window_info anchor="right" id="Palette	" /> | |||||
<window_info anchor="right" id="Theme Preview" /> | |||||
<window_info anchor="right" id="Capture Analysis" /> | |||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> | |||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> | |||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> | |||||
</layout> | |||||
</component> | |||||
<component name="TypeScriptGeneratedFilesManager"> | |||||
<option name="version" value="1" /> | |||||
</component> | |||||
<component name="XDebuggerManager"> | |||||
<breakpoint-manager> | |||||
<breakpoints> | |||||
<line-breakpoint enabled="true" type="java-line"> | |||||
<url>file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/managementForm.java</url> | |||||
<line>253</line> | |||||
<properties /> | |||||
<option name="timeStamp" value="1" /> | |||||
</line-breakpoint> | |||||
<line-breakpoint enabled="true" type="java-line"> | |||||
<url>file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/managementForm.java</url> | |||||
<line>233</line> | |||||
<properties /> | |||||
<option name="timeStamp" value="2" /> | |||||
</line-breakpoint> | |||||
</breakpoints> | |||||
</breakpoint-manager> | |||||
</component> | |||||
<component name="editorHistoryManager"> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/managementForm.form"> | |||||
<provider selected="true" editor-type-id="ui-designer" /> | |||||
</entry> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/Main.java"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="45"> | |||||
<caret line="7" selection-start-line="7" selection-end-line="7" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/ips.json"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="60"> | |||||
<caret line="4" column="1" lean-forward="true" selection-start-line="4" selection-start-column="1" selection-end-line="4" selection-end-column="1" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="183"> | |||||
<caret line="140" column="16" selection-start-line="140" selection-start-column="16" selection-end-line="140" selection-end-column="16" /> | |||||
<folding> | |||||
<element signature="e#4796#4797#0" expanded="true" /> | |||||
<element signature="e#4861#4862#0" expanded="true" /> | |||||
</folding> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/userinfo.json"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="72"> | |||||
<caret line="3" column="23" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
<entry file="jar://$MAVEN_REPOSITORY$/org/json/json/20180813/json-20180813.jar!/org/json/JSONObject.class"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="170"> | |||||
<caret line="62" column="91" selection-start-line="62" selection-start-column="91" selection-end-line="62" selection-end-column="91" /> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
<entry file="file://$PROJECT_DIR$/src/main/java/me/yigitcolakoglu/master_app/managementForm.java"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="126"> | |||||
<caret line="230" column="8" lean-forward="true" selection-start-line="230" selection-start-column="8" selection-end-line="230" selection-end-column="8" /> | |||||
<folding> | |||||
<element signature="e#2329#2330#0" expanded="true" /> | |||||
<element signature="e#2392#2393#0" expanded="true" /> | |||||
<element signature="e#2595#2596#0" expanded="true" /> | |||||
<element signature="e#2655#2656#0" expanded="true" /> | |||||
<element signature="e#4365#4366#0" expanded="true" /> | |||||
<element signature="e#4429#4430#0" expanded="true" /> | |||||
<element signature="e#4638#4639#0" expanded="true" /> | |||||
<element signature="e#4705#4706#0" expanded="true" /> | |||||
<element signature="e#4965#4966#0" expanded="true" /> | |||||
<element signature="e#5035#5036#0" expanded="true" /> | |||||
<element signature="e#5248#5249#0" expanded="true" /> | |||||
<element signature="e#5315#5316#0" expanded="true" /> | |||||
<element signature="e#5510#5511#0" expanded="true" /> | |||||
<element signature="e#5570#5571#0" expanded="true" /> | |||||
<element signature="e#6025#6026#0" expanded="true" /> | |||||
<element signature="e#6091#6092#0" expanded="true" /> | |||||
<element signature="e#14079#14080#0" expanded="true" /> | |||||
<element signature="e#14148#14149#0" expanded="true" /> | |||||
</folding> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</component> | |||||
<component name="masterDetails"> | |||||
<states> | |||||
<state key="ProjectJDKs.UI"> | |||||
<settings> | |||||
<last-edited>Python 3.7</last-edited> | |||||
<splitter-proportions> | |||||
<option name="proportions"> | |||||
<list> | |||||
<option value="0.2" /> | |||||
</list> | |||||
</option> | |||||
</splitter-proportions> | |||||
</settings> | |||||
</state> | |||||
</states> | |||||
</component> | |||||
</project> |
@ -0,0 +1,49 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<actions> | |||||
<action> | |||||
<actionName>run</actionName> | |||||
<packagings> | |||||
<packaging>jar</packaging> | |||||
</packagings> | |||||
<goals> | |||||
<goal>process-classes</goal> | |||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | |||||
</goals> | |||||
<properties> | |||||
<exec.args>-classpath %classpath ${packageClassName} ips.json</exec.args> | |||||
<exec.executable>java</exec.executable> | |||||
<exec.workingdir>/home/yigit/projects/MyCity/traffic_analyzer/master_app/src/main/java/me/yigitcolakoglu/master_app</exec.workingdir> | |||||
</properties> | |||||
</action> | |||||
<action> | |||||
<actionName>debug</actionName> | |||||
<packagings> | |||||
<packaging>jar</packaging> | |||||
</packagings> | |||||
<goals> | |||||
<goal>process-classes</goal> | |||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | |||||
</goals> | |||||
<properties> | |||||
<exec.args>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName} ips.json</exec.args> | |||||
<exec.executable>java</exec.executable> | |||||
<jpda.listen>true</jpda.listen> | |||||
<exec.workingdir>/home/yigit/projects/MyCity/traffic_analyzer/master_app/src/main/java/me/yigitcolakoglu/master_app</exec.workingdir> | |||||
</properties> | |||||
</action> | |||||
<action> | |||||
<actionName>profile</actionName> | |||||
<packagings> | |||||
<packaging>jar</packaging> | |||||
</packagings> | |||||
<goals> | |||||
<goal>process-classes</goal> | |||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.5.0:exec</goal> | |||||
</goals> | |||||
<properties> | |||||
<exec.args>-classpath %classpath ${packageClassName} ips.json</exec.args> | |||||
<exec.executable>java</exec.executable> | |||||
<exec.workingdir>/home/yigit/projects/MyCity/traffic_analyzer/master_app/src/main/java/me/yigitcolakoglu/master_app</exec.workingdir> | |||||
</properties> | |||||
</action> | |||||
</actions> |
@ -0,0 +1,5 @@ | |||||
{ | |||||
"qr": "127.0.0.3", | |||||
"intersection": "127.0.0.1", | |||||
"ambulance": "192.168.1.35" | |||||
} |
@ -0,0 +1,250 @@ | |||||
<?xml version="1.0" encoding="UTF-8" ?> | |||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | |||||
<NonVisualComponents> | |||||
<Container class="javax.swing.JFrame" name="jFrame1"> | |||||
<Properties> | |||||
<Property name="defaultCloseOperation" type="int" value="3"/> | |||||
</Properties> | |||||
<Layout> | |||||
<DimensionLayout dim="0"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="separate" max="-2" attributes="0"/> | |||||
<Component id="jTextField2" min="-2" pref="89" max="-2" attributes="0"/> | |||||
<EmptySpace type="separate" max="-2" attributes="0"/> | |||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace pref="154" max="32767" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
<DimensionLayout dim="1"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="jTextField2" alignment="3" min="-2" pref="33" max="-2" attributes="0"/> | |||||
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace pref="656" max="32767" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
</Layout> | |||||
<SubComponents> | |||||
<Component class="javax.swing.JTextField" name="jTextField2"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="127.0.0.1"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextField2ActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="jButton2"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Start Process"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="jLabel2"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Running"/> | |||||
</Properties> | |||||
</Component> | |||||
</SubComponents> | |||||
</Container> | |||||
<Component class="javax.swing.JButton" name="jButton4"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="jButton4"/> | |||||
</Properties> | |||||
</Component> | |||||
</NonVisualComponents> | |||||
<Properties> | |||||
<Property name="defaultCloseOperation" type="int" value="3"/> | |||||
</Properties> | |||||
<SyntheticProperties> | |||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | |||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/> | |||||
</SyntheticProperties> | |||||
<AuxValues> | |||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> | |||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> | |||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> | |||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> | |||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> | |||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> | |||||
</AuxValues> | |||||
<Layout> | |||||
<DimensionLayout dim="0"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" attributes="0"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Component id="jLabel6" min="-2" max="-2" attributes="0"/> | |||||
<Component id="jLabel5" alignment="1" min="-2" max="-2" attributes="0"/> | |||||
<Component id="jLabel7" alignment="1" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="0" max="-2" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="qr_start" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="separate" max="-2" attributes="0"/> | |||||
<Component id="qr_ip" max="32767" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Group type="103" groupAlignment="1" attributes="0"> | |||||
<Component id="intersection_start" min="-2" max="-2" attributes="0"/> | |||||
<Component id="ambulance_start" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace type="separate" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="0" max="-2" attributes="0"> | |||||
<Component id="ambulance_ip" max="32767" attributes="0"/> | |||||
<Component id="intersection_ip" min="-2" pref="89" max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</Group> | |||||
<EmptySpace type="separate" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Component id="ambulance_state" min="-2" max="-2" attributes="0"/> | |||||
<Component id="intersection_state" min="-2" max="-2" attributes="0"/> | |||||
<Component id="qr_state" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<EmptySpace min="-2" pref="152" max="-2" attributes="0"/> | |||||
<Component id="refresh_button" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
<EmptySpace pref="42" max="32767" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
<DimensionLayout dim="1"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="ambulance_ip" alignment="3" min="-2" pref="33" max="-2" attributes="0"/> | |||||
<Component id="ambulance_start" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="ambulance_state" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="intersection_start" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="intersection_ip" alignment="3" min="-2" pref="31" max="-2" attributes="0"/> | |||||
<Component id="intersection_state" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="qr_start" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="qr_ip" alignment="3" min="-2" pref="31" max="-2" attributes="0"/> | |||||
<Component id="qr_state" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="refresh_button" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace pref="12" max="32767" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
</Layout> | |||||
<SubComponents> | |||||
<Component class="javax.swing.JTextField" name="ambulance_ip"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="127.0.0.1"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ambulance_ipActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="ambulance_start"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Start"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ambulance_startActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="ambulance_state"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Running"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="intersection_start"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Start"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="intersection_startActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JTextField" name="intersection_ip"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="127.0.0.1"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="intersection_ipActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="qr_start"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Start"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="qr_startActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JTextField" name="qr_ip"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="127.0.0.1"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="intersection_state"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Running"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="qr_state"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Running"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="jLabel5"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Ambulance:"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="jLabel6"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Intersection:"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="jLabel7"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="QR Reader:"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="refresh_button"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Refresh"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refresh_buttonActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
</SubComponents> | |||||
</Form> |
@ -0,0 +1,464 @@ | |||||
/* | |||||
* To change this license header, choose License Headers in Project Properties. | |||||
* To change this template file, choose Tools | Templates | |||||
* and open the template in the editor. | |||||
*/ | |||||
package me.yigitcolakoglu.master_app; | |||||
import java.awt.event.WindowAdapter; | |||||
import java.awt.event.WindowEvent; | |||||
import java.io.BufferedWriter; | |||||
import java.io.FileInputStream; | |||||
import java.io.FileWriter; | |||||
import java.io.IOException; | |||||
import java.net.InetAddress; | |||||
import java.net.Socket; | |||||
import javax.swing.JFrame; | |||||
import net.schmizz.sshj.SSHClient; | |||||
import net.schmizz.sshj.connection.channel.direct.Session; | |||||
import net.schmizz.sshj.transport.verification.PromiscuousVerifier; | |||||
import org.json.JSONObject; | |||||
/** | |||||
* | |||||
* @author yigit | |||||
*/ | |||||
public class managementForm extends javax.swing.JFrame { | |||||
/** | |||||
* Creates new form managementForm | |||||
*/ | |||||
public managementForm() { | |||||
initComponents(); | |||||
} | |||||
public final SSHClient ssh = new SSHClient(); | |||||
private JSONObject ip_json; | |||||
private JSONObject usernames; | |||||
private JSONObject passwords; | |||||
private JSONObject commands = new JSONObject(); | |||||
@SuppressWarnings("unchecked") | |||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |||||
private void initComponents() { | |||||
jFrame1 = new javax.swing.JFrame(); | |||||
jTextField2 = new javax.swing.JTextField(); | |||||
jButton2 = new javax.swing.JButton(); | |||||
jLabel2 = new javax.swing.JLabel(); | |||||
jButton4 = new javax.swing.JButton(); | |||||
ambulance_ip = new javax.swing.JTextField(); | |||||
ambulance_start = new javax.swing.JButton(); | |||||
ambulance_state = new javax.swing.JLabel(); | |||||
intersection_start = new javax.swing.JButton(); | |||||
intersection_ip = new javax.swing.JTextField(); | |||||
qr_start = new javax.swing.JButton(); | |||||
qr_ip = new javax.swing.JTextField(); | |||||
intersection_state = new javax.swing.JLabel(); | |||||
qr_state = new javax.swing.JLabel(); | |||||
jLabel5 = new javax.swing.JLabel(); | |||||
jLabel6 = new javax.swing.JLabel(); | |||||
jLabel7 = new javax.swing.JLabel(); | |||||
refresh_button = new javax.swing.JButton(); | |||||
jFrame1.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |||||
jTextField2.setText("127.0.0.1"); | |||||
jTextField2.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
jTextField2ActionPerformed(evt); | |||||
} | |||||
}); | |||||
jButton2.setText("Start Process"); | |||||
jButton2.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
jButton2ActionPerformed(evt); | |||||
} | |||||
}); | |||||
jLabel2.setText("Running"); | |||||
javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane()); | |||||
jFrame1.getContentPane().setLayout(jFrame1Layout); | |||||
jFrame1Layout.setHorizontalGroup( | |||||
jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(jFrame1Layout.createSequentialGroup() | |||||
.addContainerGap() | |||||
.addComponent(jButton2) | |||||
.addGap(18, 18, 18) | |||||
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) | |||||
.addGap(18, 18, 18) | |||||
.addComponent(jLabel2) | |||||
.addContainerGap(154, Short.MAX_VALUE)) | |||||
); | |||||
jFrame1Layout.setVerticalGroup( | |||||
jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(jFrame1Layout.createSequentialGroup() | |||||
.addGap(33, 33, 33) | |||||
.addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) | |||||
.addComponent(jButton2) | |||||
.addComponent(jLabel2)) | |||||
.addContainerGap(656, Short.MAX_VALUE)) | |||||
); | |||||
jButton4.setText("jButton4"); | |||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |||||
ambulance_ip.setText("127.0.0.1"); | |||||
ambulance_ip.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
ambulance_ipActionPerformed(evt); | |||||
} | |||||
}); | |||||
ambulance_start.setText("Start"); | |||||
ambulance_start.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
ambulance_startActionPerformed(evt); | |||||
} | |||||
}); | |||||
ambulance_state.setText("Running"); | |||||
intersection_start.setText("Start"); | |||||
intersection_start.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
intersection_startActionPerformed(evt); | |||||
} | |||||
}); | |||||
intersection_ip.setText("127.0.0.1"); | |||||
intersection_ip.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
intersection_ipActionPerformed(evt); | |||||
} | |||||
}); | |||||
qr_start.setText("Start"); | |||||
qr_start.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
qr_startActionPerformed(evt); | |||||
} | |||||
}); | |||||
qr_ip.setText("127.0.0.1"); | |||||
intersection_state.setText("Running"); | |||||
qr_state.setText("Running"); | |||||
jLabel5.setText("Ambulance:"); | |||||
jLabel6.setText("Intersection:"); | |||||
jLabel7.setText("QR Reader:"); | |||||
refresh_button.setText("Refresh"); | |||||
refresh_button.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
refresh_buttonActionPerformed(evt); | |||||
} | |||||
}); | |||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |||||
getContentPane().setLayout(layout); | |||||
layout.setHorizontalGroup( | |||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addGap(16, 16, 16) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addComponent(jLabel6) | |||||
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING) | |||||
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addComponent(qr_start) | |||||
.addGap(18, 18, 18) | |||||
.addComponent(qr_ip)) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |||||
.addComponent(intersection_start) | |||||
.addComponent(ambulance_start)) | |||||
.addGap(18, 18, 18) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) | |||||
.addComponent(ambulance_ip) | |||||
.addComponent(intersection_ip, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)))) | |||||
.addGap(18, 18, 18) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addComponent(ambulance_state) | |||||
.addComponent(intersection_state) | |||||
.addComponent(qr_state))) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addGap(152, 152, 152) | |||||
.addComponent(refresh_button))) | |||||
.addContainerGap(42, Short.MAX_VALUE)) | |||||
); | |||||
layout.setVerticalGroup( | |||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addGap(24, 24, 24) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(ambulance_ip, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) | |||||
.addComponent(ambulance_start) | |||||
.addComponent(ambulance_state) | |||||
.addComponent(jLabel5)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(intersection_start) | |||||
.addComponent(intersection_ip, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) | |||||
.addComponent(intersection_state) | |||||
.addComponent(jLabel6)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(qr_start) | |||||
.addComponent(qr_ip, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) | |||||
.addComponent(qr_state) | |||||
.addComponent(jLabel7)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(refresh_button) | |||||
.addContainerGap(12, Short.MAX_VALUE)) | |||||
); | |||||
pack(); | |||||
}// </editor-fold>//GEN-END:initComponents | |||||
private void ambulance_ipActionPerformed(java.awt.event.ActionEvent evt) { | |||||
}//GEN-LAST:event_ambulance_ipActionPerformed | |||||
private void execSSH(String ip,String uname,String passwd, String cmd){ | |||||
Session session = null; | |||||
try{ | |||||
ssh.connect(ip, 22); | |||||
ssh.authPassword(uname, passwd); | |||||
session = ssh.startSession(); | |||||
final Session.Command command = session.exec(cmd); | |||||
}catch(Exception e){ | |||||
System.out.println(e.toString()); | |||||
}finally { | |||||
try { | |||||
if (session != null) { | |||||
session.close(); | |||||
} | |||||
ssh.disconnect(); | |||||
} catch (IOException e) { | |||||
// Do Nothing | |||||
} | |||||
} | |||||
} | |||||
private void ambulance_startActionPerformed(java.awt.event.ActionEvent evt) { | |||||
execSSH(ambulance_ip.getText(), | |||||
usernames.getString("ambulance"), | |||||
passwords.getString("ambulance"), | |||||
commands.getString("ambulance")); | |||||
} | |||||
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) { | |||||
// TODO add your handling code here: | |||||
} | |||||
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { | |||||
// TODO add your handling code here: | |||||
} | |||||
private void intersection_startActionPerformed(java.awt.event.ActionEvent evt) { | |||||
execSSH(ambulance_ip.getText(), | |||||
usernames.getString("intersection"), | |||||
passwords.getString("intersection"), | |||||
commands.getString("intersection")); | |||||
} | |||||
private void intersection_ipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_intersection_ipActionPerformed | |||||
// TODO add your handling code here: | |||||
}//GEN-LAST:event_intersection_ipActionPerformed | |||||
private void qr_startActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_qr_startActionPerformed | |||||
execSSH(ambulance_ip.getText(), | |||||
usernames.getString("qr"), | |||||
passwords.getString("qr"), | |||||
commands.getString("qr")); | |||||
}//GEN-LAST:event_qr_startActionPerformed | |||||
private void refresh_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refresh_buttonActionPerformed | |||||
checkState(); | |||||
}//GEN-LAST:event_refresh_buttonActionPerformed | |||||
public static void main(String args[]) { | |||||
/* Set the Nimbus look and feel */ | |||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> | |||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. | |||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html | |||||
*/ | |||||
try { | |||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { | |||||
if ("Nimbus".equals(info.getName())) { | |||||
javax.swing.UIManager.setLookAndFeel(info.getClassName()); | |||||
break; | |||||
} | |||||
} | |||||
} catch (ClassNotFoundException ex) { | |||||
java.util.logging.Logger.getLogger(managementForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} catch (InstantiationException ex) { | |||||
java.util.logging.Logger.getLogger(managementForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} catch (IllegalAccessException ex) { | |||||
java.util.logging.Logger.getLogger(managementForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) { | |||||
java.util.logging.Logger.getLogger(managementForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |||||
} | |||||
//</editor-fold> | |||||
/* Create and display the form */ | |||||
java.awt.EventQueue.invokeLater(new Runnable() { | |||||
public void run() { | |||||
new managementForm().setVisible(true); | |||||
} | |||||
}); | |||||
} | |||||
public void initIp(){ | |||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); | |||||
commands.put("ambulance","speaker-test -t sine -f 1000 -l 1"); | |||||
commands.put("intersection","echo 1"); | |||||
commands.put("qr","echo 1"); | |||||
FileInputStream in = null; | |||||
String ips = ""; | |||||
String userdata = ""; | |||||
try { | |||||
ssh.addHostKeyVerifier(new PromiscuousVerifier()); | |||||
in = new FileInputStream("./ips.json"); | |||||
int c; | |||||
while ((c = in.read()) != -1) { | |||||
ips += (char)c; | |||||
} | |||||
in = new FileInputStream("./userinfo.json"); | |||||
while ((c = in.read()) != -1) { | |||||
userdata += (char)c; | |||||
} | |||||
usernames = new JSONObject(userdata).getJSONObject("usernames"); | |||||
passwords = new JSONObject(userdata).getJSONObject("passwords"); | |||||
ip_json = new JSONObject(ips); | |||||
ambulance_ip.setText(ip_json.getString("ambulance")); | |||||
intersection_ip.setText(ip_json.getString("intersection")); | |||||
qr_ip.setText(ip_json.getString("qr")); | |||||
}catch(Exception e){ | |||||
System.out.println("[ERROR]: "+e.toString()); | |||||
return; | |||||
} | |||||
checkState(); | |||||
} | |||||
public void checkState(){ | |||||
try{ | |||||
boolean ip_correct = InetAddress.getByName(ambulance_ip.getText()).isReachable(1000); | |||||
if(!ip_correct){ | |||||
throw new Exception("IP Not Reachable"); | |||||
} | |||||
new Socket(ambulance_ip.getText(), 22).close(); | |||||
ambulance_start.setEnabled(true); | |||||
}catch(Exception e){ | |||||
System.out.println(e.toString()); | |||||
ambulance_start.setEnabled(false); | |||||
} | |||||
try{ | |||||
boolean ip_correct = InetAddress.getByName(ambulance_ip.getText()).isReachable(100); | |||||
if(!ip_correct){ | |||||
throw new Exception("IP Not Reachable"); | |||||
} | |||||
new Socket(ambulance_ip.getText(), 8385).close(); | |||||
ambulance_state.setText("Running"); | |||||
}catch(Exception e){ | |||||
ambulance_state.setText("Not Running"); | |||||
} | |||||
try{ | |||||
boolean ip_correct = InetAddress.getByName(intersection_ip.getText()).isReachable(100); | |||||
if(!ip_correct){ | |||||
throw new Exception("IP Not Reachable"); | |||||
} | |||||
new Socket(intersection_ip.getText(), 22).close(); | |||||
intersection_start.setEnabled(true); | |||||
}catch(Exception e){ | |||||
intersection_start.setEnabled(false); | |||||
} | |||||
try{ | |||||
boolean ip_correct = InetAddress.getByName(intersection_ip.getText()).isReachable(100); | |||||
if(!ip_correct){ | |||||
throw new Exception("IP Not Reachable"); | |||||
} | |||||
new Socket(intersection_ip.getText(), 8386).close(); | |||||
intersection_state.setText("Running"); | |||||
}catch(Exception e){ | |||||
intersection_state.setText("Not Running"); | |||||
} | |||||
try{ | |||||
boolean ip_correct = InetAddress.getByName(qr_ip.getText()).isReachable(100); | |||||
if(!ip_correct){ | |||||
throw new Exception("IP Not Reachable"); | |||||
} | |||||
new Socket(qr_ip.getText(), 22).close(); | |||||
qr_start.setEnabled(true); | |||||
}catch(Exception e){ | |||||
qr_start.setEnabled(false); | |||||
} | |||||
try{ | |||||
boolean ip_correct = InetAddress.getByName(qr_ip.getText()).isReachable(100); | |||||
if(!ip_correct){ | |||||
throw new Exception("IP Not Reachable"); | |||||
} | |||||
new Socket(qr_ip.getText(), 8385).close(); | |||||
qr_state.setText("Running"); | |||||
}catch(Exception e){ | |||||
qr_state.setText("Not Running"); | |||||
} | |||||
} | |||||
@Override | |||||
public void dispose(){ | |||||
JSONObject contentJSON = new JSONObject(); | |||||
contentJSON.put("ambulance", ambulance_ip.getText()); | |||||
contentJSON.put("intersection", intersection_ip.getText()); | |||||
contentJSON.put("qr", qr_ip.getText()); | |||||
String fileContent = contentJSON.toString(4); | |||||
try{ | |||||
BufferedWriter writer = new BufferedWriter(new FileWriter("./ips.json")); | |||||
writer.write(fileContent); | |||||
writer.close(); | |||||
}catch(Exception er){ | |||||
System.out.println("[ERROR]: "+er.toString()); | |||||
} | |||||
super.dispose(); | |||||
} | |||||
// Variables declaration - do not modify//GEN-BEGIN:variables | |||||
private javax.swing.JTextField ambulance_ip; | |||||
private javax.swing.JButton ambulance_start; | |||||
private javax.swing.JLabel ambulance_state; | |||||
private javax.swing.JTextField intersection_ip; | |||||
private javax.swing.JButton intersection_start; | |||||
private javax.swing.JLabel intersection_state; | |||||
private javax.swing.JButton jButton2; | |||||
private javax.swing.JButton jButton4; | |||||
private javax.swing.JFrame jFrame1; | |||||
private javax.swing.JLabel jLabel2; | |||||
private javax.swing.JLabel jLabel5; | |||||
private javax.swing.JLabel jLabel6; | |||||
private javax.swing.JLabel jLabel7; | |||||
private javax.swing.JTextField jTextField2; | |||||
private javax.swing.JTextField qr_ip; | |||||
private javax.swing.JButton qr_start; | |||||
private javax.swing.JLabel qr_state; | |||||
private javax.swing.JButton refresh_button; | |||||
// End of variables declaration//GEN-END:variables | |||||
} |
@ -0,0 +1,12 @@ | |||||
{ | |||||
"usernames": { | |||||
"qr": "admin", | |||||
"ambulance": "yigit", | |||||
"intersection": "admin" | |||||
}, | |||||
"passwords": { | |||||
"qr": "admin", | |||||
"ambulance": "Ygtclksbl1", | |||||
"intersection": "admin" | |||||
} | |||||
} |
@ -0,0 +1,5 @@ | |||||
#Generated by Maven | |||||
#Fri May 24 18:58:10 EET 2019 | |||||
groupId=me.yigitcolakoglu | |||||
artifactId=master_app | |||||
version=1.0-SNAPSHOT |
@ -0,0 +1,17 @@ | |||||
me/yigitcolakoglu/master_app/managementForm$4.class | |||||
me/yigitcolakoglu/master_app/cameraForm$3.class | |||||
me/yigitcolakoglu/master_app/cameraForm$2.class | |||||
me/yigitcolakoglu/master_app/managementForm$3.class | |||||
me/yigitcolakoglu/master_app/cameraForm$5.class | |||||
me/yigitcolakoglu/master_app/Main.class | |||||
me/yigitcolakoglu/master_app/managementForm$7.class | |||||
me/yigitcolakoglu/master_app/cameraForm$1.class | |||||
me/yigitcolakoglu/master_app/managementForm.class | |||||
me/yigitcolakoglu/master_app/managementForm$1.class | |||||
me/yigitcolakoglu/master_app/managementForm$2.class | |||||
me/yigitcolakoglu/master_app/managementForm$8.class | |||||
me/yigitcolakoglu/master_app/managementForm$6.class | |||||
me/yigitcolakoglu/master_app/managementForm$9.class | |||||
me/yigitcolakoglu/master_app/cameraForm$4.class | |||||
me/yigitcolakoglu/master_app/managementForm$5.class | |||||
me/yigitcolakoglu/master_app/cameraForm.class |
@ -0,0 +1,3 @@ | |||||
/home/yigit/projects/MyCity/traffic_analyzer/master_app/src/main/java/me/yigitcolakoglu/master_app/managementForm.java | |||||
/home/yigit/projects/MyCity/traffic_analyzer/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java | |||||
/home/yigit/projects/MyCity/traffic_analyzer/master_app/src/main/java/me/yigitcolakoglu/master_app/Main.java |
@ -1,25 +0,0 @@ | |||||
[ | |||||
{ | |||||
"1": ["weather","temparature","hot"] | |||||
}, | |||||
{ | |||||
"1":{ | |||||
"url":"https://api.openweathermap.org/data/2.5/weather", | |||||
"parameters": {"q": "GPE"}, | |||||
"defaults": {"q": "location"}, | |||||
"apikey": {"appid": "3b0dabc605b0ed0d411b6119846d1321"}, | |||||
"response": "json", | |||||
"data_to_receive": { | |||||
"name": {}, | |||||
"weather": [ | |||||
{ | |||||
"main": {} | |||||
} | |||||
], | |||||
"main": {"temp": {}} | |||||
}, | |||||
"output_format": "Today in {name}, it is {temp} with {main}" | |||||
} | |||||
} | |||||
] |
@ -1,121 +0,0 @@ | |||||
import json | |||||
import requests | |||||
from stanford_parser.parser import Parser | |||||
import nltk | |||||
import nltk.corpus as corpus | |||||
def getData( searched, data, data_final ): | |||||
if type( searched ) is dict: | |||||
for key in searched: | |||||
if len( searched[ key ] ) == 0: | |||||
data_final[ key ] = data[ key ] | |||||
else: | |||||
getData( searched[ key ], data[ key ], data_final ) | |||||
elif type( searched ) is list: | |||||
for key in range( len( searched ) ): | |||||
if len( searched[ key ] ) == 0: | |||||
data_final[ key ] = data[ key ] | |||||
else: | |||||
getData( searched[ key ], data[ key ], data_final ) | |||||
parser = Parser() | |||||
while True: | |||||
sentence = raw_input("You:") | |||||
#Parse the input | |||||
tokenized = nltk.word_tokenize( sentence ) | |||||
stop_words = set( corpus.stopwords.words( 'english' ) ) | |||||
cleaned = [ w for w in tokenized if w not in stop_words ] | |||||
tagged = nltk.pos_tag( cleaned ) | |||||
named = nltk.ne_chunk( tagged ) | |||||
cleaned_sentence = " ".join( cleaned ) | |||||
dependencies = parser.parseToStanfordDependencies( cleaned_sentence ) | |||||
tupleResult = [ (rel, gov.text, dep.text) for rel, gov, dep in dependencies.dependencies ] | |||||
#Read the files | |||||
files = [open("user_details.json","r"),open('keywords.json', 'r'),open('predefined.json', 'r')] | |||||
defaults = json.loads(files[0].read()) | |||||
keywords = json.loads( files[1 ].read() ) | |||||
predefined = json.loads(files[2].read()) | |||||
print("[TAGGED]: " + str( tagged ) + "\n") | |||||
print("[SPECIAL]: " + str( named ) + "\n") | |||||
print("[CLEAN]: " + str( cleaned_sentence ) + "\n") | |||||
print("[DEPENDENCIES]: " + str( tupleResult ) + "\n") | |||||
wp_word = "" | |||||
for i in range( len( tagged ) ): | |||||
if tagged[ i ][ 1 ] == "WP" or tagged[ i ][ 1 ] == "WRB" or tagged[ i ][ 1 ] == "WP$": | |||||
wp_word = tagged[ i ][ 0 ] | |||||
if sentence in predefined: | |||||
print(predefined[sentence]) | |||||
else: | |||||
if not wp_word == "": | |||||
key = "" | |||||
understood = False | |||||
key_connect = "" | |||||
for dep in tupleResult: | |||||
if dep[2] == wp_word: | |||||
key = dep[1] | |||||
for dep in tupleResult: | |||||
if dep[1]==key: key_connect=dep[2] | |||||
for keyword_id in keywords[0 ]: | |||||
if key in keywords[0 ][keyword_id ]: | |||||
key = keyword_id | |||||
understood = True | |||||
if(understood): | |||||
api_details = keywords[ 1 ][ key ] | |||||
params = api_details[ "parameters" ] | |||||
for i in named: | |||||
for j in params: | |||||
try: | |||||
i.label() | |||||
if i.label() == params[ j ]: | |||||
params[j] = i[0] | |||||
else: | |||||
params[j] = defaults[api_details["defaults"][j]] | |||||
except Exception: | |||||
if i[0]==key_connect: | |||||
params[j] = defaults[api_details["defaults"][j]] | |||||
params[ api_details[ 'apikey' ].keys()[ 0 ] ] = api_details[ 'apikey' ][ api_details[ 'apikey' ].keys()[ 0 ] ] | |||||
r = requests.get( url=api_details[ "url" ], params=params ) | |||||
data = r.json() | |||||
data_final = {} | |||||
getData(api_details[ "data_to_receive" ], data, data_final) | |||||
out_format = api_details[ "output_format" ] | |||||
out_final = "" | |||||
isvar = False | |||||
for let in out_format: | |||||
if (let == "{"): | |||||
var = "" | |||||
isvar = True | |||||
continue | |||||
if not isvar: | |||||
out_final += let | |||||
else: | |||||
if let == "}": | |||||
out_final += str( data_final[ var ] ) | |||||
isvar = False | |||||
else: | |||||
var += let | |||||
print ("[KEYWORD]: " + key + "\n") | |||||
print ("[KEYWORD_ID]: " + key + "\n") | |||||
print (out_final) | |||||
else: | |||||
print("Sorry, I didn't quite get that") | |||||
else: | |||||
print("Sorry, I didn't quite get that") |
@ -1,86 +0,0 @@ | |||||
import unittest | |||||
class TestCase(unittest.TestCase): | |||||
@classmethod | |||||
def setUpClass(self): | |||||
from stanford_parser.parser import Parser | |||||
self.parser = Parser() | |||||
def testParse(self): | |||||
dependencies = self.parser.parseToStanfordDependencies("Pick up the tire pallet.") | |||||
tupleResult = [(rel, gov.text, dep.text) for rel, gov, dep in dependencies.dependencies] | |||||
self.assertEqual(tupleResult, [('prt', 'Pick', 'up'), | |||||
('det', 'pallet', 'the'), | |||||
('nn', 'pallet', 'tire'), | |||||
('dobj', 'Pick', 'pallet')]) | |||||
self.assertEqual(dependencies.tagForTokenStandoff(gov), "VB") | |||||
self.assertEqual(dependencies.tagForTokenStandoff(dep), "NN") | |||||
def testParseRefexpNextTo(self): | |||||
dependencies = self.parser.parseToStanfordDependencies("Pick up the tire pallet next to the truck.") | |||||
tupleResult = [(rel, gov.text, dep.text) for rel, gov, dep in dependencies.dependencies] | |||||
self.assertEqual(tupleResult, | |||||
[('prt', 'Pick', 'up'), | |||||
('det', 'pallet', 'the'), | |||||
('nn', 'pallet', 'tire'), | |||||
('dobj', 'Pick', 'pallet'), | |||||
('det', 'truck', 'the'), | |||||
('prep_next_to', 'pallet', 'truck')]) | |||||
def testParseRefexpNear(self): | |||||
dependencies =self.parser.parseToStanfordDependencies("Pick up the tire pallet near the truck.") | |||||
tupleResult = [(rel, gov.text, dep.text) for rel, gov, dep in dependencies.dependencies] | |||||
self.assertEqual(tupleResult, | |||||
[('prt', 'Pick', 'up'), | |||||
('det', 'pallet', 'the'), | |||||
('nn', 'pallet', 'tire'), | |||||
('dobj', 'Pick', 'pallet'), | |||||
('det', 'truck', 'the'), | |||||
('prep_near', 'pallet', 'truck')]) | |||||
def testParseLong(self): | |||||
# this sentence has a self dependency that the python code filters out. | |||||
# between drop and drop. | |||||
dependencies = self.parser.parseToStanfordDependencies("Grab the skid of tires right in front of you " + | |||||
"and drop it off just in front and to the " + | |||||
"right of the far skid of tires.") | |||||
tupleResult = [(rel, gov.text, dep.text) for rel, gov, dep in dependencies.dependencies] | |||||
self.assertEqual(tupleResult, | |||||
[('det', 'skid', 'the'), ('dobj', 'Grab', 'skid'), | |||||
('prep_of', 'skid', 'tires'), ('dep', 'Grab', 'right'), | |||||
('prep_in', 'Grab', 'front'), ('prep_of', 'front', 'you'), | |||||
('conj_and', 'Grab', 'drop'), ('dobj', 'drop', 'it'), ('prt', 'drop', 'off'), | |||||
('advmod', 'drop', 'just'), ('prep_in', 'drop', 'front'), ('det', 'right', 'the'), | |||||
('prep_to', 'drop', 'right'), ('det', 'skid', 'the'), ('amod', 'skid', 'far'), | |||||
('prep_of', 'right', 'skid'), ('prep_of', 'skid', 'tires')]) | |||||
def testAllCaps(self): | |||||
dependencies = self.parser.parseToStanfordDependencies("GO TO THE TIRE PALLET NEXT TO THE TRUCK.") | |||||
tupleResult = [(rel, gov.text, dep.text) for rel, gov, dep in dependencies.dependencies] | |||||
self.assertEqual(tupleResult, | |||||
[('nn', 'PALLET', 'GO'), | |||||
('nn', 'PALLET', 'TO'), | |||||
('nn', 'PALLET', 'THE'), | |||||
('nn', 'PALLET', 'TIRE'), | |||||
('nsubj', 'NEXT', 'PALLET'), | |||||
('dep', 'NEXT', 'TO'), | |||||
('det', 'TRUCK', 'THE'), | |||||
('dobj', 'TO', 'TRUCK')]) | |||||
@ -1,4 +0,0 @@ | |||||
{ | |||||
"How are you?": "I am fine and you?", | |||||
"I am fine too": "That is good to hear" | |||||
} |
@ -1,72 +0,0 @@ | |||||
from __future__ import absolute_import | |||||
from __future__ import division | |||||
from __future__ import print_function | |||||
from __future__ import unicode_literals | |||||
import argparse | |||||
import warnings | |||||
from rasa_nlu.training_data import load_data | |||||
from rasa_nlu import config | |||||
from rasa_nlu.model import Trainer | |||||
import rasa_core | |||||
from rasa_core.agent import Agent | |||||
from rasa_core.policies.keras_policy import KerasPolicy | |||||
from rasa_core.policies.memoization import MemoizationPolicy | |||||
def train_nlu(): | |||||
training_data = load_data('data/nlu-data.md') | |||||
trainer = Trainer(config.load("nlu-config.yml")) | |||||
trainer.train(training_data) | |||||
model_directory = trainer.persist('models/nlu/', fixed_model_name="current") | |||||
return model_directory | |||||
def train_dialogue( | |||||
domain_file="domain.yml", | |||||
model_path="models/dialogue", | |||||
training_data_file="data/stories.md" | |||||
): | |||||
agent = Agent( | |||||
domain_file, | |||||
policies=[MemoizationPolicy(max_history=3), KerasPolicy()] | |||||
) | |||||
training_data = agent.load_data(training_data_file) | |||||
agent.train( | |||||
training_data, | |||||
epochs=400, | |||||
batch_size=100, | |||||
validation_split=0.2 | |||||
) | |||||
agent.persist(model_path) | |||||
return agent | |||||
def train_all(): | |||||
model_directory = train_nlu() | |||||
agent = train_dialogue() | |||||
return [model_directory, agent] | |||||
if __name__ == '__main__': | |||||
warnings.filterwarnings(action='ignore', category=DeprecationWarning) | |||||
rasa_core.utils.configure_colored_logging(loglevel="INFO") | |||||
parser = argparse.ArgumentParser( | |||||
description='starts the bot training') | |||||
parser.add_argument( | |||||
'task', | |||||
choices=["train-nlu", "train-dialogue", "train-all"], | |||||
help="what the bot should do?") | |||||
task = parser.parse_args().task | |||||
# decide what to do based on first parameter of the script | |||||
if task == "train-nlu": | |||||
train_nlu() | |||||
elif task == "train-dialogue": | |||||
train_dialogue() | |||||
elif task == "train-all": | |||||
train_all() |
@ -1,3 +0,0 @@ | |||||
{ | |||||
"location": "Ankara" | |||||
} |
@ -0,0 +1,6 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="JavaScriptSettings"> | |||||
<option name="languageLevel" value="ES6" /> | |||||
</component> | |||||
</project> |
@ -0,0 +1,8 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="ProjectModuleManager"> | |||||
<modules> | |||||
<module fileurl="file://$PROJECT_DIR$/.idea/traffic_analyzer.iml" filepath="$PROJECT_DIR$/.idea/traffic_analyzer.iml" /> | |||||
</modules> | |||||
</component> | |||||
</project> |
@ -0,0 +1,4 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="SerialMonitorSettings" BaudRate="9600" LineEndingsIndex="0" /> | |||||
</project> |
@ -0,0 +1,6 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="VcsDirectoryMappings"> | |||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" /> | |||||
</component> | |||||
</project> |
@ -0,0 +1,141 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true"> | |||||
<generated /> | |||||
</component> | |||||
<component name="CMakeSettings"> | |||||
<configurations> | |||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" /> | |||||
</configurations> | |||||
</component> | |||||
<component name="ChangeListManager"> | |||||
<list default="true" id="568163d1-3480-45a1-9bee-6b3f33a8e8ac" name="Default Changelist" comment=""> | |||||
<change beforePath="$PROJECT_DIR$/master_app/pom.xml" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/master_app/src/main/java/me/yigitcolakoglu/master_app/Main.java" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/master_app/src/main/java/me/yigitcolakoglu/master_app/fan.png" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/sender.py" beforeDir="false" afterPath="$PROJECT_DIR$/sender.py" afterDir="false" /> | |||||
</list> | |||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | |||||
<option name="SHOW_DIALOG" value="false" /> | |||||
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |||||
<option name="LAST_RESOLUTION" value="IGNORE" /> | |||||
</component> | |||||
<component name="ClangdSettings"> | |||||
<option name="formatViaClangd" value="false" /> | |||||
</component> | |||||
<component name="FileEditorManager"> | |||||
<leaf> | |||||
<file pinned="false" current-in-tab="true"> | |||||
<entry file="file://$PROJECT_DIR$/light_control/untitled_0.ino"> | |||||
<provider selected="true" editor-type-id="text-editor" /> | |||||
</entry> | |||||
</file> | |||||
</leaf> | |||||
</component> | |||||
<component name="Git.Settings"> | |||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> | |||||
</component> | |||||
<component name="ProjectFrameBounds" extendedState="6"> | |||||
<option name="x" value="260" /> | |||||
<option name="y" value="47" /> | |||||
<option name="width" value="1400" /> | |||||
<option name="height" value="987" /> | |||||
</component> | |||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> | |||||
<component name="ProjectView"> | |||||
<navigator proportions="" version="1"> | |||||
<foldersAlwaysOnTop value="true" /> | |||||
</navigator> | |||||
<panes> | |||||
<pane id="Scope" /> | |||||
<pane id="ProjectPane"> | |||||
<subPane> | |||||
<expand> | |||||
<path> | |||||
<item name="traffic_analyzer" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="traffic_analyzer" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
<path> | |||||
<item name="traffic_analyzer" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="traffic_analyzer" type="462c0819:PsiDirectoryNode" /> | |||||
<item name="light_control" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
</expand> | |||||
<select /> | |||||
</subPane> | |||||
</pane> | |||||
</panes> | |||||
</component> | |||||
<component name="PropertiesComponent"> | |||||
<property name="WebServerToolWindowFactoryState" value="false" /> | |||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/light_control" /> | |||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> | |||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" /> | |||||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" /> | |||||
</component> | |||||
<component name="RunDashboard"> | |||||
<option name="ruleStates"> | |||||
<list> | |||||
<RuleState> | |||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | |||||
</RuleState> | |||||
<RuleState> | |||||
<option name="name" value="StatusDashboardGroupingRule" /> | |||||
</RuleState> | |||||
</list> | |||||
</option> | |||||
</component> | |||||
<component name="SvnConfiguration"> | |||||
<configuration /> | |||||
</component> | |||||
<component name="TaskManager"> | |||||
<task active="true" id="Default" summary="Default task"> | |||||
<changelist id="568163d1-3480-45a1-9bee-6b3f33a8e8ac" name="Default Changelist" comment="" /> | |||||
<created>1558953924923</created> | |||||
<option name="number" value="Default" /> | |||||
<option name="presentableId" value="Default" /> | |||||
<updated>1558953924923</updated> | |||||
<workItem from="1558953926084" duration="20000" /> | |||||
</task> | |||||
<servers /> | |||||
</component> | |||||
<component name="TimeTrackingManager"> | |||||
<option name="totallyTimeSpent" value="20000" /> | |||||
</component> | |||||
<component name="ToolWindowManager"> | |||||
<frame x="0" y="23" width="1920" height="1031" extended-state="6" /> | |||||
<layout> | |||||
<window_info id="Favorites" side_tool="true" /> | |||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.18036287" /> | |||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> | |||||
<window_info anchor="bottom" id="Database Changes" /> | |||||
<window_info anchor="bottom" id="Version Control" /> | |||||
<window_info anchor="bottom" id="Terminal" /> | |||||
<window_info anchor="bottom" id="Event Log" side_tool="true" /> | |||||
<window_info anchor="bottom" id="Serial Monitor" /> | |||||
<window_info anchor="bottom" id="Message" order="0" /> | |||||
<window_info anchor="bottom" id="Find" order="1" /> | |||||
<window_info anchor="bottom" id="Run" order="2" /> | |||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> | |||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | |||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | |||||
<window_info anchor="bottom" id="TODO" order="6" /> | |||||
<window_info anchor="right" id="Database" /> | |||||
<window_info anchor="right" id="make" /> | |||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> | |||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> | |||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> | |||||
</layout> | |||||
</component> | |||||
<component name="TypeScriptGeneratedFilesManager"> | |||||
<option name="version" value="1" /> | |||||
</component> | |||||
<component name="editorHistoryManager"> | |||||
<entry file="file://$PROJECT_DIR$/light_control/untitled_0.ino"> | |||||
<provider selected="true" editor-type-id="text-editor" /> | |||||
</entry> | |||||
</component> | |||||
</project> |
@ -0,0 +1 @@ | |||||
untitled_0 |
@ -0,0 +1,7 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" /> | |||||
<component name="JavaScriptSettings"> | |||||
<option name="languageLevel" value="ES6" /> | |||||
</component> | |||||
</project> |
@ -0,0 +1,8 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="ProjectModuleManager"> | |||||
<modules> | |||||
<module fileurl="file://$PROJECT_DIR$/.idea/light_control.iml" filepath="$PROJECT_DIR$/.idea/light_control.iml" /> | |||||
</modules> | |||||
</component> | |||||
</project> |
@ -0,0 +1,4 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="SerialMonitorSettings" BaudRate="9600" LineEndingsIndex="0" /> | |||||
</project> |
@ -0,0 +1,6 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="VcsDirectoryMappings"> | |||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> | |||||
</component> | |||||
</project> |
@ -0,0 +1,200 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<project version="4"> | |||||
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true"> | |||||
<generated> | |||||
<config projectName="untitled_0" targetName="untitled_0" /> | |||||
<config projectName="untitled_0" targetName="uno_CORE" /> | |||||
<config projectName="untitled_0" targetName="untitled_0-size" /> | |||||
</generated> | |||||
</component> | |||||
<component name="CMakeSettings"> | |||||
<configurations> | |||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" /> | |||||
</configurations> | |||||
</component> | |||||
<component name="ChangeListManager"> | |||||
<list default="true" id="49f3af82-9ae9-47e3-bda3-caf0b729cc16" name="Default Changelist" comment=""> | |||||
<change beforePath="$PROJECT_DIR$/../master_app/pom.xml" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/../master_app/src/main/java/me/yigitcolakoglu/master_app/Main.java" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/../master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/../master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/../master_app/src/main/java/me/yigitcolakoglu/master_app/fan.png" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/../sender.py" beforeDir="false" afterPath="$PROJECT_DIR$/../sender.py" afterDir="false" /> | |||||
</list> | |||||
<ignored path="$PROJECT_DIR$/cmake-build-debug/" /> | |||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | |||||
<option name="SHOW_DIALOG" value="false" /> | |||||
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | |||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | |||||
<option name="LAST_RESOLUTION" value="IGNORE" /> | |||||
</component> | |||||
<component name="ClangdSettings"> | |||||
<option name="formatViaClangd" value="false" /> | |||||
</component> | |||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" /> | |||||
<component name="FileEditorManager"> | |||||
<leaf> | |||||
<file pinned="false" current-in-tab="true"> | |||||
<entry file="file://$PROJECT_DIR$/light_control.ino"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="-2079"> | |||||
<caret column="20" selection-start-column="20" selection-end-column="20" /> | |||||
<folding> | |||||
<element signature="e#1644#1716#0" expanded="true" /> | |||||
<element signature="e#1739#1800#0" expanded="true" /> | |||||
<element signature="e#2225#2475#0" expanded="true" /> | |||||
<element signature="e#2817#2929#0" expanded="true" /> | |||||
<element signature="e#4794#5445#0" expanded="true" /> | |||||
</folding> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</file> | |||||
</leaf> | |||||
</component> | |||||
<component name="Git.Settings"> | |||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." /> | |||||
</component> | |||||
<component name="IdeDocumentHistory"> | |||||
<option name="CHANGED_PATHS"> | |||||
<list> | |||||
<option value="$PROJECT_DIR$/light_control.ino" /> | |||||
</list> | |||||
</option> | |||||
</component> | |||||
<component name="ProjectFrameBounds" extendedState="6"> | |||||
<option name="x" value="260" /> | |||||
<option name="y" value="47" /> | |||||
<option name="width" value="1400" /> | |||||
<option name="height" value="987" /> | |||||
</component> | |||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> | |||||
<component name="ProjectView"> | |||||
<navigator proportions="" version="1"> | |||||
<foldersAlwaysOnTop value="true" /> | |||||
</navigator> | |||||
<panes> | |||||
<pane id="ProjectPane"> | |||||
<subPane> | |||||
<expand> | |||||
<path> | |||||
<item name="untitled_0" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="light_control" type="47feb1d3:ProjectViewModuleNode" /> | |||||
</path> | |||||
<path> | |||||
<item name="untitled_0" type="b2602c69:ProjectViewProjectNode" /> | |||||
<item name="light_control" type="47feb1d3:ProjectViewModuleNode" /> | |||||
<item name="light_control" type="462c0819:PsiDirectoryNode" /> | |||||
</path> | |||||
</expand> | |||||
<select /> | |||||
</subPane> | |||||
</pane> | |||||
<pane id="Scope" /> | |||||
</panes> | |||||
</component> | |||||
<component name="PropertiesComponent"> | |||||
<property name="WebServerToolWindowFactoryState" value="false" /> | |||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> | |||||
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> | |||||
<property name="nodejs_npm_path_reset_for_default_project" value="true" /> | |||||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" /> | |||||
</component> | |||||
<component name="RunDashboard"> | |||||
<option name="ruleStates"> | |||||
<list> | |||||
<RuleState> | |||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | |||||
</RuleState> | |||||
<RuleState> | |||||
<option name="name" value="StatusDashboardGroupingRule" /> | |||||
</RuleState> | |||||
</list> | |||||
</option> | |||||
</component> | |||||
<component name="RunManager" selected="CMake Application.untitled_0"> | |||||
<configuration name="uno_CORE" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="untitled_0" TARGET_NAME="uno_CORE" CONFIG_NAME="Debug"> | |||||
<method v="2"> | |||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> | |||||
</method> | |||||
</configuration> | |||||
<configuration name="untitled_0-size" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="untitled_0" TARGET_NAME="untitled_0-size" CONFIG_NAME="Debug"> | |||||
<method v="2"> | |||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> | |||||
</method> | |||||
</configuration> | |||||
<configuration name="untitled_0" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="untitled_0" TARGET_NAME="untitled_0" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="untitled_0" RUN_TARGET_NAME="untitled_0"> | |||||
<method v="2"> | |||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" /> | |||||
</method> | |||||
</configuration> | |||||
<list> | |||||
<item itemvalue="CMake Application.uno_CORE" /> | |||||
<item itemvalue="CMake Application.untitled_0" /> | |||||
<item itemvalue="CMake Application.untitled_0-size" /> | |||||
</list> | |||||
</component> | |||||
<component name="SvnConfiguration"> | |||||
<configuration /> | |||||
</component> | |||||
<component name="TaskManager"> | |||||
<task active="true" id="Default" summary="Default task"> | |||||
<changelist id="49f3af82-9ae9-47e3-bda3-caf0b729cc16" name="Default Changelist" comment="" /> | |||||
<created>1558953945551</created> | |||||
<option name="number" value="Default" /> | |||||
<option name="presentableId" value="Default" /> | |||||
<updated>1558953945551</updated> | |||||
<workItem from="1558953946800" duration="81000" /> | |||||
</task> | |||||
<servers /> | |||||
</component> | |||||
<component name="TimeTrackingManager"> | |||||
<option name="totallyTimeSpent" value="81000" /> | |||||
</component> | |||||
<component name="ToolWindowManager"> | |||||
<frame x="0" y="23" width="1920" height="1031" extended-state="6" /> | |||||
<editor active="true" /> | |||||
<layout> | |||||
<window_info id="Favorites" side_tool="true" /> | |||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.18036287" /> | |||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> | |||||
<window_info anchor="bottom" id="Serial Monitor" /> | |||||
<window_info anchor="bottom" id="Database Changes" /> | |||||
<window_info anchor="bottom" id="Version Control" /> | |||||
<window_info anchor="bottom" id="Terminal" /> | |||||
<window_info anchor="bottom" id="Event Log" side_tool="true" /> | |||||
<window_info anchor="bottom" id="CMake" /> | |||||
<window_info anchor="bottom" id="Message" order="0" /> | |||||
<window_info anchor="bottom" id="Find" order="1" /> | |||||
<window_info anchor="bottom" id="Run" order="2" /> | |||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> | |||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | |||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | |||||
<window_info anchor="bottom" id="TODO" order="6" /> | |||||
<window_info anchor="right" id="Database" /> | |||||
<window_info anchor="right" id="make" /> | |||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> | |||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> | |||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> | |||||
</layout> | |||||
</component> | |||||
<component name="TypeScriptGeneratedFilesManager"> | |||||
<option name="version" value="1" /> | |||||
</component> | |||||
<component name="editorHistoryManager"> | |||||
<entry file="file://$PROJECT_DIR$/light_control.ino"> | |||||
<provider selected="true" editor-type-id="text-editor"> | |||||
<state relative-caret-position="-2079"> | |||||
<caret column="20" selection-start-column="20" selection-end-column="20" /> | |||||
<folding> | |||||
<element signature="e#1644#1716#0" expanded="true" /> | |||||
<element signature="e#1739#1800#0" expanded="true" /> | |||||
<element signature="e#2225#2475#0" expanded="true" /> | |||||
<element signature="e#2817#2929#0" expanded="true" /> | |||||
<element signature="e#4794#5445#0" expanded="true" /> | |||||
</folding> | |||||
</state> | |||||
</provider> | |||||
</entry> | |||||
</component> | |||||
</project> |
@ -0,0 +1,190 @@ | |||||
#include <Arduino.h> | |||||
#include <ESP8266WiFi.h> | |||||
#include <algorithm> // std::min | |||||
#ifndef STASSID | |||||
#define STASSID "ZyXEL5500bT5" | |||||
#define STAPSK "eBusgxczl5" | |||||
#endif | |||||
/* | |||||
SWAP_PINS: | |||||
0: use Serial1 for logging (legacy example) | |||||
1: configure Hardware Serial port on RX:GPIO13 TX:GPIO15 | |||||
and use SoftwareSerial for logging on | |||||
standard Serial pins RX:GPIO3 and TX:GPIO1 | |||||
*/ | |||||
#define SWAP_PINS 0 | |||||
/* | |||||
SERIAL_LOOPBACK | |||||
0: normal serial operations | |||||
1: RX-TX are internally connected (loopback) | |||||
*/ | |||||
#define SERIAL_LOOPBACK 0 | |||||
#define BAUD_SERIAL 115200 | |||||
#define BAUD_LOGGER 115200 | |||||
#define RXBUFFERSIZE 1024 | |||||
//////////////////////////////////////////////////////////// | |||||
#if SERIAL_LOOPBACK | |||||
#undef BAUD_SERIAL | |||||
#define BAUD_SERIAL 3000000 | |||||
#include <esp8266_peri.h> | |||||
#endif | |||||
#if SWAP_PINS | |||||
#include <SoftwareSerial.h> | |||||
SoftwareSerial* logger = nullptr; | |||||
#else | |||||
#define logger (&Serial1) | |||||
#endif | |||||
#define STACK_PROTECTOR 512 // bytes | |||||
//how many clients should be able to telnet to this ESP8266 | |||||
#define MAX_SRV_CLIENTS 2 | |||||
const char* ssid = STASSID; | |||||
const char* password = STAPSK; | |||||
const int port = 23; | |||||
WiFiServer server(port); | |||||
WiFiClient serverClients[MAX_SRV_CLIENTS]; | |||||
void setup() { | |||||
Serial.begin(BAUD_SERIAL); | |||||
Serial.setRxBufferSize(RXBUFFERSIZE); | |||||
#if SWAP_PINS | |||||
Serial.swap(); | |||||
// Hardware serial is now on RX:GPIO13 TX:GPIO15 | |||||
// use SoftwareSerial on regular RX(3)/TX(1) for logging | |||||
logger = new SoftwareSerial(3, 1); | |||||
logger->begin(BAUD_LOGGER); | |||||
logger->println("\n\nUsing SoftwareSerial for logging"); | |||||
#else | |||||
logger->begin(BAUD_LOGGER); | |||||
logger->println("\n\nUsing Serial1 for logging"); | |||||
#endif | |||||
logger->println(ESP.getFullVersion()); | |||||
logger->printf("Serial baud: %d (8n1: %d KB/s)\n", BAUD_SERIAL, BAUD_SERIAL * 8 / 10 / 1024); | |||||
logger->printf("Serial receive buffer size: %d bytes\n", RXBUFFERSIZE); | |||||
#if SERIAL_LOOPBACK | |||||
USC0(0) |= (1 << UCLBE); // incomplete HardwareSerial API | |||||
logger->println("Serial Internal Loopback enabled"); | |||||
#endif | |||||
WiFi.mode(WIFI_STA); | |||||
WiFi.begin(ssid, password); | |||||
logger->print("\nConnecting to "); | |||||
logger->println(ssid); | |||||
while (WiFi.status() != WL_CONNECTED) { | |||||
logger->print('.'); | |||||
delay(500); | |||||
} | |||||
logger->println(); | |||||
logger->print("connected, address="); | |||||
logger->println(WiFi.localIP()); | |||||
//start server | |||||
server.begin(); | |||||
server.setNoDelay(true); | |||||
logger->print("Ready! Use 'telnet "); | |||||
logger->print(WiFi.localIP()); | |||||
logger->printf(" %d' to connect\n", port); | |||||
} | |||||
void loop() { | |||||
//check if there are any new clients | |||||
if (server.hasClient()) { | |||||
//find free/disconnected spot | |||||
int i; | |||||
for (i = 0; i < MAX_SRV_CLIENTS; i++) | |||||
if (!serverClients[i]) { // equivalent to !serverClients[i].connected() | |||||
serverClients[i] = server.available(); | |||||
logger->print("New client: index "); | |||||
logger->print(i); | |||||
break; | |||||
} | |||||
//no free/disconnected spot so reject | |||||
if (i == MAX_SRV_CLIENTS) { | |||||
server.available().println("busy"); | |||||
// hints: server.available() is a WiFiClient with short-term scope | |||||
// when out of scope, a WiFiClient will | |||||
// - flush() - all data will be sent | |||||
// - stop() - automatically too | |||||
logger->printf("server is busy with %d active connections\n", MAX_SRV_CLIENTS); | |||||
} | |||||
} | |||||
//check TCP clients for data | |||||
#if 1 | |||||
// Incredibly, this code is faster than the bufferred one below - #4620 is needed | |||||
// loopback/3000000baud average 348KB/s | |||||
for (int i = 0; i < MAX_SRV_CLIENTS; i++) | |||||
while (serverClients[i].available() && Serial.availableForWrite() > 0) { | |||||
// working char by char is not very efficient | |||||
Serial.write(serverClients[i].read()); | |||||
} | |||||
#else | |||||
// loopback/3000000baud average: 312KB/s | |||||
for (int i = 0; i < MAX_SRV_CLIENTS; i++) | |||||
while (serverClients[i].available() && Serial.availableForWrite() > 0) { | |||||
size_t maxToSerial = std::min(serverClients[i].available(), Serial.availableForWrite()); | |||||
maxToSerial = std::min(maxToSerial, (size_t)STACK_PROTECTOR); | |||||
uint8_t buf[maxToSerial]; | |||||
size_t tcp_got = serverClients[i].read(buf, maxToSerial); | |||||
size_t serial_sent = Serial.write(buf, tcp_got); | |||||
if (serial_sent != maxToSerial) { | |||||
logger->printf("len mismatch: available:%zd tcp-read:%zd serial-write:%zd\n", maxToSerial, tcp_got, serial_sent); | |||||
} | |||||
} | |||||
#endif | |||||
// determine maximum output size "fair TCP use" | |||||
// client.availableForWrite() returns 0 when !client.connected() | |||||
size_t maxToTcp = 0; | |||||
for (int i = 0; i < MAX_SRV_CLIENTS; i++) | |||||
if (serverClients[i]) { | |||||
size_t afw = serverClients[i].availableForWrite(); | |||||
if (afw) { | |||||
if (!maxToTcp) { | |||||
maxToTcp = afw; | |||||
} else { | |||||
maxToTcp = std::min(maxToTcp, afw); | |||||
} | |||||
} else { | |||||
// warn but ignore congested clients | |||||
logger->println("one client is congested"); | |||||
} | |||||
} | |||||
//check UART for data | |||||
size_t len = std::min((size_t)Serial.available(), maxToTcp); | |||||
len = std::min(len, (size_t)STACK_PROTECTOR); | |||||
if (len) { | |||||
uint8_t sbuf[len]; | |||||
size_t serial_got = Serial.readBytes(sbuf, len); | |||||
// push UART data to all connected telnet clients | |||||
for (int i = 0; i < MAX_SRV_CLIENTS; i++) | |||||
// if client.availableForWrite() was 0 (congested) | |||||
// and increased since then, | |||||
// ensure write space is sufficient: | |||||
if (serverClients[i].availableForWrite() >= serial_got) { | |||||
size_t tcp_sent = serverClients[i].write(sbuf, serial_got); | |||||
if (tcp_sent != len) { | |||||
logger->printf("len mismatch: available:%zd serial-read:%zd tcp-write:%zd\n", len, serial_got, tcp_sent); | |||||
} | |||||
} | |||||
} | |||||
} |