sir the procedure is i have to git clone this to myworkspace and i will enable the leaf shell and run the mktool command wrigtht
Then why does it still ask for datahub?
i changed only publish and subscribe.c files but don,t know why it is happening like this
You can see there is no datahub in the adef file
yes it is not there,i have checked it
Clear the project or create a new one and retry
BTW, you should just compile the adef instead of sdef, the sdef is pointing to other location:
sir i have copiled .adef and successfull .update file generated and application is running successfully in board also, but it is not connecting to mqtt , it is not showing error also , what may be the reason could u help !
this is my mqttPublish .c fle
/**
- @file testPublisher.c
- MQTT Publisher sample application
-
- Copyright (C) Sierra Wireless Inc.
*/
#include “legato.h”
#include “interfaces.h”
//--------------------------------------------------------------------------------------------------
/**
- Whether connection to MQTT server is secured
*/
//--------------------------------------------------------------------------------------------------
#define MQTT_SERVER_USE_SECURED_CONNECTION 0
//--------------------------------------------------------------------------------------------------
/**
- Device IMEI, used as a unique device identifier
*/
//--------------------------------------------------------------------------------------------------
char DeviceIMEI[LE_INFO_IMEI_MAX_BYTES];
//--------------------------------------------------------------------------------------------------
/**
- MQTT session reference
*/
//--------------------------------------------------------------------------------------------------
mqtt_SessionRef_t MQTTSession;
//--------------------------------------------------------------------------------------------------
/**
- Call-back function called on lost connection
/
//--------------------------------------------------------------------------------------------------
static void OnConnectionLost
(
void context
)
{
LE_ERROR(“Connection lost!”);
}
//--------------------------------------------------------------------------------------------------
/**
- Call-back function called on arrived message
/
//--------------------------------------------------------------------------------------------------
static void OnMessageArrived
(
const char topic,
const uint8_t* payload,
size_t payloadLen,
void* context
)
{
LE_ERROR(“The publisher received a message!”);
}
//--------------------------------------------------------------------------------------------------
/** - Timer handler for periodically publishing data
/
//--------------------------------------------------------------------------------------------------
static void PublishTimerHandler
(
le_timer_Ref_t timer
)
{
static int messageData = 0;
uint8_t payload[64];
snprintf((char)payload, sizeof(payload), “{"value":%d}”, messageData);
size_t payloadLen = strlen((char*)payload);
const bool retain = false;
char publishTopic = “v1/devices/me/telemetry”;
snprintf(publishTopic, sizeof(publishTopic), “%s/messages/json”, DeviceIMEI);
const le_result_t publishResult = mqtt_Publish(
MQTTSession,
publishTopic,
payload,
payloadLen,
MQTT_QOS0_TRANSMIT_ONCE,
retain);
LE_INFO(“Published Topic %s data %s result %s”, publishTopic, payload,
LE_RESULT_TXT(publishResult));
messageData++;
}
COMPONENT_INIT
{
// server is running on the Linux workstation connected to the target
#if MQTT_SERVER_USE_SECURED_CONNECTION
const char mqttBrokerURI = “ssl://192.168.2.3:8883”;
const uint8_t mqttPassword = {‘S’, ‘W’, ‘I’};
#else
const char mqttBrokerURI = “phycluds.com:1884”;
#endif
LE_ASSERT_OK(le_info_GetImei(DeviceIMEI, NUM_ARRAY_MEMBERS(DeviceIMEI)));
char clientId[32];
snprintf(clientId, sizeof(clientId), "%s-pub", DeviceIMEI);
LE_ASSERT_OK(mqtt_CreateSession(mqttBrokerURI, clientId, &MQTTSession));
const uint16_t keepAliveInSeconds = 60;
const bool cleanSession = true;
const char* username = "GCbrAhbMVyCR2DFwWht0";
const uint16_t connectTimeout = 20;
const uint16_t retryInterval = 10;
mqtt_SetConnectOptions(
MQTTSession,
keepAliveInSeconds,
cleanSession,
username,
#if MQTT_SERVER_USE_SECURED_CONNECTION
mqttPassword,
NUM_ARRAY_MEMBERS(mqttPassword),
#else
NULL,
0,
#endif
connectTimeout,
retryInterval);
mqtt_AddConnectionLostHandler(MQTTSession, &OnConnectionLost, NULL);
mqtt_AddMessageArrivedHandler(MQTTSession, &OnMessageArrived, NULL);
int rc = mqtt_Connect(MQTTSession);
if (rc != LE_OK)
{
LE_ERROR("Connection failed! error %d", rc);
}
else
{
LE_INFO("Connected to server '%s'", mqttBrokerURI);
le_timer_Ref_t timer = le_timer_Create("MQTT Publish");
LE_ASSERT_OK(le_timer_SetHandler(timer, &PublishTimerHandler));
LE_ASSERT_OK(le_timer_SetMsInterval(timer, 10000));
LE_ASSERT_OK(le_timer_SetRepeat(timer, 0));
LE_ASSERT_OK(le_timer_Start(timer));
LE_INFO("Publish timer started");
}
}
mango-log (6.6 KB)
sir this is the log file uploaded on that publisher.adef
can you print a helloworld out first?
You need to debug by yourself!
yeah i have writen hellowold application and it is running successfully
the put the code in your application’s first function
Other user can make it work:
sir , i did’t get what you are saying
did your program start the component_init()?
in log it is not showing anything related to component initialization, above i have attached the log
that is why i ask you to print a helloworld message in component_init()
This is some basic debug skill …
i added this line in component init()
LE_INFO(“Hello, World!”);
but in log it is not showing anything
your hello world app is working fine, right?
Then you can port the mqtt app to your helloworld app line by line