Re: Help me wrap PahoMQTT

new topic     » goto parent     » topic index » view thread      » older message » newer message
xfox26 said...

Uploaded code to GitHub at https://github.com/xfox26/paho.mqtt.euphoria

Fell free criticize my work.
Any help is appreciated.

Couple of quick suggestions, change

public function MQTTClient_create(sequence server_uri, sequence client_id, atom persistence_type, atom persistence_context) 
... 
	atom ret = c_func(xMQTTClient_create, {hndl, ptr_server_uri, ptr_client_id, MQTTCLIENT_PERSISTENCE_NONE, NULL})  

to

public function MQTTClient_create(sequence server_uri, sequence client_id, atom persistence_type = MQTTCLIENT_PERSISTENCE_NONE, atom persistence_context = NULL) 
... 
	atom ret = c_func(xMQTTClient_create, {hndl, ptr_server_uri, ptr_client_id, persistence_type, persistence_context})  

and

poke4(MQTTClient_connectOptions+4*1, options[1])--sctruct version 
... 
poke4(MQTTClient_connectOptions+4*20, options[20])--cleanstart 

to

global constant CO_STRUCT_VERSION = 1, 
... 
                CO_CLEANSTART = 20 
poke4(MQTTClient_connectOptions+4, options) -- remaining 20 in one poke 

You might also want to suggest something like the following usage pattern in the docs:

  sequence options = default_connectOptions 
  options[CO_RETRY_INTERVAL] = 120 
  atom res = MQTTClient_connect(hndl, options) 

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu