[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [paho-dev] Paho MQTT Embedded C Client Support
|
I do not know anything about the Quectel
Wifi module.You will need to provide the implementation
of the network and timer functions for the target platform as described
in the header file https://github.com/eclipse/paho.mqtt.embedded-c/blob/master/MQTTClient-C/src/MQTTClient.hPlease take a look at 3 implementations
(FreeRTOS, cc3200, linux) here: https://github.com/eclipse/paho.mqtt.embedded-c/tree/master/MQTTClient-C/src--
Regards,
Mike TranFrom:
Michell Castaño <mcastano@xxxxxxxxxxxx>To:
Mike Tran/Austin/IBM@IBMUSCc:
paho-dev@xxxxxxxxxxxDate:
09/29/2016 04:28 PMSubject:
Re: [paho-dev]
Paho MQTT Embedded C Client Support
Hi, Mike Hi GroupBest RegardsI've a questions about the way of connect, publish and
subscript with the MQTT Embedded Library with a Quectel Module
and an Atmega Microcontroller. Do you have any idea about it?.Thanks for all,Greetings from Colombia.2016-09-28 9:12 GMT-05:00 Mike Tran <miketran@xxxxxxxxxx>:Hi Michell,
First, you need to read and sign the Eclipse Contributor Agreement - https://www.eclipse.org/legal/ECA.php.
Then, follow the instruction of the eclipse project that you want to contribute.
Eclipse paho project is now on github.. You just need to follow the github
process to submit pull requests
--
Regards,
Mike Tran
From: Michell
Castaño <mcastano@xxxxxxxxxxxx>
To: Mike
Tran/Austin/IBM@IBMUS
Cc: paho-dev@xxxxxxxxxxx
Date: 09/27/2016
04:18 PM
Subject: Re:
[paho-dev] Paho MQTT Embedded C Client Support
Hi
Mr Mike
How I do the pull request for upgrade the code that I built?. Do you can
explain me the process?
2016-09-27 15:52 GMT-05:00 Michell Castaño <mcastano@xxxxxxxxxxxx>:
Hi, Mike
That's great that you say me. I need permissions to do a commit in the
code on github?
2016-09-27 15:21 GMT-05:00 Michell Castaño <mcastano@xxxxxxxxxxxx>:
Hi, Mike
Best Regard
Thanks a lot for your kind attention and your excellent support. I found
the failure in the code, and I solved with the nesting of qos0pub and pub0sub1
codes, so:
qos0pub.c:
/*******************************************************************************
* Copyright (c) 2014 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License
v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs - initial API and implementation and/or
initial documentation
* Sergio R. Caprile - clarifications and/or documentation
extension
*******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "MQTTPacket.h"
#include "transport.h"
#include <signal.h>
int toStop = 0;
void cfinish(int sig)
{
signal(SIGINT, NULL);
toStop = 1;
}
void stop_init(void)
{
signal(SIGINT, cfinish);
signal(SIGTERM, cfinish);
}
/* */
int main(int argc, char *argv[])
{
MQTTPacket_connectData data = "">int rc = 0;
unsigned char buf[200];
int buflen = sizeof(buf);
int mysock = 0;
int msgid = 1;
MQTTString topicString = MQTTString_initializer;
int req_qos = 0;
char* payload = "TESTA";
int payloadlen = strlen(payload);
int len = 0;
char *host = "broker.hivemq.com";
int port = 1883;
stop_init();
if (argc > 1)
host = argv[1];
if (argc > 2)
port = atoi(argv[2]);
mysock = transport_open(host,port);
if(mysock < 0)
return mysock;
printf("Sending to hostname %s port %d\n", host, port);
data.clientID.cstring = "me";
data.keepAliveInterval = 60;
data.cleansession = 1;
data.username.cstring = "testuser";
data.password.cstring = "testpassword";
data.MQTTVersion = 4;
len = MQTTSerialize_connect(buf, buflen, &data);
rc = transport_sendPacketBuffer(mysock, buf, len);
/* wait for connack */
if (MQTTPacket_read(buf, buflen, transport_getdata) == CONNACK)
{
unsigned char sessionPresent, connack_rc;
if (MQTTDeserialize_connack(&sessionPresent, &connack_rc, buf,
buflen) != 1 || connack_rc != 0)
{
printf("Unable to connect, return code %d\n", connack_rc);
goto exit;
}
}
else
goto exit;
/* loop getting msgs on subscribed topic*/
topicString.cstring = "LaHermosa/Zona2";
while (!toStop)
{
// transport_getdata() has a built-in 1 second timeout, your mileage will
vary
if (MQTTPacket_read(buf, buflen, transport_getdata) == PUBLISH)
{
unsigned char dup;
int qos;
unsigned char retained;
unsigned short msgid;
int payloadlen_in;
unsigned char* payload_in;
int rc;
MQTTString receivedTopic;
rc = MQTTDeserialize_publish(&dup, &qos, &retained, &msgid,
&receivedTopic,
&payload_in, &payloadlen_in, buf, buflen);
printf("message arrived %.*s\n", payloadlen_in, payload_in);
}
printf("publishing reading\n");
len = MQTTSerialize_publish(buf, buflen, 0, 0, 0, 0, topicString, (unsigned
char*)payload, payloadlen);
rc = transport_sendPacketBuffer(mysock, buf, len);
}
printf("disconnecting\n");
len = MQTTSerialize_disconnect(buf, buflen);
rc = transport_sendPacketBuffer(mysock, buf, len);
exit:
transport_close(mysock);
return 0;
}
Now, the results are:

I solved taking into account the ACK Messages from the broker.
Again, thanks a lot.
See you son.
2016-09-27 13:45 GMT-05:00 Michell Castaño <mcastano@xxxxxxxxxxxx>:
Hi, Mike
I have another client to subscribe to the topic "LaHermosa/#".
This topic is listening with the broker "broker.hivemq.com"
in the port 1883, so:

The client qos0pub shows a "succesfully published" but
in the broker subscriber do not appear nothing.
Now, I use another client, this time a websocket client at the same broker,
and this are the results:


Thanks, again for your kind attention.
2016-09-27 12:04 GMT-05:00 Michell Castaño <mcastano@xxxxxxxxxxxx>:
Hi, Mike
For the Paho Embedded C Client I am using the next library:
https://github.com/eclipse/paho.mqtt.embedded-c/tree/master/MQTTPacket/samples
I work in C and I obtained this results:

Perhaps, do you know, why don't running?
Thanks, again for your kind attention.
2016-09-27 10:53 GMT-05:00 Mike Tran <miketran@xxxxxxxxxx>:
Hello Michell,
There are some example code that may help you get started with the Paho
Embedded C client.
If you are using the C++ library: https://github.com/eclipse/paho.mqtt.embedded-c/tree/master/MQTTClient/samples/linux
If you are using the C libray: https://github.com/eclipse/paho.mqtt.embedded-c/tree/master/MQTTClient/samples/linux
I have used the Paho Embedded C client on a few devices. I have not
seen any publish issues.
--
Regards,
Mike Tran
From: Michell
Castaño <mcastano@xxxxxxxxxxxx>
To: paho-dev@xxxxxxxxxxx
Cc: Michell
Castaño <mcastano@xxxxxxxxxxxx>
Date: 09/27/2016
09:50 AM
Subject: [paho-dev]
Paho MQTT Embedded C Client Support
Sent by: paho-dev-bounces@xxxxxxxxxxx
Good Morning
Members of Paho-devBest Regard
I'm Michell from Colombiaand
I have been testing the Embedded MQTT Client C library (https://eclipse.org/paho/clients/c/embedded/)
but although I obtained a successful test with the pub0sub1 sample, I can
not tell the same with qos0pub sample,because this do not publish the payload
required by me, into the broker of testing.
Please, do you can support me with
this?
Beforehand, thanks a lot for your kind
attention.
See you son._______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev