You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can watch this video from the Microsoft [IoT Show](https://aka.ms/iotshow) featuring the Azure SDK and a real life example with .NET nanoFramework:
## nanoFramework.Azure.Devices.Client vs nanoFramework.Azure.Devices.Client.FullyManaged
23
+
24
+
The `nanoFramework.Azure.Devices.Client.FullyManaged` nuget has been build to be **independent of the native hardware** you are running on. So it will not use the X509Certificate but rather a byte array. It will not use the `nanoFramework.M2Mqtt` library but rather an abstraction called `nanoFramework.M2Mqtt.Core` using an interface.
25
+
26
+
The main scenario this does allow is to bring your own MQTT broker and run on devices without System.Net so devices without any native networking. This does allow to connect through a modem implementing an MQTT client. You can reuse almost fully the same code you're using for native network enabled devices and the ones using a modem.
27
+
21
28
## Usage
22
29
23
30
**Important**: You **must** be connected to a network with a valid IP address **and** a valid date. Please check the examples with the Network Helpers on how to help you making sure you have both.
> Note: when using the FullyManaged library, you will have to pass a `byte[]` rather than a `X509Certificate`. The broker you'll use may or may not support PEM or DER certificate. Please make sure you will use the proper one by checking the vendor documentation. A PEM certificate is a base64 encoded version of the DER certificate, usually found with the `.crt` extension.
76
+
68
77
You can place your binary certificate in the program resources as well and just get the certificate from it:
> Note: some modem have limitations in the length of the message. The message is what contains the twins. Make sure you'll check the limitations when using the FullyManaged library.
213
+
203
214
### Sending message
204
215
205
216
You have to use the `SendMessage` function to send any kind of message or telemetry to Azure IoT. As for the other function, you have the possibility to ensure delivery with a `CancellationToken` than can be cancelled. If one that can't be cancelled is used, the delivery insurance will be ignored and the function will return false.
Note: the `sender` is a `DeviceClient` class, you can then send a message back, a confirmation or any logic you've put in place.
251
262
263
+
> Note: some modem have limitations in the length of the message and topic length. The topic length is what contains the property bag. Make sure you'll check the limitations when using the FullyManaged library.
264
+
252
265
### Method callback
253
266
254
267
Method callback is supported as well. You can register and unregister your methods. Here are a few examples:
**Important**: method names are case sensitive. So make sure you name your functions in C# use the same case.
283
296
297
+
> Note: some modem have limitations in the length of the message. The message is what contains the payload. Make sure you'll check the limitations when using the FullyManaged library.
> Note: some modem have limitations in the MQTT implementation so you may not get all the updates. Make sure you'll check the limitations when using the FullyManaged library.
318
+
302
319
Note that those are status change based, so once the connect or disconnect event arrives, they'll be replaced by other events as soon as something else happened like receiving a twin.
303
320
304
321
### QoS Level
@@ -307,9 +324,9 @@ By default, the device SDKs connect to an IoT Hub use QoS 1 for message exchange
307
324
308
325
Here are existing QoS levels that you can use:
309
326
310
-
* AtMostOnce: The broker/client will deliver the message once, with no confirmation.
311
-
* AtLeastOnce: The broker/client will deliver the message at least once, with confirmation required.
312
-
* ExactlyOnce: The broker/client will deliver the message exactly once by using a four step handshake.
327
+
- AtMostOnce: The broker/client will deliver the message once, with no confirmation.
328
+
- AtLeastOnce: The broker/client will deliver the message at least once, with confirmation required.
329
+
- ExactlyOnce: The broker/client will deliver the message exactly once by using a four step handshake.
313
330
314
331
While it's possible to configure QoS 0 (AtMostOnce) for faster message exchange, you should note that the delivery isn't guaranteed nor acknowledged. For this reason, QoS 0 is often referred as "fire and forget".
315
332
@@ -462,6 +479,8 @@ if(!res)
462
479
463
480
Additional payload is supported as well. You can set it up as as json string in the `ProvisioningRegistrationAdditionalData` class when calling the `Register` function. When the device has been provisioned, you may have as well additional payload provided.
464
481
482
+
> Note: some modem have limitations in the length of the message. The message is what contains the payload. Make sure you'll check the limitations when using the FullyManaged library.
483
+
465
484
## Feedback and documentation
466
485
467
486
For documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home).
releaseNotesInline: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).<br><br><h4>Install from NuGet</h4><br>The following NuGet packages are available for download from this release:<br>:package: [nanoFramework.Azure.Devices.Client](https://www.nuget.org/packages/$(nugetPackageName)/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).<br>:package: [nanoFramework.Azure.Devices.Client.FullyManaged (Independent of MQTT implementation and native System.Net)](https://www.nuget.org/packages/nanoFramework.Azure.Devices.Client.FullyManaged/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)'
0 commit comments