public class Session extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CONN_PORT |
static int |
PROTOCOL_VERSION |
| Constructor and Description |
|---|
Session(String address,
int port,
String deviceId,
String loginName,
String password) |
Session(String address,
int port,
String deviceId,
String loginName,
String password,
boolean useEncryption) |
Session(String address,
String deviceId,
String loginName,
String password) |
| Modifier and Type | Method and Description |
|---|---|
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() |
org.netxms.base.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,
String value)
Push value for single DCI.
|
void |
pushDciData(String nodeName,
String dciName,
String value)
Push value for single DCI.
|
void |
reportDeviceStatus(InetAddress address,
org.netxms.base.GeoLocation location,
int flags,
int batteryLevel)
Report basic current status of the device.
|
void |
reportDeviceSystemInfo(String vendor,
String model,
String osName,
String osVersion,
String serialNumber,
String userId)
Report basic system information about mobile device.
|
void |
sendMessage(org.netxms.base.NXCPMessage msg)
Send message to server
|
void |
setCommandTimeout(int commandTimeout)
Set command execution timeout in milliseconds.
|
org.netxms.base.NXCPMessage |
waitForMessage(int code,
long id)
Wait for message with specific code and id.
|
org.netxms.base.NXCPMessage |
waitForMessage(int code,
long id,
int timeout)
Wait for message with specific code and id.
|
org.netxms.base.NXCPMessage |
waitForRCC(long id)
Wait for CMD_REQUEST_COMPLETED message with given id using default timeout
|
org.netxms.base.NXCPMessage |
waitForRCC(long id,
int timeout) |
public static final int DEFAULT_CONN_PORT
public static final int PROTOCOL_VERSION
public Session(String address, String deviceId, String loginName, String password)
address - deviceId - loginName - password - public Session(String address, int port, String deviceId, String loginName, String password)
address - port - deviceId - loginName - password - public void sendMessage(org.netxms.base.NXCPMessage msg)
throws IOException,
MobileAgentException
msg - Message to sentIOException - in case of socket communication failureMobileAgentException - in case of encryption errorpublic org.netxms.base.NXCPMessage waitForMessage(int code,
long id,
int timeout)
throws MobileAgentException
code - id - timeout - MobileAgentExceptionpublic org.netxms.base.NXCPMessage waitForMessage(int code,
long id)
throws MobileAgentException
code - id - MobileAgentExceptionpublic org.netxms.base.NXCPMessage waitForRCC(long id)
throws MobileAgentException
id - MobileAgentExceptionpublic org.netxms.base.NXCPMessage waitForRCC(long id,
int timeout)
throws MobileAgentException
id - timeout - NXCExceptionMobileAgentExceptionpublic final org.netxms.base.NXCPMessage newMessage(int code)
code - message codeprotected void executeSimpleCommand(int command)
throws IOException,
MobileAgentException
command - Command codeIOExceptionMobileAgentExceptionpublic void connect()
throws IOException,
UnknownHostException,
MobileAgentException
public void disconnect()
public void setCommandTimeout(int commandTimeout)
commandTimeout - public void pushDciData(DciPushData[] data) throws IOException, MobileAgentException
data - push dataIOException - if socket I/O error occursMobileAgentException - if NetXMS server returns an error or operation was timed outpublic void pushDciData(long nodeId,
long dciId,
String value)
throws IOException,
MobileAgentException
nodeId - node IDdciId - DCI IDvalue - value to pushIOException - if socket I/O error occursMobileAgentException - if NetXMS server returns an error or operation was timed outpublic void pushDciData(String nodeName, String dciName, String value) throws IOException, MobileAgentException
nodeName - node namedciName - DCI namevalue - value to pushIOException - if socket I/O error occursMobileAgentException - if NetXMS server returns an error or operation was timed outpublic void reportDeviceSystemInfo(String vendor, String model, String osName, String osVersion, String serialNumber, String userId) throws 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)IOException - if socket I/O error occursMobileAgentException - if NetXMS server returns an error or operation was timed outpublic void reportDeviceStatus(InetAddress address, org.netxms.base.GeoLocation location, int flags, int batteryLevel) throws 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 applicableIOException - if socket I/O error occursMobileAgentException - if NetXMS server returns an error or operation was timed outCopyright © 2015. All rights reserved.