-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat/chain (#84) * validating chain * refactor after chain * split dps and hub certs * skip chain test * import chain * use gw in rido Co-authored-by: rido-min <rido-min@users.noreply.github.com> * upd memmon defaults * Feat/formats (#86) * moving serializers * copy serializers to samples * upd tests to new hub * review proto bindings * rev 0.6 (#87) * upd memmon to don7 * upd memmon defaults * rev 0.6 * ci -> 7 * upd tests to 7 * warnings for memmon * mmpb -> 7 * Rel/prep06 (#88) * upd memmon to don7 * upd memmon defaults * rev 0.6 * ci -> 7 * upd tests to 7 * warnings for memmon * mmpb -> 7 * actions -> 7 * Feat/onemsg (#90) * init RO props * init ro props in broker * upd mqttnet * upd AppInsights * parse dps disable response (#91) * handle iohub disconnect * comment intermedita tests * add azpubsub * exclude int tests * upd ci to 22.04 * upd mqttnet to 4.1.4 Co-authored-by: rido-min <rido-min@users.noreply.github.com>
- Loading branch information
Showing
32 changed files
with
366 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
samples/memmon/dtmi_rido_memmon-2.json → samples/memmon/dtmi_rido_memmon-3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
using Avro; | ||
using Google.Protobuf.WellKnownTypes; | ||
using MQTTnet.Client; | ||
using MQTTnet.Extensions.MultiCloud; | ||
using MQTTnet.Extensions.MultiCloud.Binders; | ||
using MQTTnet.Extensions.MultiCloud.Serializers; | ||
using payload_size.Serializers; | ||
using System.Text.Json; | ||
using System.Xml.Linq; | ||
|
||
namespace payload_size.Binders; | ||
|
||
public class ReadOnlyPropertyAvro<T> : DeviceToCloudBinder<T>, IReadOnlyProperty<T> | ||
{ | ||
private readonly string _name; | ||
public T? Value { get; set; } | ||
public int Version { get; set; } | ||
public ReadOnlyPropertyAvro(IMqttClient mqttClient, Schema schema) | ||
: this(mqttClient, string.Empty, schema) { } | ||
|
||
public ReadOnlyPropertyAvro(IMqttClient mqttClient, string name, Schema schema) | ||
: base(mqttClient, name, new AvroSerializer(schema)) | ||
{ | ||
_name = name; | ||
TopicPattern = "device/{clientId}/props"; | ||
WrapMessage = false; | ||
Retain = true; | ||
} | ||
|
||
public void InitProperty(string initialState) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task SendMessageAsync(CancellationToken cancellationToken = default) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/MQTTnet.Extensions.MultiCloud.AzureIoTClient/ReadOnlyProperty.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
using MQTTnet.Client; | ||
using MQTTnet.Extensions.MultiCloud.Binders; | ||
using System.Text.Json; | ||
using System.Xml.Linq; | ||
|
||
namespace MQTTnet.Extensions.MultiCloud.AzureIoTClient; | ||
|
||
public class ReadOnlyProperty<T> : DeviceToCloudBinder<T>, IReadOnlyProperty<T> | ||
{ | ||
private readonly string _name; | ||
public T? Value { get; set; } | ||
public int Version { get; set; } | ||
public ReadOnlyProperty(IMqttClient mqttClient, string name) | ||
: base(mqttClient, name) | ||
{ | ||
_name = name; | ||
TopicPattern = "$iothub/twin/PATCH/properties/reported/?$rid=1"; | ||
WrapMessage = true; | ||
Retain = false; | ||
} | ||
|
||
public void InitProperty(string initialState) | ||
{ | ||
JsonDocument doc = JsonDocument.Parse(initialState); | ||
JsonElement reported = doc.RootElement.GetProperty("reported"); | ||
Version = reported.GetProperty("$version").GetInt32(); | ||
if (reported.TryGetProperty(_name, out JsonElement element)) | ||
{ | ||
Value = element.Deserialize<T>()!; | ||
} | ||
} | ||
|
||
public Task SendMessageAsync(CancellationToken cancellationToken = default) => SendMessageAsync(Value!, cancellationToken); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.