H:NEQ1207232,172621,0113,00000000,1fb72263,03,32,110214,0d16,03,0000
V hlavičce je uvedeno sériové číslo (na první číslo za H:) a verze firmware (číslo 0113 na třetí pozici)
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
/**
* Initial Communication to Cube MAX
*/
public class Appl001InitConnection2Cube {
/**
* @param args The ip and port should be moved to application parameters
*
*/
public static void main(String[] args) throws Exception{
Appl001InitConnection2Cube appl=new Appl001InitConnection2Cube();
appl.connect2Cube("192.168.0.11", 62910); // ip address and port of MAX Cube LAN
}
public void connect2Cube(String ip, int port) throws Exception {
Socket socket = new Socket(ip,port);
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
BufferedWriter output = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
String command = input.readLine();
readHeader(command);
socket.close();
}
public void readHeader(String command){
System.out.println(command);
}
}
Žádné komentáře:
Okomentovat