|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netxms.mobile.agent.Session
public class Session
Communication session with NetXMS server.
| Field Summary | |
|---|---|
static int |
DEFAULT_CONN_PORT
|
static int |
PROTOCOL_VERSION
|
| Constructor Summary | |
|---|---|
Session(java.lang.String address,
int port,
java.lang.String deviceId,
java.lang.String loginName,
java.lang.String password)
|
|
Session(java.lang.String address,
int port,
java.lang.String deviceId,
java.lang.String loginName,
java.lang.String password,
boolean useEncryption)
|
|
Session(java.lang.String address,
java.lang.String deviceId,
java.lang.String loginName,
java.lang.String password)
|
|
| Method Summary | |
|---|---|
void |
connect()
Connect to server. |
void |
disconnect()
Disconnect from server |
protected void |
executeSimpleCommand(int command)
Execute simple commands (without arguments and only returning RCC) |
protected void |
finalize()
|
NXCPMessage |
newMessage(int code)
Create new NXCP message with unique id |
void |
pushDciData(DciPushData[] data)
Push data to server. |
void |
pushDciData(long nodeId,
long dciId,
java.lang.String value)
Push value for single DCI. |
void |
pushDciData(java.lang.String nodeName,
java.lang.String dciName,
java.lang.String value)
Push value for single DCI. |
void |
reportDeviceStatus(java.net.InetAddress address,
GeoLocation location,
int flags,
int batteryLevel)
Report basic current status of the device. |
void |
reportDeviceSystemInfo(java.lang.String vendor,
java.lang.String model,
java.lang.String osName,
java.lang.String osVersion,
java.lang.String serialNumber,
java.lang.String userId)
Report basic system information about mobile device. |
void |
sendMessage(NXCPMessage msg)
Send message to server |
void |
setCommandTimeout(int commandTimeout)
Set command execution timeout in milliseconds. |
NXCPMessage |
waitForMessage(int code,
long id)
Wait for message with specific code and id. |
NXCPMessage |
waitForMessage(int code,
long id,
int timeout)
Wait for message with specific code and id. |
NXCPMessage |
waitForRCC(long id)
Wait for CMD_REQUEST_COMPLETED message with given id using default timeout |
NXCPMessage |
waitForRCC(long id,
int timeout)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_CONN_PORT
public static final int PROTOCOL_VERSION
| Constructor Detail |
|---|
public Session(java.lang.String address,
java.lang.String deviceId,
java.lang.String loginName,
java.lang.String password)
address - deviceId - loginName - password -
public Session(java.lang.String address,
int port,
java.lang.String deviceId,
java.lang.String loginName,
java.lang.String password)
address - port - deviceId - loginName - password -
public Session(java.lang.String address,
int port,
java.lang.String deviceId,
java.lang.String loginName,
java.lang.String password,
boolean useEncryption)
address - port - deviceId - loginName - password - useEncryption - | Method Detail |
|---|
protected void finalize()
finalize in class java.lang.Object
public void sendMessage(NXCPMessage msg)
throws java.io.IOException,
MobileAgentException
msg - Message to sent
java.io.IOException - in case of socket communication failure
MobileAgentException - in case of encryption error
public NXCPMessage waitForMessage(int code,
long id,
int timeout)
throws MobileAgentException
code - id - timeout -
MobileAgentException
public NXCPMessage waitForMessage(int code,
long id)
throws MobileAgentException
code - id -
MobileAgentException
public NXCPMessage waitForRCC(long id)
throws MobileAgentException
id -
MobileAgentException
public NXCPMessage waitForRCC(long id,
int timeout)
throws MobileAgentException
id - timeout -
NXCException
MobileAgentExceptionpublic final NXCPMessage newMessage(int code)
code - message code
protected void executeSimpleCommand(int command)
throws java.io.IOException,
MobileAgentException
command - Command code
java.io.IOException
MobileAgentException
public void connect()
throws java.io.IOException,
java.net.UnknownHostException,
MobileAgentException
java.io.IOException
java.net.UnknownHostException
MobileAgentExceptionpublic void disconnect()
public void setCommandTimeout(int commandTimeout)
commandTimeout -
public void pushDciData(DciPushData[] data)
throws java.io.IOException,
MobileAgentException
data - push data
java.io.IOException - if socket I/O error occurs
MobileAgentException - if NetXMS server returns an error or operation was timed out
public void pushDciData(long nodeId,
long dciId,
java.lang.String value)
throws java.io.IOException,
MobileAgentException
nodeId - node IDdciId - DCI IDvalue - value to push
java.io.IOException - if socket I/O error occurs
MobileAgentException - if NetXMS server returns an error or operation was timed out
public void pushDciData(java.lang.String nodeName,
java.lang.String dciName,
java.lang.String value)
throws java.io.IOException,
MobileAgentException
nodeName - node namedciName - DCI namevalue - value to push
java.io.IOException - if socket I/O error occurs
MobileAgentException - if NetXMS server returns an error or operation was timed out
public void reportDeviceSystemInfo(java.lang.String vendor,
java.lang.String model,
java.lang.String osName,
java.lang.String osVersion,
java.lang.String serialNumber,
java.lang.String userId)
throws java.io.IOException,
MobileAgentException
vendor - vendor name (like "HTC")model - device model (like "Desire A8181")osName - operating system name (like "Android")osVersion - operating system version (like "2.2")serialNumber - device serial numberuserId - user id, if available (can be null)
java.io.IOException - if socket I/O error occurs
MobileAgentException - if NetXMS server returns an error or operation was timed out
public void reportDeviceStatus(java.net.InetAddress address,
GeoLocation location,
int flags,
int batteryLevel)
throws java.io.IOException,
MobileAgentException
address - current IP address of the device (may be null if not known)location - current device location (may be null if not known)flags - batteryLevel - current battery level, -1 if not known or not applicable
java.io.IOException - if socket I/O error occurs
MobileAgentException - if NetXMS server returns an error or operation was timed out
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||