UDP_klient.pde
/* * * * * * * * * * * * * * * *
* Auto ovládané cez internet
* Java klient na UDP komunikáciu
*
* Autor: scsc
*
* Licencia: Voľný softvér, Open-Source GNU GPL v3+
* Všeobecná verejná licencia. Program je dovolené voľne šíriť a upravovať.
* Upravený program / časť programu môže ktokoľvek využiť ako na osobné,
* tak aj komerčné účely, ale nemôže ho vydať s vlastným copyrightom,
* ktorý nie je kompatibilný s GNU GPL v3+.
* gnu.org/licenses/gpl-faq.html
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Neoficiálna G4P knižnica pre grafické rozhranie
import g4p_controls.*;
// Neoficiálna UDP sieťová knižnica
import hypermedia.net.*;
// Oficiálna TCP sieťová knižnica
import processing.net.*;
//import java.net.InetAddress;
UDP udp; //objekt pre UDP spojenie
boolean connected=false; //stav pripojenia na riadenie vozidla
boolean cam_connected=false; //stav pripojenia na riadenie kamery
int run = 0;
PImage bg;
//aktualne stlaceny znak
char cam = ' ';
int cam_i = 0; //index nastaveny spolu so znakom v premennej cam
char motor = ' ';
char riadenie = ' ';
char trubenie = ' ';
//predch. znak aby pouzivatel mohol stlacit dalsi znak bez pustenia predchadzajuceho
char motor_last = ' ';
char riadenie_last = ' ';
char trubenie_last = ' ';
//konstantne premenne urcujuce znak posielany po pusteni klavesy
char MOTOR_STOP = 'x';
char RIADENIE_STRED = 'r';
char TRUBENIE_STOP = 'z';
//Znak na trubenie
char trubenie_znaky[]=
{
't','z'
};
//Zoznam znakov určených na riadenie pohonu vozidla
char motor_znaky[]=
{
'q','w','e','s','y','x','c'
};
//Zoznam znakov určených na otáčanie predných kolies
char riadenie_znaky[]=
{
'a','d','r','f','g'
};
//Klávesy, ktorými sa ovláda otáčanie kamery
char cam_znaky[]=
{
'8','2','6','4','9','7','3','1','0','-','+'
};
//Hodnoty posielané do kamery (index súvisí s cam_znaky[])
String cam_znaky_web_value[]=
{
"1","2","3","4","5","6","7","8","9","10","11"
};
//Prepínanie jazykov
int SLOVAK = 0;
int ENGLISH = 1;
int language = 0;
public void setup(){
//frame.removeNotify();
//frame.setUndecorated(true);
//frame.addNotify();
size(630, 225, JAVA2D);
bg = loadImage("background.png");
createGUI();
customGUI();
// Place your setup code here
// Kod pisat sem, zaciatok funkcie setup je automaticky generovany
udp = new UDP(this); //inicializacia pre UDP objekt
}
public void draw(){
background(bg);
//Posielat znaky z klavesnice ak je pripojenie zapnute
//V pripade, ze nie je stlacena klavesa, poslat STOP/STRED hodnotu
if(connected==true)
{
if(!focused)
{
motor=MOTOR_STOP;
riadenie=RIADENIE_STRED;
trubenie=TRUBENIE_STOP;
}
run++;
if(run>2)
{
http_udp_cmd();
run=0;
}
}
}
// Use this method to add additional statements
// to customise the GUI controls
public void customGUI(){
}
//Funkcia na ovládanie kamery
void http_tcp_cam(String value, boolean start)
{
String get = "GET /media/?action=cmd&code=";
if(start==true)
{
get += "2";
}
else
{
get += "3";
}
get += "&value=";
get += value;
get += "&user=";
get += textfield_cam_meno.getText();
get += "&pwd=";
get += textfield_cam_heslo.getText();
get += " HTTP/1.0\r\n";
/* Zvysok nie je potrebny pre spravnu funkcnost:
get += Host: ";
get += textfield_cam.getText();
get += ":";
get += textfield_camport.getText();
get += "\r\n";*/
Client client = new Client(this, textfield_cam.getText(), Integer.parseInt(textfield_camport.getText()));
client.write(get+"\r\n");
client.stop();
//Zmena stavu za ucelom informovania pouzivatela o funkcnosti spojenia
label_cam_stav.setText("Pripojené");
label_cam_stav.setLocalColorScheme(GCScheme.GREEN_SCHEME);
}
//Funkcia na ovládanie vozidla (pohon a riadenie predných kolies)
void http_udp_cmd()
{
String cmd = "?p=";
cmd += textfield_heslo.getText();
cmd += "&cmd=";
//ak nie je stlacena klavesa pre motor tak ho zastavit
if(motor==' ')
{
cmd += MOTOR_STOP;
label_vstup.setText("cmd="+MOTOR_STOP);
}
else
{
cmd += motor;
label_vstup.setText("cmd="+motor);
}
//ak nie je stlacena klavesa pre riadenie tak ho otocit na stred
if(riadenie==' ')
{
cmd += RIADENIE_STRED;
label_vstup.setText(label_vstup.getText()+RIADENIE_STRED);
}
else
{
cmd += riadenie;
label_vstup.setText(label_vstup.getText()+riadenie);
}
//ak nie je stlacena klavesa pre riadenie tak vypnut trubenie
if(trubenie==' ')
{
cmd += TRUBENIE_STOP;
label_vstup.setText(label_vstup.getText()+TRUBENIE_STOP);
}
else
{
cmd += trubenie;
label_vstup.setText(label_vstup.getText()+trubenie);
}
//poslat cely zlozeny prikaz do vozidla
udp.send(cmd+".",textfield_ip.getText(),Integer.parseInt(textfield_port.getText()));
}
//Funkcia na nastavenie novej hodnoty latencie
void http_lat()
{
label_vstup.setText("lat="+textfield_lat.getText());
udp.send("?p="+textfield_heslo.getText()+"&lat="+textfield_lat.getText()+".",textfield_ip.getText(),Integer.parseInt(textfield_port.getText()));
}
//Funkcia na nastavenie nového znaku pre pohon vozidla
void motor_set(char c)
{
//ak este nie su stlacene 2 klavesy pre motor
if(motor_last==' ')
{
//ak zatial nie je ziaden pohyb, spustit prikaz priamo
if(motor==' ')
{
motor=c;
}
//ak sa uz motor pohybuje, pamatat si dalsi prikaz
else if(motor!=c)
{
motor_last=motor;
motor=c;
}
}
}
//Funkcia na nastavenie nového znaku na otáčanie predných kolies
void riadenie_set(char c)
{
//ak este nie su stlacene 2 klavesy pre riadenie
if(riadenie_last==' ')
{
//ak zatial nie je ziaden pohyb, spustit prikaz priamo
if(riadenie==' ')
{
riadenie=c;
}
//ak sa uz riadenie pohybuje, pamatat si dalsi prikaz
else if(riadenie!=c)
{
riadenie_last=riadenie;
riadenie=c;
}
}
}
//Funkcia na nastavenie nového znaku pre pohon vozidla
void trubenie_set(char c)
{
//ak este nie su stlacene 2 klavesy pre motor
if(trubenie_last==' ')
{
//ak zatial nie je ziaden pohyb, spustit prikaz priamo
if(trubenie==' ')
{
trubenie=c;
}
//ak sa uz motor pohybuje, pamatat si dalsi prikaz
else if(trubenie!=c)
{
trubenie_last=trubenie;
trubenie=c;
}
}
}
//Event vykonaný po stlačení klávesy
void keyPressed()
{
for(int i=0;i<motor_znaky.length;i++)
{
if(key==motor_znaky[i])
{
motor_set(key);
}
}
for(int i=0;i<riadenie_znaky.length;i++)
{
if(key==riadenie_znaky[i])
{
riadenie_set(key);
}
}
for(int i=0;i<trubenie_znaky.length;i++)
{
if(key==trubenie_znaky[i])
{
trubenie_set(key);
}
}
for(int i=0;i<cam_znaky.length;i++)
{
if(cam_connected && key==cam_znaky[i] && key!=cam)
{
http_tcp_cam(cam_znaky_web_value[cam_i],false);
cam=key;
cam_i=i;
http_tcp_cam(cam_znaky_web_value[cam_i],true);
label_cam_vstup.setText(cam_znaky[cam_i]+" start");
}
}
}
//Event vykonaný po pustení klávesy
void keyReleased()
{
if(motor==key)
{
motor=motor_last;
motor_last=' ';
}
if(motor_last==key)
{
motor_last=' ';
}
if(riadenie==key)
{
riadenie=riadenie_last;
riadenie_last=' ';
}
if(riadenie_last==key)
{
riadenie_last=' ';
}
if(trubenie==key)
{
trubenie=trubenie_last;
trubenie_last=' ';
}
if(trubenie_last==key)
{
trubenie_last=' ';
}
if(cam_connected && cam==key)
{
http_tcp_cam(cam_znaky_web_value[cam_i],false);
label_cam_vstup.setText(cam_znaky[cam_i]+" stop");
cam=' ';
}
}
gui.pde
/* =========================================================
* ==== WARNING ===
* =========================================================
* The code in this tab has been generated from the GUI form
* designer and care should be taken when editing this file.
* Only add/edit code inside the event handlers i.e. only
* use lines between the matching comment tags. e.g.
void myBtnEvents(GButton button) { //_CODE_:button1:12356:
// It is safe to enter your event code here
} //_CODE_:button1:12356:
* Do not rename this tab!
* =========================================================
*/
public void textfield_ip_change1(GTextField source, GEvent event) { //_CODE_:textfield_ip:814564:
} //_CODE_:textfield_ip:814564:
public void button_pripojit_click1(GButton source, GEvent event) { //_CODE_:button_pripojit:983706:
connected=true;
if(language==SLOVAK)
label_stav.setText("Pripojené");
else if(language==ENGLISH)
label_stav.setText("Connected");
label_stav.setLocalColorScheme(GCScheme.GREEN_SCHEME);
} //_CODE_:button_pripojit:983706:
public void button_odpojit_click1(GButton source, GEvent event) { //_CODE_:button_odpojit:319981:
connected=false;
if(language==SLOVAK)
label_stav.setText("Odpojené");
else if(language==ENGLISH)
label_stav.setText("Disconnected");
label_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
} //_CODE_:button_odpojit:319981:
public void textfield_port_change1(GTextField source, GEvent event) { //_CODE_:textfield_port:687531:
} //_CODE_:textfield_port:687531:
public void textfield_lat_change1(GTextField source, GEvent event) { //_CODE_:textfield_lat:680648:
} //_CODE_:textfield_lat:680648:
public void button_lat_click1(GButton source, GEvent event) { //_CODE_:button_lat:238999:
http_lat();
} //_CODE_:button_lat:238999:
public void textfield_cam_change1(GTextField source, GEvent event) { //_CODE_:textfield_cam:936788:
} //_CODE_:textfield_cam:936788:
public void textfield_heslo_change1(GTextField source, GEvent event) { //_CODE_:textfield_heslo:925213:
} //_CODE_:textfield_heslo:925213:
public void textfield_noveheslo_change1(GTextField source, GEvent event) { //_CODE_:textfield_noveheslo:703450:
} //_CODE_:textfield_noveheslo:703450:
public void button_zmenitheslo_click1(GButton source, GEvent event) { //_CODE_:button_zmenitheslo:596901:
String cmd = "?p=";
cmd += textfield_heslo.getText();
cmd += "&c=";
cmd += textfield_noveheslo.getText();
label_vstup.setText("changepass...");
udp.send(cmd+".",textfield_ip.getText(),Integer.parseInt(textfield_port.getText()));
} //_CODE_:button_zmenitheslo:596901:
public void textfield_camport_change1(GTextField source, GEvent event) { //_CODE_:textfield_camport:545415:
} //_CODE_:textfield_camport:545415:
public void button_cam_pripojit_click1(GButton source, GEvent event) { //_CODE_:button_cam_pripojit:698118:
cam_connected=true;
if(language==SLOVAK)
label_cam_stav.setText("Pripravené");
else if(language==ENGLISH)
label_cam_stav.setText("Ready");
label_cam_stav.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
} //_CODE_:button_cam_pripojit:698118:
public void button_cam_odpojit_click1(GButton source, GEvent event) { //_CODE_:button_cam_odpojit:802027:
cam_connected=false;
if(language==SLOVAK)
label_cam_stav.setText("Odpojené");
else if(language==ENGLISH)
label_cam_stav.setText("Disconnected");
label_cam_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
} //_CODE_:button_cam_odpojit:802027:
public void textfield_cam_heslo_change1(GTextField source, GEvent event) { //_CODE_:textfield_cam_heslo:589739:
} //_CODE_:textfield_cam_heslo:589739:
public void textfield_cam_meno_change1(GTextField source, GEvent event) { //_CODE_:textfield_cam_meno:223393:
} //_CODE_:textfield_cam_meno:223393:
public void button_language_click1(GButton source, GEvent event) { //_CODE_:button_language:808478:
if(language==SLOVAK)
{
language=ENGLISH;
//zmena vsetkych statickych textov na anglicke
frame.setTitle("Internet Controlled Car");
label1.setText("Internet Controlled Car");
label6.setText("Vehicle address");
button_pripojit.setText("Connect");
button_odpojit.setText("Stop");
label2.setText("Command:");
label9.setText("State:");
label_stav.setText("Disconnected");
label3.setText("Settings");
label5.setText("Latency [ms]:");
button_lat.setText("Change");
label8.setText("Camera address");
label10.setText("Camera connection");
label11.setText("Password");
label12.setText("New pass");
button_zmenitheslo.setText("Change");
label13.setText("To change pass you need to enter both old and new one");
label14.setText("Port:");
button_cam_pripojit.setText("Connect");
button_cam_odpojit.setText("Stop");
label15.setText("State:");
label16.setText("Settings");
label18.setText("Password");
label17.setText("Username");
label19.setText("Command:");
label_prikazy.setText("Commands to control using keybaord:");
label_prikazy1.setText("Vehicle: q,w,e,r,a,s,d,f,g,y,x,c,t,z");
label_prikazy2.setText("Cam: numbers, -, +");
button_language.setText("Slovak version");
//naformatovat texty
label1.setTextBold();
label1.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label6.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_ip.setLocalColorScheme(GCScheme.GREEN_SCHEME);
button_pripojit.setTextBold();
button_odpojit.setTextBold();
button_odpojit.setLocalColorScheme(GCScheme.RED_SCHEME);
label2.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_vstup.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label9.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
label4.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_port.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_lat.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label3.setTextBold();
label3.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label5.setLocalColorScheme(GCScheme.BLUE_SCHEME);
button_lat.setTextBold();
button_lat.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_cam.setLocalColorScheme(GCScheme.CYAN_SCHEME);
label8.setLocalColorScheme(GCScheme.CYAN_SCHEME);
label10.setTextBold();
label10.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label11.setTextBold();
label11.setLocalColorScheme(GCScheme.RED_SCHEME);
label12.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
textfield_heslo.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_noveheslo.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
button_zmenitheslo.setTextBold();
label13.setLocalColorScheme(GCScheme.BLUE_SCHEME);
button_cam_pripojit.setTextBold();
button_cam_pripojit.setLocalColorScheme(GCScheme.GREEN_SCHEME);
button_cam_odpojit.setTextBold();
button_cam_odpojit.setLocalColorScheme(GCScheme.RED_SCHEME);
label15.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_cam_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
label16.setTextBold();
label16.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label18.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_cam_heslo.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label17.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
textfield_cam_meno.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
label19.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_cam_vstup.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
label_prikazy.setTextBold();
label_prikazy.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label_prikazy1.setTextItalic();
label_prikazy1.setLocalColorScheme(GCScheme.RED_SCHEME);
label_prikazy2.setTextItalic();
label_prikazy2.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
button_language.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
//odpojit kameru
cam_connected=false;
label_cam_stav.setText("Disconnected");
label_cam_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
//odpojit vozidlo
connected=false;
label_stav.setText("Disconnected");
label_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
}
else if(language==ENGLISH)
{
language=SLOVAK;
//zmena vsetkych statickych textov na slovenske
frame.setTitle("Ovládanie auta cez internet");
label1.setText("Ovládanie auta cez internet");
label6.setText("Pripojiť na adresu");
button_pripojit.setText("Pripojiť");
button_odpojit.setText("Odpojiť");
label2.setText("Príkaz:");
label9.setText("Stav:");
label_stav.setText("Odpojené");
label3.setText("Nastavenie");
label5.setText("Latencia [ms]:");
button_lat.setText("Zmeniť");
label8.setText("Adresa pre kameru");
label10.setText("Pripojenie na kameru");
label11.setText("Heslo");
label12.setText("Nové heslo");
button_zmenitheslo.setText("Zmeniť");
label13.setText("Pre zmenu hesla je potrebné zadať staré aj nové heslo");
label14.setText("Port:");
button_cam_pripojit.setText("Pripojiť");
button_cam_odpojit.setText("Odpojiť");
label15.setText("Stav:");
label16.setText("Nastavenie");
label18.setText("Heslo");
label17.setText("Meno");
label19.setText("Príkaz:");
label_prikazy.setText("Príkazy na ovládanie pomocou klávesnice:");
label_prikazy1.setText("Vozidlo: q,w,e,r,a,s,d,f,g,y,x,c,t,z");
label_prikazy2.setText("Kamera: čísla, -, +");
button_language.setText("English version");
//naformatovat texty
label1.setTextBold();
label1.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label6.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_ip.setLocalColorScheme(GCScheme.GREEN_SCHEME);
button_pripojit.setTextBold();
button_odpojit.setTextBold();
button_odpojit.setLocalColorScheme(GCScheme.RED_SCHEME);
label2.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_vstup.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label9.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
label4.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_port.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_lat.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label3.setTextBold();
label3.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label5.setLocalColorScheme(GCScheme.BLUE_SCHEME);
button_lat.setTextBold();
button_lat.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_cam.setLocalColorScheme(GCScheme.CYAN_SCHEME);
label8.setLocalColorScheme(GCScheme.CYAN_SCHEME);
label10.setTextBold();
label10.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label11.setTextBold();
label11.setLocalColorScheme(GCScheme.RED_SCHEME);
label12.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
textfield_heslo.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_noveheslo.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
button_zmenitheslo.setTextBold();
label13.setLocalColorScheme(GCScheme.BLUE_SCHEME);
button_cam_pripojit.setTextBold();
button_cam_pripojit.setLocalColorScheme(GCScheme.GREEN_SCHEME);
button_cam_odpojit.setTextBold();
button_cam_odpojit.setLocalColorScheme(GCScheme.RED_SCHEME);
label15.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_cam_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
label16.setTextBold();
label16.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label18.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_cam_heslo.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label17.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
textfield_cam_meno.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
label19.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_cam_vstup.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
label_prikazy.setTextBold();
label_prikazy.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label_prikazy1.setTextItalic();
label_prikazy1.setLocalColorScheme(GCScheme.RED_SCHEME);
label_prikazy2.setTextItalic();
label_prikazy2.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
button_language.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
//odpojit kameru
cam_connected=false;
label_cam_stav.setText("Odpojené");
label_cam_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
//odpojit vozidlo
connected=false;
label_stav.setText("Odpojené");
label_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
}
} //_CODE_:button_language:808478:
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.GOLD_SCHEME);
G4P.setCursor(CROSS);
if(frame != null)
frame.setTitle("Ovládanie auta cez internet");
label1 = new GLabel(this, 61, 0, 200, 30);
label1.setText("Ovládanie auta cez internet");
label1.setTextBold();
label1.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label1.setOpaque(false);
label6 = new GLabel(this, 6, 32, 120, 20);
label6.setText("Pripojiť na adresu");
label6.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label6.setOpaque(false);
textfield_ip = new GTextField(this, 126, 33, 191, 18, G4P.SCROLLBARS_NONE);
textfield_ip.setText("192.168.1.2");
textfield_ip.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_ip.setOpaque(true);
textfield_ip.addEventHandler(this, "textfield_ip_change1");
button_pripojit = new GButton(this, 8, 58, 70, 20);
button_pripojit.setText("Pripojiť");
button_pripojit.setTextBold();
button_pripojit.setLocalColorScheme(GCScheme.GREEN_SCHEME);
button_pripojit.addEventHandler(this, "button_pripojit_click1");
button_odpojit = new GButton(this, 78, 58, 50, 20);
button_odpojit.setText("Odpojiť");
button_odpojit.setTextBold();
button_odpojit.setLocalColorScheme(GCScheme.RED_SCHEME);
button_odpojit.addEventHandler(this, "button_odpojit_click1");
label2 = new GLabel(this, 164, 85, 67, 20);
label2.setText("Príkaz:");
label2.setTextAlign(GAlign.RIGHT, GAlign.MIDDLE);
label2.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label2.setOpaque(false);
label_vstup = new GLabel(this, 231, 85, 90, 20);
label_vstup.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label_vstup.setOpaque(false);
label9 = new GLabel(this, 6, 78, 45, 20);
label9.setText("Stav:");
label9.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label9.setOpaque(false);
label_stav = new GLabel(this, 51, 78, 80, 20);
label_stav.setText("Odpojené");
label_stav.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
label_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
label_stav.setOpaque(false);
label4 = new GLabel(this, 236, 52, 30, 20);
label4.setText("Port:");
label4.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label4.setOpaque(false);
textfield_port = new GTextField(this, 266, 53, 51, 18, G4P.SCROLLBARS_NONE);
textfield_port.setText("21315");
textfield_port.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_port.setOpaque(true);
textfield_port.addEventHandler(this, "textfield_port_change1");
textfield_lat = new GTextField(this, 89, 181, 169, 18, G4P.SCROLLBARS_NONE);
textfield_lat.setText("1000");
textfield_lat.setLocalColorScheme(GCScheme.BLUE_SCHEME);
textfield_lat.setOpaque(true);
textfield_lat.addEventHandler(this, "textfield_lat_change1");
label3 = new GLabel(this, 4, 111, 80, 20);
label3.setText("Nastavenie");
label3.setTextBold();
label3.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label3.setOpaque(false);
label5 = new GLabel(this, 6, 180, 82, 20);
label5.setText("Latencia [ms]:");
label5.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label5.setOpaque(false);
button_lat = new GButton(this, 260, 181, 58, 18);
button_lat.setText("Zmeniť");
button_lat.setTextBold();
button_lat.setLocalColorScheme(GCScheme.BLUE_SCHEME);
button_lat.addEventHandler(this, "button_lat_click1");
textfield_cam = new GTextField(this, 450, 33, 173, 18, G4P.SCROLLBARS_NONE);
textfield_cam.setText("192.168.1.239");
textfield_cam.setLocalColorScheme(GCScheme.CYAN_SCHEME);
textfield_cam.setOpaque(true);
textfield_cam.addEventHandler(this, "textfield_cam_change1");
label8 = new GLabel(this, 335, 32, 115, 20);
label8.setText("Adresa pre kameru");
label8.setLocalColorScheme(GCScheme.CYAN_SCHEME);
label8.setOpaque(false);
label10 = new GLabel(this, 379, 0, 193, 30);
label10.setText("Pripojenie na kameru");
label10.setTextBold();
label10.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label10.setOpaque(false);
label11 = new GLabel(this, 6, 140, 82, 20);
label11.setText("Heslo");
label11.setTextBold();
label11.setLocalColorScheme(GCScheme.RED_SCHEME);
label11.setOpaque(false);
label12 = new GLabel(this, 6, 160, 82, 20);
label12.setText("Nové heslo");
label12.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
label12.setOpaque(false);
textfield_heslo = new GTextField(this, 89, 141, 169, 18, G4P.SCROLLBARS_NONE);
textfield_heslo.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_heslo.setOpaque(true);
textfield_heslo.addEventHandler(this, "textfield_heslo_change1");
textfield_noveheslo = new GTextField(this, 89, 161, 169, 18, G4P.SCROLLBARS_NONE);
textfield_noveheslo.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
textfield_noveheslo.setOpaque(true);
textfield_noveheslo.addEventHandler(this, "textfield_noveheslo_change1");
button_zmenitheslo = new GButton(this, 260, 161, 58, 18);
button_zmenitheslo.setText("Zmeniť");
button_zmenitheslo.setTextBold();
button_zmenitheslo.addEventHandler(this, "button_zmenitheslo_click1");
label13 = new GLabel(this, 6, 200, 314, 20);
label13.setText("Pre zmenu hesla je potrebné zadať staré aj nové heslo");
label13.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label13.setOpaque(false);
label14 = new GLabel(this, 549, 52, 30, 20);
label14.setText("Port:");
label14.setOpaque(false);
textfield_camport = new GTextField(this, 579, 53, 43, 18, G4P.SCROLLBARS_NONE);
textfield_camport.setText("81");
textfield_camport.setOpaque(true);
textfield_camport.addEventHandler(this, "textfield_camport_change1");
button_cam_pripojit = new GButton(this, 332, 58, 70, 20);
button_cam_pripojit.setText("Pripojiť");
button_cam_pripojit.setTextBold();
button_cam_pripojit.setLocalColorScheme(GCScheme.GREEN_SCHEME);
button_cam_pripojit.addEventHandler(this, "button_cam_pripojit_click1");
button_cam_odpojit = new GButton(this, 402, 58, 50, 20);
button_cam_odpojit.setText("Odpojiť");
button_cam_odpojit.setTextBold();
button_cam_odpojit.setLocalColorScheme(GCScheme.RED_SCHEME);
button_cam_odpojit.addEventHandler(this, "button_cam_odpojit_click1");
label15 = new GLabel(this, 330, 78, 45, 20);
label15.setText("Stav:");
label15.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label15.setOpaque(false);
label_cam_stav = new GLabel(this, 375, 78, 80, 20);
label_cam_stav.setText("Odpojené");
label_cam_stav.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
label_cam_stav.setLocalColorScheme(GCScheme.RED_SCHEME);
label_cam_stav.setOpaque(false);
label16 = new GLabel(this, 355, 112, 80, 20);
label16.setText("Nastavenie");
label16.setTextBold();
label16.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label16.setOpaque(false);
label18 = new GLabel(this, 340, 152, 65, 20);
label18.setText("Heslo");
label18.setTextAlign(GAlign.RIGHT, GAlign.MIDDLE);
label18.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label18.setOpaque(false);
textfield_cam_heslo = new GTextField(this, 410, 153, 176, 18, G4P.SCROLLBARS_NONE);
textfield_cam_heslo.setLocalColorScheme(GCScheme.GREEN_SCHEME);
textfield_cam_heslo.setOpaque(true);
textfield_cam_heslo.addEventHandler(this, "textfield_cam_heslo_change1");
label17 = new GLabel(this, 340, 132, 65, 20);
label17.setText("Meno");
label17.setTextAlign(GAlign.RIGHT, GAlign.MIDDLE);
label17.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
label17.setOpaque(false);
textfield_cam_meno = new GTextField(this, 410, 133, 176, 18, G4P.SCROLLBARS_NONE);
textfield_cam_meno.setText("admin");
textfield_cam_meno.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
textfield_cam_meno.setOpaque(true);
textfield_cam_meno.addEventHandler(this, "textfield_cam_meno_change1");
label19 = new GLabel(this, 491, 85, 67, 20);
label19.setText("Príkaz:");
label19.setTextAlign(GAlign.RIGHT, GAlign.MIDDLE);
label19.setLocalColorScheme(GCScheme.BLUE_SCHEME);
label19.setOpaque(false);
label_cam_vstup = new GLabel(this, 558, 85, 65, 20);
label_cam_vstup.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
label_cam_vstup.setOpaque(false);
label_prikazy = new GLabel(this, 330, 182, 300, 20);
label_prikazy.setText("Príkazy na ovládanie pomocou klávesnice:");
label_prikazy.setTextBold();
label_prikazy.setLocalColorScheme(GCScheme.GREEN_SCHEME);
label_prikazy.setOpaque(false);
label_prikazy1 = new GLabel(this, 330, 202, 175, 20);
label_prikazy1.setText("Vozidlo: q,w,e,r,a,s,d,f,g,y,x,c,t,z");
label_prikazy1.setTextItalic();
label_prikazy1.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
label_prikazy1.setLocalColorScheme(GCScheme.RED_SCHEME);
label_prikazy1.setOpaque(false);
label_prikazy2 = new GLabel(this, 505, 202, 125, 20);
label_prikazy2.setText("Kamera: čísla, -, +");
label_prikazy2.setTextItalic();
label_prikazy2.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
label_prikazy2.setOpaque(false);
button_language = new GButton(this, 272, 12, 100, 14);
button_language.setText("English version");
button_language.setLocalColorScheme(GCScheme.ORANGE_SCHEME);
button_language.addEventHandler(this, "button_language_click1");
}
// Variable declarations
// autogenerated do not edit
GLabel label1;
GLabel label6;
GTextField textfield_ip;
GButton button_pripojit;
GButton button_odpojit;
GLabel label2;
GLabel label_vstup;
GLabel label9;
GLabel label_stav;
GLabel label4;
GTextField textfield_port;
GTextField textfield_lat;
GLabel label3;
GLabel label5;
GButton button_lat;
GTextField textfield_cam;
GLabel label8;
GLabel label10;
GLabel label11;
GLabel label12;
GTextField textfield_heslo;
GTextField textfield_noveheslo;
GButton button_zmenitheslo;
GLabel label13;
GLabel label14;
GTextField textfield_camport;
GButton button_cam_pripojit;
GButton button_cam_odpojit;
GLabel label15;
GLabel label_cam_stav;
GLabel label16;
GLabel label18;
GTextField textfield_cam_heslo;
GLabel label17;
GTextField textfield_cam_meno;
GLabel label19;
GLabel label_cam_vstup;
GLabel label_prikazy;
GLabel label_prikazy1;
GLabel label_prikazy2;
GButton button_language;