|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.anwrt.communication.connector.AwtCom
public final class AwtCom
The AwtCom is the connector that allows an application to connect as a client
to the M2MAgent.
creation : 26 sept. 2008
| Field Summary | |
|---|---|
static java.lang.String |
PATH_SEPARATOR
PATH_SEPARATOR constant |
| Method Summary | |
|---|---|
void |
connect()
|
void |
destroy()
Close the connection with the M2MAgent |
void |
forceConnectionToServer(AwtConnectionStatusListener listener)
Force the connection between M2MAgent and the M2M server. |
int |
getNextTicketId()
Returns the next ticket id. |
java.util.List |
getVariable(java.lang.String path,
java.lang.Integer level)
Retrieves a set of variables from M2MAgent. |
static AwtCom |
initialize(java.lang.String assetId)
Initializes the library with default values and opens a connection to the M2MAgent. |
static AwtCom |
initialize(java.lang.String assetId,
java.lang.String host,
int port)
Initializes the library with given parameters and opens a connection to the M2MAgent. |
boolean |
isConnected()
|
int |
notifySoftwareUpdateResult(java.lang.String spackage,
int resultCode)
Notify a software update result for the given package to the M2MAgent |
int |
notifyVariable(java.lang.String path)
Notify variable of the core Agent |
void |
registerDataListener(AwtDataListener listener)
Register a DataListener. |
int |
registerVariable(java.lang.String path)
Register variable of the core Agent |
int |
sendMessages(byte[] buffer)
Send the buffer given as parameter to the M2MAgent. |
int |
sendSMS(java.lang.String recipient,
byte[] payload)
Send a SMS message to the given recipient. |
int |
setSMSListener(AwtSMSListener listener,
java.lang.String pattern)
Set the given listener as a SMSListener. |
void |
setSoftwareListener(AwtSofwareUpdateListener listener,
java.lang.String path)
If not null, set the AwtSofwareUpdateListener listener for the
given path. |
int |
setVariable(java.lang.String path,
java.lang.Object value)
Set variable of the core Agent |
void |
unregisterDataListener(AwtDataListener dataListener)
Unregister a DataListener. |
int |
unsetSMSListener()
Unset the current SMSListener |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PATH_SEPARATOR
| Method Detail |
|---|
public void connect()
throws AwtComException
AwtComException
public static AwtCom initialize(java.lang.String assetId)
throws AwtComException
assetId - client's assetId.
AwtComException - Throws AwtComException if the connection to the
M2MAgent failed.
public static AwtCom initialize(java.lang.String assetId,
java.lang.String host,
int port)
throws AwtComException
assetId - client's assetId.String - ReadyAgent host name or IPint - Port of the ReadyAgent to connect to
AwtComException - Throws AwtComException if the connection to the
M2MAgent failed.public void destroy()
public int getNextTicketId()
public int sendMessages(byte[] buffer)
throws AwtComException
buffer - buffer of serialized data.
AwtComException - Throws M2MAgentException if the connection with
the M2MAgent or if an IOException occurred.
public java.util.List getVariable(java.lang.String path,
java.lang.Integer level)
throws AwtComException
path - is the path of the variable to retrievelevel - is the recursive level to retrieve variable in the tree, default is 0 (no recusivity)
AwtComException - if the connection with the M2MAgent is lost.
public int setVariable(java.lang.String path,
java.lang.Object value)
throws AwtComException
path - path of the variable to setvalue - is the value of the variable (can be a table, in that case it will actually set a whole sub tree (several variables at once))
AwtComException - Throws M2MAgentException if the connection with
the M2MAgent or if an IOException occurred.
public int registerVariable(java.lang.String path)
throws AwtComException
path - path of the variable to register
AwtComException - Throws M2MAgentException if the connection with
the M2MAgent or if an IOException occurred.
public int notifyVariable(java.lang.String path)
throws AwtComException
path - path of the variable to notify
AwtComException - Throws M2MAgentException if the connection with
the M2MAgent or if an IOException occurred.
public int sendSMS(java.lang.String recipient,
byte[] payload)
throws AwtComException
recipient - recipient of the message.payload - Message payload.
AwtComException - Throws M2MAgentException if the connection with
the M2MAgent or if an IOException occurred.
public void forceConnectionToServer(AwtConnectionStatusListener listener)
throws AwtComException
listener - The optional listener to be notified of the communication
status.
AwtComException - Throws AwtComException if the connection with the
M2MAgent is lost or if an IOException occurred.
public int notifySoftwareUpdateResult(java.lang.String spackage,
int resultCode)
throws AwtComException
spackage - The software packageresultCode - update result
AwtComException - if the connection with the M2MAgent is lost or if
an IOException occurred.public void registerDataListener(AwtDataListener listener)
listener - listener to be added.public void unregisterDataListener(AwtDataListener dataListener)
dataListener - listener to be removed.
public void setSoftwareListener(AwtSofwareUpdateListener listener,
java.lang.String path)
AwtSofwareUpdateListener listener for the
given path. If null remove the AwtSofwareUpdateListener listener
for the given path.
listener - the AwtSofwareUpdateListener to be registered.path - the AwtSofwareUpdateListener path to listen to.
public int unsetSMSListener()
throws AwtComException
AwtComException - Throws an AwtComException if the
connection to the M2Magent is lost.
public int setSMSListener(AwtSMSListener listener,
java.lang.String pattern)
throws AwtComException
listener - Listener to be notified. If null, current listener will
be unsetted.pattern - Pattern that recipient number must match. If null or empty
string, current listener will be unsetted.
AwtComException - Throws an AwtComException if the
connection to the M2Magent is lost.public boolean isConnected()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||