Skip to content

Commit df626aa

Browse files
authored
Merge pull request #47 from Azure/ewertons/update4adugapatch
Update ADU sample to get ADU GA patch
2 parents 0589ae1 + da62d6a commit df626aa

File tree

7 files changed

+259
-246
lines changed

7 files changed

+259
-246
lines changed

examples/Azure_IoT_Adu_ESP32/Azure_IoT_Adu_ESP32.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#define SAMPLE_MQTT_PAYLOAD_LENGTH 1024
6464

6565
// ADU Values
66-
#define ADU_PPV_DTMI "dtmi:azure:iot:deviceUpdateContractModel;1"
66+
#define ADU_PPV_DTMI AZ_IOT_ADU_CLIENT_AGENT_MODEL_ID
6767
#define ADU_DEVICE_SHA_SIZE 32
6868
#define ADU_SHA_PARTITION_READ_BUFFER_SIZE 32
6969
#define HTTP_DOWNLOAD_CHUNK 4096

examples/Azure_IoT_Adu_ESP32/readme.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ _The following was run on Windows 11 and Ubuntu Desktop 20.04 environments, with
6363

6464
- ESP32 boards are not natively supported by Arduino IDE, so you need to add them manually.
6565
- Follow the [instructions](https://github.com/espressif/arduino-esp32) in the official ESP32 repository.
66+
- Install Azure CLI and Azure IoT Module
6667

68+
See steps to install both [here](https://learn.microsoft.com/azure/iot-hub-device-update/create-update?source=recommendations#prerequisites).
6769

6870
## Add Azure IoT Hub Device to an ADU Deployment Group
6971

@@ -88,7 +90,7 @@ Viewing the device twin on the portal, the "tag" section should look similar to
8890

8991
- On the Arduino IDE, go to menu `Sketch`, `Include Library`, `Manage Libraries...`.
9092
- Search for and install `azure-sdk-for-c`.
91-
- **Make sure to install the latest `1.1.0-beta.*` to use the preview version of the Embedded C SDK.**
93+
- **Make sure to install version `1.1.0` or later to use the new Azure Device Update client of the Embedded C SDK.**
9294

9395
1. Open the ESPRESSIF ESP32 sample.
9496

@@ -220,24 +222,14 @@ Once you are done with the ADU sample, you may remove the added configuration to
220222
221223
### Generate the ADU Update Manifest
222224
223-
Navigate to the `C:\ADU-update` directory in a Powershell prompt.
225+
Open PowerShell.
224226
225-
Clone the ADU toolset.
227+
Navigate to the `C:\ADU-update` directory.
226228
227-
```bash
228-
git clone https://github.com/Azure/iot-hub-device-update
229-
```
230-
231-
Generate the update manifest using **powershell**.
229+
Run the following command:
232230
233231
```powershell
234-
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
235-
Import-Module .\iot-hub-device-update\tools\AduCmdlets\AduUpdate.psm1
236-
$updateId = New-AduUpdateId -Provider "Contoso" -Name "ESP32-Embedded" -Version 1.1
237-
$compat = New-AduUpdateCompatibility -Properties @{ deviceManufacturer = 'ESPRESSIF'; deviceModel = 'ESP32-Embedded' }
238-
$installStep = New-AduInstallationStep -Handler 'microsoft/swupdate:1'-HandlerProperties @{ installedCriteria = '1.1' } -Files C:\ADU-update\Azure_IoT_Adu_ESP32_1.1.bin
239-
$update = New-AduImportManifest -UpdateId $updateId -Compatibility $compat -InstallationSteps $installStep
240-
$update | Out-File "./$($updateId.provider).$($updateId.name).$($updateId.version).importmanifest.json" -Encoding utf8
232+
az iot du update init v5 --update-provider Contoso --update-name ESP32-Embedded --update-version 1.1 --compat deviceModel=ESP32-Embedded deviceManufacturer=ESPRESSIF --step handler=microsoft/swupdate:1 properties='{\"installedCriteria\":\"1.1\"}' --file path=./Azure_IoT_Adu_ESP32_1.1.bin > ./Contoso.ESP32-Embedded.1.1.importmanifest.json
241233
```
242234

243235
Verify you have the following files in your ADU-update directory:

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=Azure SDK for C
2-
version=1.1.0
2+
version=1.1.1
33
author=Microsoft Corporation
44
maintainer=Microsoft Corporation <[email protected]>
55
sentence=Azure SDK for C library for Arduino.
6-
paragraph=This is an Arduino port of the Azure SDK for C (1.4.0). It allows you to use your Arduino device with Azure services like Azure IoT Hub and Azure Device Provisioning Service. See README.md for more details. Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
6+
paragraph=This is an Arduino port of the Azure SDK for C (1.5.0-beta.1). It allows you to use your Arduino device with Azure services like Azure IoT Hub and Azure Device Provisioning Service. See README.md for more details. Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
77
category=Communication
88
url=https://github.com/Azure/azure-sdk-for-c-arduino/releases
99
architectures=*

src/az_iot_adu_client.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
/* Define the ADU agent component name. */
1313
#define AZ_IOT_ADU_CLIENT_AGENT_COMPONENT_NAME "deviceUpdate"
1414

15-
#define AZ_IOT_ADU_CLIENT_AGENT_INTERFACE_ID "dtmi:azure:iot:deviceUpdate;1"
15+
#define AZ_IOT_ADU_CLIENT_AGENT_CONTRACT_MODEL_ID "dtmi:azure:iot:deviceUpdateContractModel;2"
1616

1717
/* Define the ADU agent property name "agent" and sub property names. */
1818
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_AGENT "agent"
1919

2020
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_DEVICEPROPERTIES "deviceProperties"
2121
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_MANUFACTURER "manufacturer"
2222
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_MODEL "model"
23-
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_INTERFACE_ID "interfaceId"
23+
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_CONTRACT_MODEL_ID "contractModelId"
2424
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_ADU_VERSION "aduVer"
2525
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_DO_VERSION "doVer"
2626

@@ -206,9 +206,9 @@ AZ_NODISCARD az_result az_iot_adu_client_get_agent_state_payload(
206206
}
207207

208208
_az_RETURN_IF_FAILED(az_json_writer_append_property_name(
209-
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_INTERFACE_ID)));
209+
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_CONTRACT_MODEL_ID)));
210210
_az_RETURN_IF_FAILED(az_json_writer_append_string(
211-
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_INTERFACE_ID)));
211+
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_CONTRACT_MODEL_ID)));
212212

213213
_az_RETURN_IF_FAILED(az_json_writer_append_property_name(
214214
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_ADU_VERSION)));

src/az_version.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@
1717

1818
/// The version in string format used for telemetry following the `semver.org` standard
1919
/// (https://semver.org).
20-
#define AZ_SDK_VERSION_STRING "1.4.0"
20+
#define AZ_SDK_VERSION_STRING "1.5.0-beta.1"
2121

2222
/// Major numeric identifier.
2323
#define AZ_SDK_VERSION_MAJOR 1
2424

2525
/// Minor numeric identifier.
26-
#define AZ_SDK_VERSION_MINOR 4
26+
#define AZ_SDK_VERSION_MINOR 5
2727

2828
/// Patch numeric identifier.
2929
#define AZ_SDK_VERSION_PATCH 0
3030

3131
/// Optional pre-release identifier. SDK is in a pre-release state when present.
32-
#define AZ_SDK_VERSION_PRERELEASE
33-
#undef AZ_SDK_VERSION_PRERELEASE
32+
#define AZ_SDK_VERSION_PRERELEASE "beta.1"
3433

3534
#endif //_az_VERSION_H

0 commit comments

Comments
 (0)