diff --git a/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form b/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form index 1a3124f..3ae0e7d 100644 --- a/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form +++ b/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.form @@ -358,6 +358,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java b/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java index 1c0f1df..af568e6 100644 --- a/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java +++ b/master_app/src/main/java/me/yigitcolakoglu/master_app/cameraForm.java @@ -69,6 +69,8 @@ public class cameraForm extends javax.swing.JFrame implements ChangeListener{ fan_rpm = new javax.swing.JLabel(); fps_label = new javax.swing.JLabel(); manage_button = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + jLabel8 = new javax.swing.JLabel(); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); @@ -276,6 +278,27 @@ public class cameraForm extends javax.swing.JFrame implements ChangeListener{ jTabbedPane1.addTab("Cameras", jPanel2); + jLabel8.setText("deneme"); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(493, 493, 493) + .addComponent(jLabel8) + .addContainerGap(1074, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(115, 115, 115) + .addComponent(jLabel8) + .addContainerGap(686, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("tab2", jPanel4); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -471,7 +494,7 @@ public class cameraForm extends javax.swing.JFrame implements ChangeListener{ System.out.println(e.toString()); null_reps+=1; } - if (null_reps >= 100){ + if (null_reps >= 1000000000){ run = false; System.out.println("socket closed"); } @@ -523,9 +546,11 @@ public class cameraForm extends javax.swing.JFrame implements ChangeListener{ private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JButton manage_button; private javax.swing.JLabel ram_temp; diff --git a/master_app/src/main/java/me/yigitcolakoglu/master_app/ips.json b/master_app/src/main/java/me/yigitcolakoglu/master_app/ips.json index efd4cca..1fc6b1e 100644 --- a/master_app/src/main/java/me/yigitcolakoglu/master_app/ips.json +++ b/master_app/src/main/java/me/yigitcolakoglu/master_app/ips.json @@ -1,5 +1,5 @@ { "qr": "127.0.0.3", "intersection": "127.0.0.1", - "ambulance": "192.168.1.35" + "ambulance": "192.168.2.75" } \ No newline at end of file diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/Main.class b/master_app/target/classes/me/yigitcolakoglu/master_app/Main.class index 5f50643..fc2d4c3 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/Main.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/Main.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$1.class b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$1.class index 67caa5b..dfee08e 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$1.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$1.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$2.class b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$2.class index e9312a6..8210f24 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$2.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$2.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$3.class b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$3.class index 5e83104..96a4909 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$3.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$3.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$4.class b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$4.class index 7a64ca6..ee23802 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$4.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$4.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$5.class b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$5.class index 44062f5..395b1e0 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$5.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$5.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$6.class b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$6.class index 47ad8a0..e1ada3f 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$6.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm$6.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm.class b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm.class index b94b563..4758661 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/cameraForm.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$1.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$1.class index f1aa674..38933eb 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$1.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$1.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$2.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$2.class index 5c6e97e..8d71d4f 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$2.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$2.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$3.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$3.class index fbd4df3..9dafc0a 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$3.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$3.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$4.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$4.class index ea4e612..db958ae 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$4.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$4.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$5.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$5.class index 3387011..0ff578d 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$5.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$5.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$6.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$6.class index 8ef68c3..776bb4d 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$6.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$6.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$7.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$7.class index 5c699ac..cc00cae 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$7.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$7.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$8.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$8.class index ff5972c..809de12 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$8.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$8.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$9.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$9.class index 8b1cd3e..9077dc0 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$9.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm$9.class differ diff --git a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm.class b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm.class index 0989692..a543216 100644 Binary files a/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm.class and b/master_app/target/classes/me/yigitcolakoglu/master_app/managementForm.class differ diff --git a/telnet/.vscode/arduino.json b/telnet/.vscode/arduino.json new file mode 100644 index 0000000..35404ea --- /dev/null +++ b/telnet/.vscode/arduino.json @@ -0,0 +1,6 @@ +{ + "sketch": "main.ino", + "board": "esp8266:esp8266:generic", + "configuration": "xtal=80,vt=flash,exception=disabled,ssl=all,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=512K,led=2,sdk=nonosdk221,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200", + "port": "/dev/ttyUSB0" +} \ No newline at end of file diff --git a/telnet/.vscode/c_cpp_properties.json b/telnet/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..6c1b09b --- /dev/null +++ b/telnet/.vscode/c_cpp_properties.json @@ -0,0 +1,19 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "/home/yigit/.arduino15/packages/esp8266/tools/**", + "/home/yigit/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/**", + "/home/yigit/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/cores/esp8266", + "/home/yigit/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ESP8266WiFi/src" + ], + "forcedInclude": [], + "intelliSenseMode": "gcc-x64", + "compilerPath": "/usr/bin/gcc", + "cStandard": "c11", + "cppStandard": "c++17" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/telnet/.vscode/settings.json b/telnet/.vscode/settings.json new file mode 100644 index 0000000..03ba48b --- /dev/null +++ b/telnet/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "new": "cpp" + } +} \ No newline at end of file diff --git a/telnet/main.ino b/telnet/main.ino new file mode 100644 index 0000000..badeb0b --- /dev/null +++ b/telnet/main.ino @@ -0,0 +1,68 @@ +#include "Arduino.h" +#include "Esp.h" +#include "ESP8266WiFi.h" + +const char* ssid = "AirTies_Air5343"; +const char* password = "yigit007"; + +WiFiServer listenServer(31); +WiFiServer broadcastServer(69); + +void setup() { + + Serial.begin(115200); + pinMode(12,OUTPUT); + delay(1000); + WiFi.begin(ssid, password); + + while (WiFi.status() != WL_CONNECTED) { + digitalWrite(12,HIGH); + delay(150); + Serial.println("Connecting.."); + digitalWrite(12,LOW); + delay(150); + } + + Serial.print("Connected to WiFi. IP:"); + Serial.println(WiFi.localIP()); + + listenServer.begin(); + broadcastServer.begin(); + digitalWrite(12,HIGH); +} + +void loop() { + + WiFiClient listener = listenServer.available(); + WiFiClient sender = broadcastServer.available(); + String message = ""; + if (listener) { + while (listener.connected()) { + if(!sender){ + Serial.println("Waiting sender"); + sender = broadcastServer.available(); + } + message = ""; + while (listener.available()>0) { + char c = listener.read(); + message += c; + } + if(message != ""){ + Serial.println(message); + Serial.print("Connected:"); + Serial.println(sender.connected()); + Serial.print("Available:"); + Serial.println(sender.available()); + if(sender && sender.connected()){ + Serial.println("Bookmark 1"); + sender.println(message); + sender.stop(); + } + } + delay(10); + } + + listener.stop(); + + } +} \ No newline at end of file diff --git a/telnet/telnet.ino b/telnet/telnet.ino deleted file mode 100644 index d7088cb..0000000 --- a/telnet/telnet.ino +++ /dev/null @@ -1,231 +0,0 @@ -/* - WiFiTelnetToSerial - Example Transparent UART to Telnet Server for esp8266 - - Copyright (c) 2015 Hristo Gochkov. All rights reserved. - This file is part of the ESP8266WiFi library for Arduino environment. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include - -#include // std::min - -#ifndef STASSID -#define STASSID "AirTies_Air5343" -#define STAPSK "yigit007" -#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 - -#define ONE 12 -#define TWO 14 - -//////////////////////////////////////////////////////////// - -#if SERIAL_LOOPBACK -#undef BAUD_SERIAL -#define BAUD_SERIAL 3000000 -#include -#endif - -#if SWAP_PINS -#include -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; - -int led_one = 0; -int led_two = 0; - -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 - int val = 0; - for (int i = 0; i < MAX_SRV_CLIENTS; i++) - while (serverClients[i].available() && Serial.availableForWrite() > 0) { - // working char by char is not very efficient - char telnet_val = serverClients[i].read(); - if (telnet_val == 48) { // 0 - if (val++ == 0) { - led_one = 0; - } else { - led_two = 0; - } - } else if (telnet_val == 49) { // 1 - if (val++ == 0) { - led_one = 1; - } else { - led_two = 1; - } - } - Serial.write(telnet_val); - } -#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 - digitalWrite(ONE, led_one); - digitalWrite(TWO, led_two); - // 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); - } - } - } -}