public class SynchronizeCommunication
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.io.BufferedInputStream |
bufferedInputStream
This attribute represents the buffer for the input.
|
private java.io.BufferedOutputStream |
bufferedOutputStream
This attribute represents the buffer for the outgoing data.
|
private java.io.PrintWriter |
printWriter
This attribute represents a printer for the formatting representations of objects to a
text-output stream.
|
private java.net.Socket |
socket
This attribute represents the socket for the connection.
|
Constructor and Description |
---|
SynchronizeCommunication() |
Modifier and Type | Method and Description |
---|---|
void |
connect(java.lang.String server,
int port)
This method creates a socket for the communication to the router.
|
void |
disconnect()
This method disconnects the connection to imond.
|
java.lang.String |
pass()
This method checks, if a password exists.
|
java.lang.String |
pass(java.lang.String password)
This method sends the password to the imond and gets an answer if the password is correct or
gives the information, that the imond is in the admin mode.
|
void |
receiveFile(java.lang.String filename,
java.lang.String buildPath,
java.lang.String pass)
This method instructs imond to receive a file.
|
private java.lang.String |
sendCommand(java.lang.String command,
boolean expectingAnswer)
This method sends a command to the imond, if necessary: with the essential information.
|
private java.net.Socket socket
private java.io.BufferedInputStream bufferedInputStream
private java.io.BufferedOutputStream bufferedOutputStream
private java.io.PrintWriter printWriter
public void connect(java.lang.String server, int port) throws CommunicationException
server
- this is the ip address of the routerport
- this is the necessary port for the connectionCommunicationException
- If the connection failed.public java.lang.String pass() throws CommunicationException
CommunicationException
- if there are problems with the connectionpublic java.lang.String pass(java.lang.String password) throws CommunicationException
password
- this is the entered passwordCommunicationException
- if there are problems with the connectionprivate java.lang.String sendCommand(java.lang.String command, boolean expectingAnswer) throws CommunicationException
command
- this is the command for the imondexpectingAnswer
- if an answer of the imond is expected, then he can wait 10 secondsCommunicationException
- if there are problems with the connectionpublic void disconnect() throws CommunicationException
CommunicationException
- if there are problems with the connectionpublic void receiveFile(java.lang.String filename, java.lang.String buildPath, java.lang.String pass) throws CommunicationException, java.io.IOException
filename
- path and name of file to savebuildPath
- path of the location of the file on the fli4l and the filenamepass
- passwordCommunicationException
- Exception, if there are problems with sending the data.java.io.IOException
- Exception, if there are problems with reading files.