Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 2e453a2

Browse files
Sync the Arduino Library azure-iot-arduino-protocol-mqtt with the latest azure-iot-sdks version
1 parent 1f088b2 commit 2e453a2

File tree

7 files changed

+174
-163
lines changed

7 files changed

+174
-163
lines changed

‎examples/simplesample_mqtt/simplesample_mqtt.c‎

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ static void sendMessage(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const unsign
9494
}
9595
IoTHubMessage_Destroy(messageHandle);
9696
}
97-
free((void*)buffer);
9897
messageTrackingId++;
9998
}
10099

@@ -107,7 +106,7 @@ static IOTHUBMESSAGE_DISPOSITION_RESULT IoTHubMessage(IOTHUB_MESSAGE_HANDLE mess
107106
if (IoTHubMessage_GetByteArray(message, &buffer, &size) != IOTHUB_MESSAGE_OK)
108107
{
109108
printf("unable to IoTHubMessage_GetByteArray\r\n");
110-
result = EXECUTE_COMMAND_ERROR;
109+
result = IOTHUBMESSAGE_ABANDONED;
111110
}
112111
else
113112
{
@@ -116,11 +115,11 @@ static IOTHUBMESSAGE_DISPOSITION_RESULT IoTHubMessage(IOTHUB_MESSAGE_HANDLE mess
116115
if (temp == NULL)
117116
{
118117
printf("failed to malloc\r\n");
119-
result = EXECUTE_COMMAND_ERROR;
118+
result = IOTHUBMESSAGE_ABANDONED;
120119
}
121120
else
122121
{
123-
memcpy(temp, buffer, size);
122+
(void)memcpy(temp, buffer, size);
124123
temp[size] = '0円';
125124
EXECUTE_COMMAND_RESULT executeCommandResult = EXECUTE_COMMAND(userContextCallback, temp);
126125
result =
@@ -190,24 +189,7 @@ void simplesample_mqtt_run(void)
190189
}
191190
else
192191
{
193-
IOTHUB_MESSAGE_HANDLE messageHandle = IoTHubMessage_CreateFromByteArray(destination, destinationSize);
194-
if (messageHandle == NULL)
195-
{
196-
printf("unable to create a new IoTHubMessage\r\n");
197-
}
198-
else
199-
{
200-
if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messageHandle, sendCallback, (void*)1) != IOTHUB_CLIENT_OK)
201-
{
202-
printf("failed to hand over the message to IoTHubClient");
203-
}
204-
else
205-
{
206-
printf("IoTHubClient accepted the message for delivery\r\n");
207-
}
208-
209-
IoTHubMessage_Destroy(messageHandle);
210-
}
192+
sendMessage(iotHubClientHandle, destination, destinationSize);
211193
free(destination);
212194
}
213195
}

‎examples/simplesample_mqtt/simplesample_mqtt.ino‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ void initWifi() {
9696
Serial.println(ssid);
9797

9898
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
99-
while (WiFi.begin(ssid, pass) != WL_CONNECTED) {
100-
// unsuccessful, retry in 4 seconds
101-
Serial.print("failed ... ");
102-
delay(4000);
103-
Serial.print("retrying ... ");
99+
WiFi.begin(ssid, pass);
100+
101+
Serial.print("Waiting for Wifi connection.");
102+
while (WiFi.status() != WL_CONNECTED) {
103+
Serial.print(".");
104+
delay(500);
104105
}
105106

106107
Serial.println("Connected to wifi");

‎library.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=AzureIoTProtocol_MQTT
2-
version=1.0.21
2+
version=1.0.30
33
author=Microsoft
44
maintainer=Microsoft <iotcert@microsoft.com>
55
sentence=Azure MQTT protocol library for Arduino. For the Arduino MKR1000 or Zero and WiFi Shield 101, Adafruit Huzzah and Feather M0, or SparkFun Thing.

‎src/AzureIoTProtocol_MQTT.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#ifndef AZUREIOTPROTOCOLMQTT_H
55
#define AZUREIOTPROTOCOLMQTT_H
66

7-
#include "azure_umqtt_c\mqtt_client.h"
7+
#include "azure_umqtt_c/mqtt_client.h"
88

99
#define AzureIoTProtocolMQTTVersion "1.0.21"
1010

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /