-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving P&P facilitating writable property and improving documentat…
…ion (#25)
- Loading branch information
Showing
5 changed files
with
142 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections; | ||
|
||
namespace nanoFramework.Azure.Devices.Client | ||
{ | ||
/// <summary> | ||
/// Property | ||
/// </summary> | ||
public class PropertyAcknowledge | ||
{ | ||
private const string TwinVersion = "av"; | ||
private const string TwinDescription = "ad"; | ||
private const string TwinStatus = "ac"; | ||
private const string TwinValue = "value"; | ||
|
||
/// <summary> | ||
/// Gets or sets the version. | ||
/// </summary> | ||
public int Version { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the Description. | ||
/// </summary> | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the status; | ||
/// </summary> | ||
public PropertyStatus Status { get; set; } | ||
|
||
/// <summary> | ||
/// The value to report. | ||
/// </summary> | ||
public object Value { get; set; } | ||
|
||
/// <summary> | ||
/// Bluid the acknowledge to return to IoT plug and play. | ||
/// </summary> | ||
/// <returns>A hashtable that will be serialized.</returns> | ||
public Hashtable BuildAcknowledge() | ||
{ | ||
Hashtable toReport = new(); | ||
toReport.Add(TwinVersion, Version); | ||
toReport.Add(TwinDescription, Description); | ||
toReport.Add(TwinStatus, Status); | ||
toReport.Add(TwinValue, Value); | ||
return toReport; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace nanoFramework.Azure.Devices.Client | ||
{ | ||
/// <summary> | ||
/// Status code for the Azure Plug and Play reported values. | ||
/// </summary> | ||
public enum PropertyStatus | ||
{ | ||
/// <summary>Completed</summary> | ||
Completed = 200, | ||
|
||
/// <summary>InProgress</summary> | ||
InProgress = 202, | ||
|
||
/// <summary>NotFound</summary> | ||
NotFound = 404, | ||
|
||
/// <summary>BadRequest</summary> | ||
BadRequest = 400, | ||
|
||
/// <summary>BadRequest</summary> | ||
InternalError = 500 | ||
} | ||
} |
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