Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit with azure-sdk-for-c Arduino library #1

Merged
merged 11 commits into from
Dec 6, 2021

Conversation

ewertons
Copy link
Contributor

@ewertons ewertons commented Dec 1, 2021

No description provided.

library.properties Outdated Show resolved Hide resolved
Copy link
Member

@CIPop CIPop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments. The one thing I care strongly about is moving az_cert.h to each sample instead of the main lib.

@@ -0,0 +1,10 @@
name=azure-sdk-for-c
version=1.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To simplify things, can we keep this version in-sync with the SDK version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we talked about this in the meetings we had with Azure SDK team, but I do not find notes about it. Since the versions will be sequential anyway, I don't see why not. I updated the Update-library.ps1 to implement that as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posting conversation we had offline, for reference:

Cris, little problem with the version suggestion you made....

Linking the version of the SDK to the version of the Arduino library makes it impractical for us to make changes to the samples in the Arduino repo itself and update the version. In spite of that, what do you think about doing this:

name=Azure SDK for C
version=1.0.0
author=Microsoft Corporation
maintainer=Microsoft iotcert@microsoft.com
sentence=Azure SDK for C library (1.3.0-beta.2) for Arduino.

instead of

name=Azure SDK for C
version=1.3.0-beta.2
author=Microsoft Corporation
maintainer=Microsoft iotcert@microsoft.com
sentence=Azure SDK for C library for Arduino.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as suggested above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts on trying to keep the major version aligned, even as changes are made to samples/etc. independently of the SDK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I myself think that it makes more sense to keep the versions independent, but I would not oppose keeping the major versions in sync.

library.properties Outdated Show resolved Hide resolved
src/azure-sdk-for-c.h Outdated Show resolved Hide resolved
src/az_version.h Outdated Show resolved Hide resolved
tools/Update-Library.ps1 Outdated Show resolved Hide resolved
src/azure_ca.h Show resolved Hide resolved
category=Communication
url=https://github.com/Azure/azure-sdk-for-c
architectures=*
includes=az_core.h,az_iot.h,azure_ca.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove azure_ca.h from here and, instead, instruct devs to update their devices/modems with the latest CA certificates. For official Arduino boards, the IDE has tools that support the update.

The include can be made by samples for a quick OOB experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cris, that has been discussed before. There is a reason not to do that way.

If someone add the azure-sdk-for-c Arduino library (not using one of the built-in samples, the Root CA cert will be missing. To make the experience easy and match the standard out-of-the-box-smooth way expected from Arduino libraries, the ca cert header must be in the library.

If you are still in favor of doing differently, let's talk offline so we can find the best solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about my proposal to move the include in the samples? Instead of adding the include in the library, you can add it in each of the samples folders. This will automatically bring it in for samples but not for new projects. It will also make it clear that the file is part of the sample, not our SDK.

The include can be made by samples for a quick OOB experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that is exactly the situation the previous comment is addressing.
If you do that, people that include the library on their own projects won't have all the components for an out-of-the-box experience like what's expected when using Arduino.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Yeah: with my proposal only the samples will work by default.
Let's take this offline and see if we can integrate with Arduino's WiFi FW update system such as this one for WiFiNINA:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is a nice tool they have for the Wifi101 module.
Unfortunately Espressif does not have something similar in Arduino for their boards (nor has Realtek).
With those limitations, we don't have an alternative to work with as of now. I agree with you they should and it would be better, but that's what we have to work with as of now.

I will keep this comment unresolved for tracking purposes.
One aspect to address in a next release of this Arduino library will be to add the other root cas for other regions as well (!).

tools/Update-Library.ps1 Show resolved Hide resolved
@ewertons ewertons requested a review from CIPop December 2, 2021 00:32
README.md Outdated Show resolved Hide resolved
examples/AzureIoTHub_ESP32/AzureIoTHub_ESP32.ino Outdated Show resolved Hide resolved
examples/AzureIoTHub_ESP8266/AzureIoTHub_ESP8266.ino Outdated Show resolved Hide resolved
examples/AzureIoTHub_ESP8266/AzureIoTHub_ESP8266.ino Outdated Show resolved Hide resolved
examples/AzureIoTHub_ESP8266/AzureIoTHub_ESP8266.ino Outdated Show resolved Hide resolved
examples/AzureIoTHub_RealtekAmebaD/readme.md Outdated Show resolved Hide resolved
library.properties Outdated Show resolved Hide resolved
@ahsonkhan
Copy link
Member

@ewertons What files and changes within this PR should we explicitly review vs what can we assume are coming verbatim from latest released tag of the Azure SDK for C repo?

Can we assume everything under src/ is the same as the main repo (other than header fix-ups)?

@ahsonkhan
Copy link
Member

And do we have any plans to do any build verification or basic sanity testing in the CI for this repo? What steps do you currently take to manually test things?

It might be a good idea to at least have a step that verifies the repo builds in the CI to catch any typos or accidental changes that might cause it to break.

@ewertons
Copy link
Contributor Author

ewertons commented Dec 3, 2021

And do we have any plans to do any build verification or basic sanity testing in the CI for this repo? What steps do you currently take to manually test things?

It might be a good idea to at least have a step that verifies the repo builds in the CI to catch any typos or accidental changes that might cause it to break.

The tests I have done are manually using the latest version of Arduino IDE.
In our plans we listed adding automation for the verification going forward, which I'll work on this December.

@ewertons
Copy link
Contributor Author

ewertons commented Dec 3, 2021

@ewertons What files and changes within this PR should we explicitly review vs what can we assume are coming verbatim from latest released tag of the Azure SDK for C repo?

Can we assume everything under src/ is the same as the main repo (other than header fix-ups)?

Yes, that's correct. Everything under src/ is coming straight from azure/azure-sdk-for-c, with the files processed to be in a flat structure required for Arduino libraries.
The other folders contain the Examples and the tool/script to update the library (a powershell script).
The other important file is library.properties, which provides the main definition of the library.

All of the files here come almost as-is from the initial repo I created, which had been previously used in our discussions.

@ewertons ewertons removed the request for review from ryanwinter December 3, 2021 23:12
Copy link
Member

@ahsonkhan ahsonkhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, but did some have comments and questions that I was hoping to understand our thinking on, before approving. That said, once addressed, no need to block on my approval :)

