Barracuda Application Server C/C++ Reference
 All Classes Functions Variables Typedefs Enumerations Enumerator Groups Pages

SMQ C Library
SMQ is an easy to use IoT (M2M) publish subscribe protocol. This documentation is for the non secure SMQ C client library. See SharkMQ for the secure version. More...

Collaboration diagram for SMQClient:

Modules

 Error codes returned by function SMQ_getMessage
 
 Response codes returned by function SMQ_getMessage
 
 C API
 

Classes

struct  SMQ
 SimpleMQ structure. More...
 
struct  SharkSsl
 

Typedefs

typedef struct SMQ SMQ
 SimpleMQ structure.
 

Functions

 SMQ::SMQ (U8 *buf, U16 bufLen)
 Create a SimpleMQ client instance. More...
 
int SMQ::init (const char *url, U32 *rnd)
 Initiate the SMQ server connection. More...
 
int SMQ::connect (const char *uid, int uidLen, const char *credentials, U8 credLen, const char *info, int infoLen)
 Connect/establish a persistent SimpleMQ connection. More...
 
void SMQ::disconnect ()
 Gracefully close the connection. More...
 
 SMQ::~SMQ ()
 Terminate a SimpleMQ instance. More...
 
int SMQ::create (const char *topic)
 Create a topic an fetch the topic ID (tid). More...
 
int SMQ::createsub (const char *subtopic)
 Create a sub-topic and fetch the subtopic ID. More...
 
int SMQ::subscribe (const char *topic)
 The response to SMQ_subscribe is asynchronous and returned as status SMQ_SUBACK via SMQ_getMessage. More...
 
int SMQ::unsubscribe (U32 tid)
 Requests the broker to unsubscribe the server from a topic. More...
 
int SMQ::publish (const void *data, int len, U32 tid, U32 subtid)
 Publish messages to a topic and optionally to a sub-topic. More...
 
int SMQ::wrtstr (const char *str)
 Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s). More...
 
int SMQ::write (const void *data, int len)
 Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s). More...
 
int SMQ::pubflush (U32 tid, U32 subtid)
 Flush the internal buffer and request the broker to assemble all stored fragments as one message. More...
 
int SMQ::observe (U32 tid)
 Request the broker to provide change notification events when the number of subscribers to a specific topic changes. More...
 
int SMQ::unobserve (U32 tid)
 Stop receiving change notifications for a topic ID or ephemeral topic ID. More...
 
int SMQ::getMessage (U8 **msg)
 Wait for messages sent from the broker. More...
 
int SMQ::getMsgSize ()
 Returns the message size, which is SMQ::frameLen - 15. More...
 

Detailed Description

SMQ C Library


SMQ is an easy to use IoT (M2M) publish subscribe protocol. This documentation is for the non secure SMQ C client library. See SharkMQ for the secure version.

The SMQ C library comes with a C++ wrapper API, which includes a brief description of the API. See the C API for the full documentation.

Function Documentation

int SMQ::connect ( const char *  uid,
int  uidLen,
const char *  credentials,
U8  credLen,
const char *  info,
int  infoLen 
)

Connect/establish a persistent SimpleMQ connection.

See also
SMQ_connect
int SMQ::create ( const char *  topic)

Create a topic an fetch the topic ID (tid).

See also
SMQ_create
int SMQ::createsub ( const char *  subtopic)

Create a sub-topic and fetch the subtopic ID.

See also
SMQ:createsub
void SMQ::disconnect ( )

Gracefully close the connection.

See also
SMQ_disconnect
int SMQ::getMessage ( U8 **  msg)

Wait for messages sent from the broker.

See also
SMQ_getMessage
int SMQ::getMsgSize ( )

Returns the message size, which is SMQ::frameLen - 15.

See also
SMQ_getMsgSize
int SMQ::init ( const char *  url,
U32 *  rnd 
)

Initiate the SMQ server connection.

See also
SMQ_init
int SMQ::observe ( U32  tid)

Request the broker to provide change notification events when the number of subscribers to a specific topic changes.

Ephemeral topic IDs can also be observed.

See also
SMQ_observe
int SMQ::pubflush ( U32  tid,
U32  subtid 
)

Flush the internal buffer and request the broker to assemble all stored fragments as one message.

See also
SMQ_pubflush
int SMQ::publish ( const void *  data,
int  len,
U32  tid,
U32  subtid 
)

Publish messages to a topic and optionally to a sub-topic.

Topic name must have previosly been been resolved by SMQ_create and sub-topic should preferably have been created by SMQ_createsub.

See also
SMQ_publish
SMQ::SMQ ( U8 *  buf,
U16  bufLen 
)

Create a SimpleMQ client instance.

See also
SMQ_constructor
int SMQ::subscribe ( const char *  topic)

The response to SMQ_subscribe is asynchronous and returned as status SMQ_SUBACK via SMQ_getMessage.

See also
SMQ_subscribe
int SMQ::unobserve ( U32  tid)

Stop receiving change notifications for a topic ID or ephemeral topic ID.

See also
SMQ_unobserve
int SMQ::unsubscribe ( U32  tid)

Requests the broker to unsubscribe the server from a topic.

See also
SMQ_unsubscribe
int SMQ::write ( const void *  data,
int  len 
)

Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s).

See also
SMQ_write
int SMQ::wrtstr ( const char *  str)

Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s).

See also
SMQ_wrtstr
SMQ::~SMQ ( )

Terminate a SimpleMQ instance.

See also
SMQ_destructor