![]() |
Hubiquitus Android
0.6.1
Android client for hubiquitus protocol
|
Classes | |
class | MyRunnable |
class | TransportDelegate |
Public Member Functions | |
String | getFullUrn () |
String | getResource () |
void | connect (String login, String password, HOptions options, JSONObject context) |
void | connect (String login, String password, HOptions options) |
void | disconnect () |
void | onStatus (HStatusDelegate statusDelegate) |
void | onMessage (HMessageDelegate messageDelegate) |
ConnectionStatus | status () |
void | send (final HMessage message, final HMessageDelegate messageDelegate) |
void | subscribe (String actor, HMessageDelegate messageDelegate) throws MissingAttrException |
void | unsubscribe (String actor, HMessageDelegate messageDelegate) throws MissingAttrException |
void | getSubscriptions (HMessageDelegate messageDelegate) throws MissingAttrException |
void | setFilter (HCondition filter, HMessageDelegate messageDelegate) throws MissingAttrException |
HMessage | buildMessage (String actor, String type, Object payload, HMessageOptions options) throws MissingAttrException |
HMessage | buildConvState (String actor, String convid, String status, HMessageOptions options) throws MissingAttrException |
HMessage | buildAck (String actor, String ref, HAckValue ack, HMessageOptions options) throws MissingAttrException |
HMessage | buildAlert (String actor, String alert, HMessageOptions options) throws MissingAttrException |
HMessage | buildMeasure (String actor, String value, String unit, HMessageOptions options) throws MissingAttrException |
HMessage | buildCommand (String actor, String cmd, JSONObject params, HCondition filter, HMessageOptions options) throws MissingAttrException |
HMessage | buildResult (String actor, String ref, ResultStatus status, String result, HMessageOptions options) throws MissingAttrException |
HMessage | buildResult (String actor, String ref, ResultStatus status, JSONObject result, HMessageOptions options) throws MissingAttrException |
HMessage | buildResult (String actor, String ref, ResultStatus status, JSONArray result, HMessageOptions options) throws MissingAttrException |
HMessage | buildResult (String actor, String ref, ResultStatus status, double result, HMessageOptions options) throws MissingAttrException |
HMessage | buildResult (String actor, String ref, ResultStatus status, boolean result, HMessageOptions options) throws MissingAttrException |
Package Attributes | |
final Logger | logger = LoggerFactory.getLogger(HClient.class) |
HMessage org.hubiquitus.hapi.client.HClient.buildAck | ( | String | actor, |
String | ref, | ||
HAckValue | ack, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage wiht a hAck payload.
actor | : The actor for the hMessage. Mandatory. |
ref | : The msgid to acknowledged. Mandatory. |
ack | : The following values are authorized : (1). “recv” : means that the message has been received by the participant (on at least one of its devices). (2). “read” : means that the message has been read by the participant. Mandatory. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildAlert | ( | String | actor, |
String | alert, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hAlert payload.
actor | : The channel id for the hMessage. Mandatory. |
alert | : The alert message. Mandatory. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildCommand | ( | String | actor, |
String | cmd, | ||
JSONObject | params, | ||
HCondition | filter, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hCommand payload.
actor | : The actor for the hMessage. Mandatory. |
cmd | : The name of the command. Mandatory. |
params | : Parameters of the command. Not mandatory. |
filter | : The filter on the session. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildConvState | ( | String | actor, |
String | convid, | ||
String | status, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hConvState payload.
actor | : The channel id for the hMessage. Mandatory |
convid | : The convid where the status have to be updated. Mandatory |
status | : Status of the conversation. Mandatory. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildMeasure | ( | String | actor, |
String | value, | ||
String | unit, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hMeasure payload.
actor | : The actor for the hMessage. Mandatory |
value | : The value of the measure. Mandatory |
unit | : The unit of the measure. Mandatory |
options | : The options to use if any for the creation of the hMessage. Not Mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildMessage | ( | String | actor, |
String | type, | ||
Object | payload, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage. Payload type could be instance of JSONObject(HAlert, HAck, HCommand ...), JSONObject, JSONArray, String, Boolean, Number
actor | : The Actor for the hMessage. Mandatory. |
type | : The type of the hMessage. Not mandatory. |
payload | : The payload for the hMessage. Not mandatory. |
options | : The options if any to use for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildResult | ( | String | actor, |
String | ref, | ||
ResultStatus | status, | ||
String | result, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hResult payload.
actor | : The actor for the hMessage. Mandatory. |
ref | : The id of the message received, for correlation purpose. Mandatory. |
status | : Result status code. Mandatory. |
result | : The String result of a command. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildResult | ( | String | actor, |
String | ref, | ||
ResultStatus | status, | ||
JSONObject | result, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hResult payload.
actor | : The actor for the hMessage. Mandatory. |
ref | : The id of the message received, for correlation purpose. Mandatory. |
status | : Result status code. Mandatory. |
result | : The JSONObject result of a command. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildResult | ( | String | actor, |
String | ref, | ||
ResultStatus | status, | ||
JSONArray | result, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hResult payload.
actor | : The actor for the hMessage. Mandatory. |
ref | : The id of the message received, for correlation purpose. Mandatory. |
status | : Result status code. Mandatory. |
result | : The JSONArray result of a command. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildResult | ( | String | actor, |
String | ref, | ||
ResultStatus | status, | ||
double | result, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hResult payload.
actor | : The actor for the hMessage. Mandatory. |
ref | : The id of the message received, for correlation purpose. Mandatory. |
status | : Result status code. Mandatory. |
result | : The double result of a command. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
HMessage org.hubiquitus.hapi.client.HClient.buildResult | ( | String | actor, |
String | ref, | ||
ResultStatus | status, | ||
boolean | result, | ||
HMessageOptions | options | ||
) | throws MissingAttrException |
Helper to create a hMessage with a hResult payload.
actor | : The actor for the hMessage. Mandatory. |
ref | : The id of the message received, for correlation purpose. Mandatory. |
status | : Result status code. Mandatory. |
result | : The boolean result of a command. |
options | : The options to use if any for the creation of the hMessage. Not mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
void org.hubiquitus.hapi.client.HClient.connect | ( | String | login, |
String | password, | ||
HOptions | options, | ||
JSONObject | context | ||
) |
Establishes a connection to hNode to allow the reception and sending of messages and commands.
login | : login, mandatory. |
password | : Mandatory. |
options | : Complementary values used for the connection to the server. Not mandatory. |
context | : Not mandatory. |
void org.hubiquitus.hapi.client.HClient.connect | ( | String | login, |
String | password, | ||
HOptions | options | ||
) |
Establishes a connection to hNode to allow the reception and sending of messages and commands.
publisher | : user jid (ie : my_user/resource). Mandatory. |
password | : Mandatory. |
options | : Complementary values used for the connection to the server. Not mandatory. |
Disconnect the user from the current working session.
void org.hubiquitus.hapi.client.HClient.getSubscriptions | ( | HMessageDelegate | messageDelegate | ) | throws MissingAttrException |
Demands the server a list of the publisher’s subscriptions. Nominal response : a hMessage with a hResult payload contains an array of channel id which are all active.
messageDelegate | : A delegate notified when the result is sent by server. Mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
void org.hubiquitus.hapi.client.HClient.onMessage | ( | HMessageDelegate | messageDelegate | ) |
messageDelegate | Message delegate receive all incoming HMessage |
void org.hubiquitus.hapi.client.HClient.onStatus | ( | HStatusDelegate | statusDelegate | ) |
Status delegate receive all connection status events.
statusDelegate | the delegate to call when the status changes |
void org.hubiquitus.hapi.client.HClient.send | ( | final HMessage | message, |
final HMessageDelegate | messageDelegate | ||
) |
The hAPI sends the hMessage to the hserver which transfer it to the specified actor. The hserver will perform one of the following actions : (1). If the actor is a channel (ie : #channelName) the hserver will perform a publish operation of the provided hMessage to the channel and send an hMessage with hResult payload containing the published message and cmd name set with hsend to acknowledge publishing only if a timeout value has been provided. (2). If the actor is either ‘session’ and payload type is ‘hCommand’ the server will handle it. In other cases, it will send an hMessage with a hResult error NOT_AUTHORIZED. Only if the timeout is provided. (3). If the actor is a jid, hserver will relay the message to the relevant actor.
message | : The message to send. Mandatory. |
messageDelegate | : If provided, called by the hAPI when the first message refering to current message arrive . Not mandatory. |
void org.hubiquitus.hapi.client.HClient.setFilter | ( | HCondition | filter, |
HMessageDelegate | messageDelegate | ||
) | throws MissingAttrException |
Set a filter to be applied to upcoming messages at the session level
filter | the filter to apply on the current session managed on the hnode side for this actor |
messageDelegate | a delegate notified when the command result is issued. Mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
Get current connection status
void org.hubiquitus.hapi.client.HClient.subscribe | ( | String | actor, |
HMessageDelegate | messageDelegate | ||
) | throws MissingAttrException |
Demands the server a subscription to the channel id. The hAPI performs a hMessage with a hCommand of type hsubscribe. The server will check if not already subscribed and if authorized and subscribe him. Nominal response : a hMessage with an hResult payload with status 0.
actor | : The channel id to subscribe to. (ie : #test”). Mandatory. |
messageDelegate | : A delegate notified when the result is sent by server. Mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |
void org.hubiquitus.hapi.client.HClient.unsubscribe | ( | String | actor, |
HMessageDelegate | messageDelegate | ||
) | throws MissingAttrException |
Demands the server an unsubscription to the channel id. The hAPI checks the current publisher’s subscriptions and if he is subscribed performs a hCommand of type hunsubscribe. Nominal response : an hMessage with an hResult where the status 0.
actor | : The channel to unsubscribe from. Mandatory. |
messageDelegate | : A delegate notified when the result is sent by server. Mandatory. |
MissingAttrException | raised if a mandatory attribute is not well provided |