Thanks @ewertons. Looking forward to the customer experience and feedback with this!

cc @antkmsft, @vhvb1989 just an FYI (once storage comes online) or in case you have any other thoughts to share.

src/az_base64.h Outdated Show resolved Hide resolved
src/az_config_internal.h Show resolved Hide resolved
src/az_core.h Show resolved Hide resolved
library.properties Outdated Show resolved Hide resolved
src/az_iot_hub_client.c Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
library.properties Outdated Show resolved Hide resolved
library.properties Show resolved Hide resolved
library.properties Outdated Show resolved Hide resolved
@ahsonkhan
Copy link
Member

And do we have any plans to do any build verification or basic sanity testing in the CI for this repo? What steps do you currently take to manually test things?
It might be a good idea to at least have a step that verifies the repo builds in the CI to catch any typos or accidental changes that might cause it to break.

The tests I have done are manually using the latest version of Arduino IDE. In our plans we listed adding automation for the verification going forward, which I'll work on this December.

👍

Unless we automate most of "Ewerton magic", whatever basic manual steps you do take now, or know you plan to take in the future, it might be a good idea to have a quick "what to do" steps documented somewhere accessible, and might even check-it-in somewhere in this repo (which you are probably the best person to decide, so up to you). This way, any new person on the team would know what to do to maintain and test this repo and the syncing mechanism.

library.properties Outdated Show resolved Hide resolved
Copy link
Member

@ahsonkhan ahsonkhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some typos and comment fix-up suggestions. Also, fix-up the contact email/alias. Otherwise, looks good to me :)

README.md Outdated Show resolved Hide resolved
library.properties Outdated Show resolved Hide resolved
library.properties Show resolved Hide resolved
tools/Update-Library.ps1 Outdated Show resolved Hide resolved
tools/Update-Library.ps1 Outdated Show resolved Hide resolved
@ewertons
Copy link
Contributor Author

ewertons commented Dec 6, 2021

Tested all samples one final time. All worked with the latest changes at merge time.
Tested on: Arduino IDE 1.8.16, ESP32 board lib 2.0.1, ESP8266 board lib 3.0.1, Realtek Ameba board lib 3.0.7, PubSubClient 2.8.0.

@ewertons ewertons merged commit e1b30ae into main Dec 6, 2021
@ewertons ewertons deleted the ewertons/initiallibrary branch December 6, 2021 23:20
@ewertons
Copy link
Contributor Author

ewertons commented Dec 6, 2021

For reference, this is the PR adding this new library to the official Arduino package manager:
arduino/library-registry#768

RLeclair pushed a commit to RLeclair/azure-sdk-for-c-arduino that referenced this pull request Oct 14, 2022
Updates Nano Connect sample for IoT Hub:

- removes x509 cert device authentication (unused)
- makes code C++ friendly
- removes az_span where not directly used for Embedded C SDK
- defines macros to replace magic numbers
- refactors functions as needed
- combines SAS material together (intentionally fewer functions to not distract from core sample)
- fixes logging
- fixes C2D messaging
- Adds commenting
- makes return code printouts consistent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants