diff --git a/cloud_connectors/azure/mqtt_connector/azure_function/src/run.cs b/cloud_connectors/azure/mqtt_connector/azure_function/src/run.cs index 45306f8..c2b54fe 100644 --- a/cloud_connectors/azure/mqtt_connector/azure_function/src/run.cs +++ b/cloud_connectors/azure/mqtt_connector/azure_function/src/run.cs @@ -22,26 +22,50 @@ namespace Microsoft.ESDV.CloudConnector.Azure { /// public class DigitalTwinsInstance { + /// + /// The Azure Digital Twins model ID + /// [JsonPropertyName("model_id")] public string ModelId { get; set; } + /// + /// The Azure Digital Twins instance ID + /// [JsonPropertyName("instance_id")] public string InstanceId { get; set; } + /// + /// The Azure Digital Twins instance property path + /// [JsonPropertyName("instance_property_path")] public string InstancePropertyPath { get; set; } + /// + /// The data to synchronize + /// [JsonPropertyName("data")] public string Data { get; set; } } + /// + /// Azure function for use with the MQTT connector. + /// Reads data from an event grid and forwards it to Azure Digital Twins. + /// public class MQTTConnectorAzureFunction { + /// + /// The logger for this function + /// private readonly ILogger _logger; + /// + /// The environment variable name for the keyvault settings + /// private const string KEYVAULT_SETTINGS = "KEYVAULT_SETTINGS"; - // Maps a string data type name to its concrete data type. + /// + /// Maps a string data type name to its concrete data type. + /// private static readonly Dictionary dataTypeNameToConverterMap = new() { { "int", typeof(int) }, @@ -49,6 +73,10 @@ public class MQTTConnectorAzureFunction { "boolean", typeof(bool) } }; + /// + /// Create a new MQTTConnectorAzureFunction + /// + /// The logger to use public MQTTConnectorAzureFunction(ILogger logger) { _logger = logger; @@ -67,7 +95,7 @@ public static bool DoesPathStartsWithSlash(string path) /// /// Gets the data type from a data type name. /// - /// the name of the data type. + /// the name of the data type. /// Thrown if the data type is not supported. /// Returns a task for updating a digital twin instance. public static Type GetDataTypeFromString(string dataTypeName) @@ -85,7 +113,7 @@ public static Type GetDataTypeFromString(string dataTypeName) /// /// the Azure Digital Twins client. /// the digital twin instance to update. - /// the name of the data type. + /// the name of the data type. Defaults to "double". /// Returns a task for updating a digital twin instance. public static async Task UpdateDigitalTwinAsync(DigitalTwinsClient client, DigitalTwinsInstance instance, string dataTypeName = "double") {