public static ReportedProperties FromJsonObject(JObject json)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.connectionString = Utils.GetString(json, JsonConnectionString, NotFound);
                return(reportedProperties);
            }
Ejemplo n.º 2
0
            public static ReportedProperties FromJsonObject(JObject json)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.response = Utils.GetString(json, JsonResponse, NotFound);
                return(reportedProperties);
            }
            public static ReportedProperties FromJsonObject(JObject root)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.level = Utils.GetString(root, JsonLevel, NotFound);
                return(reportedProperties);
            }
Ejemplo n.º 4
0
            public static ReportedProperties FromJsonObject(JObject json)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.batteryRuntime   = Utils.GetString(json, JsonBatteryRuntime, NotFound);
                reportedProperties.batteryRemaining = Utils.GetString(json, JsonBatteryRemaining, NotFound);
                reportedProperties.batteryStatus    = Utils.GetString(json, JsonBatteryStatus, NotFound);
                reportedProperties.osEdition        = Utils.GetString(json, JsonOsEdition, NotFound);
                reportedProperties.secureBootState  = Utils.GetString(json, JsonSecureBootState, NotFound);

                reportedProperties.totalMemory               = Utils.GetString(json, JsonTotalMemory, NotFound);
                reportedProperties.totalStorage              = Utils.GetString(json, JsonTotalStorage, NotFound);
                reportedProperties.name                      = Utils.GetString(json, JsonName, NotFound);
                reportedProperties.processorArchitecture     = Utils.GetString(json, JsonProcessorArchitecture, NotFound);
                reportedProperties.commercializationOperator = Utils.GetString(json, JsonCommercializationOperator, NotFound);

                reportedProperties.displayResolution = Utils.GetString(json, JsonDisplayResolution, NotFound);
                reportedProperties.radioSwVer        = Utils.GetString(json, JsonRadioSwVer, NotFound);
                reportedProperties.processorType     = Utils.GetString(json, JsonProcessorType, NotFound);
                reportedProperties.platform          = Utils.GetString(json, JsonPlatform, NotFound);
                reportedProperties.osVer             = Utils.GetString(json, JsonOsVer, NotFound);

                reportedProperties.fwVer = Utils.GetString(json, JsonFwVer, NotFound);
                reportedProperties.hwVer = Utils.GetString(json, JsonHwVer, NotFound);
                reportedProperties.oem   = Utils.GetString(json, JsonOEM, NotFound);
                reportedProperties.type  = Utils.GetString(json, JsonType, NotFound);
                reportedProperties.lang  = Utils.GetString(json, JsonLang, NotFound);

                reportedProperties.dmVer        = Utils.GetString(json, JsonDmVer, NotFound);
                reportedProperties.model        = Utils.GetString(json, JsonModel, NotFound);
                reportedProperties.manufacturer = Utils.GetString(json, JsonManufacturer, NotFound);
                reportedProperties.id           = Utils.GetString(json, JsonId, NotFound);

                return(reportedProperties);
            }
Ejemplo n.º 5
0
            public static ReportedProperties FromJsonObject(JObject root)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.singleRebootTime = Utils.GetDateTimeAsString(root, JsonSingleRebootTime, NotFound);
                reportedProperties.dailyRebootTime  = Utils.GetDateTimeAsString(root, JsonDailyRebootTime, NotFound);
                reportedProperties.lastBootTime     = Utils.GetDateTimeAsString(root, JsonLastBootTime, NotFound);
                return(reportedProperties);
            }
Ejemplo n.º 6
0
            public static ReportedProperties FromJsonObject(JObject json)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.enabled        = Utils.GetString(json, JsonEnabled, NotFound);
                reportedProperties.startup        = Utils.GetString(json, JsonStartup, NotFound);
                reportedProperties.started        = Utils.GetString(json, JsonStarted, NotFound);
                reportedProperties.sourcePriority = Utils.GetString(json, JsonSourcePriority, NotFound);
                return(reportedProperties);
            }
            public static ReportedProperties FromJsonObject(JObject root)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.approved      = Utils.GetString(root, JsonApproved, NotFound);
                reportedProperties.installed     = Utils.GetString(root, JsonInstalled, NotFound);
                reportedProperties.failed        = Utils.GetString(root, JsonFailed, NotFound);
                reportedProperties.installable   = Utils.GetString(root, JsonInstallable, NotFound);
                reportedProperties.pendingReboot = Utils.GetString(root, JsonPendingReboot, NotFound);
                reportedProperties.lastScanTime  = Utils.GetString(root, JsonLastScanTime, NotFound);
                reportedProperties.deferUpgrade  = Utils.GetBool(root, JsonDeferUpgrade, false);

                return(reportedProperties);
            }
Ejemplo n.º 8
0
 Task ClearDeviceConnectionStatuses()
 {
     try
     {
         var      edgeHubReportedProperties = new ReportedProperties(this.versionInfo, null);
         var      twinCollection            = new TwinCollection(JsonConvert.SerializeObject(edgeHubReportedProperties));
         IMessage reportedPropertiesMessage = this.twinCollectionMessageConverter.ToMessage(twinCollection);
         return(this.twinManager.UpdateReportedPropertiesAsync(this.edgeHubIdentity.Id, reportedPropertiesMessage));
     }
     catch (Exception ex)
     {
         Events.ErrorClearingDeviceConnectionStatuses(ex);
         return(Task.CompletedTask);
     }
 }
Ejemplo n.º 9
0
 Task UpdateReportedProperties(long desiredVersion, LastDesiredStatus desiredStatus)
 {
     try
     {
         var           edgeHubReportedProperties = new ReportedProperties(this.versionInfo, desiredVersion, desiredStatus);
         var           twinCollection            = new TwinCollection(JsonConvert.SerializeObject(edgeHubReportedProperties));
         Core.IMessage reportedPropertiesMessage = this.twinCollectionMessageConverter.ToMessage(twinCollection);
         return(this.twinManager.UpdateReportedPropertiesAsync(this.id, reportedPropertiesMessage));
     }
     catch (Exception ex)
     {
         Events.ErrorUpdatingLastDesiredStatus(ex);
         return(Task.CompletedTask);
     }
 }
Ejemplo n.º 10
0
            public static ReportedProperties FromJsonObject(JObject root)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                reportedProperties.rootCATrustedCertificates_Root             = FromJsonObject(root, JsonRootCATrustedCertificates_Root);
                reportedProperties.rootCATrustedCertificates_CA               = FromJsonObject(root, JsonRootCATrustedCertificates_CA);
                reportedProperties.rootCATrustedCertificates_TrustedPublisher = FromJsonObject(root, JsonRootCATrustedCertificates_TrustedPublisher);
                reportedProperties.rootCATrustedCertificates_TrustedPeople    = FromJsonObject(root, JsonRootCATrustedCertificates_TrustedPeople);

                reportedProperties.certificateStore_CA_System   = FromJsonObject(root, JsonCertificateStore_CA_System);
                reportedProperties.certificateStore_Root_System = FromJsonObject(root, JsonCertificateStore_Root_System);
                reportedProperties.certificateStore_My_User     = FromJsonObject(root, JsonCertificateStore_My_User);
                reportedProperties.certificateStore_My_System   = FromJsonObject(root, JsonCertificateStore_My_System);

                return(reportedProperties);
            }
Ejemplo n.º 11
0
        Task UpdateDeviceConnectionStatus(IIdentity client, ConnectionStatus connectionStatus)
        {
            try
            {
                if (client.Id.Equals(this.edgeHubIdentity.Id))
                {
                    Events.SkipUpdatingEdgeHubIdentity(client.Id, connectionStatus);
                    return(Task.CompletedTask);
                }

                Events.UpdatingDeviceConnectionStatus(client.Id, connectionStatus);

                // If a downstream device disconnects, then remove the entry from Reported properties
                // If a module disconnects, then update the entry to status = Disconnected
                DeviceConnectionStatus GetDeviceConnectionStatus()
                {
                    if (connectionStatus == ConnectionStatus.Connected)
                    {
                        return(new DeviceConnectionStatus(connectionStatus, DateTime.UtcNow, null));
                    }
                    else
                    {
                        return(client is IDeviceIdentity
                            ? null
                            : new DeviceConnectionStatus(connectionStatus, null, DateTime.UtcNow));
                    }
                }

                var connectedDevices = new Dictionary <string, DeviceConnectionStatus>
                {
                    [TwinManager.EncodeTwinKey(client.Id)] = GetDeviceConnectionStatus()
                };
                var      edgeHubReportedProperties = new ReportedProperties(this.versionInfo, connectedDevices);
                var      twinCollection            = new TwinCollection(JsonConvert.SerializeObject(edgeHubReportedProperties));
                IMessage reportedPropertiesMessage = this.twinCollectionMessageConverter.ToMessage(twinCollection);
                return(this.twinManager.UpdateReportedPropertiesAsync(this.edgeHubIdentity.Id, reportedPropertiesMessage));
            }
            catch (Exception ex)
            {
                Events.ErrorUpdatingDeviceConnectionStatus(client.Id, ex);
                return(Task.CompletedTask);
            }
        }
Ejemplo n.º 12
0
            public static ReportedProperties FromJsonObject(JObject timeServiceObject)
            {
                ReportedProperties properties = new ReportedProperties();

                properties.localTime = Utils.GetString(timeServiceObject, JsonLocalTime, NotFound);
                properties.ntpServer = Utils.GetString(timeServiceObject, JsonNtpServer, NotFound);

                properties.dynamicDaylightTimeDisabled = Utils.GetBool(timeServiceObject, JSonDynamicDaylightTimeDisabled, false);

                properties.timeZoneKeyName = Utils.GetString(timeServiceObject, JSonTimeZoneKeyName, NotFound);

                properties.timeZoneBias              = Utils.GetInt(timeServiceObject, JsonTimeZoneBias, 0);
                properties.timeZoneStandardBias      = Utils.GetInt(timeServiceObject, JsonTimeZoneStandardBias, 0);
                properties.timeZoneStandardDate      = Utils.GetDateTimeAsString(timeServiceObject, JsonTimeZoneStandardDate, NotFound);
                properties.timeZoneStandardName      = Utils.GetString(timeServiceObject, JsonTimeZoneStandardName, NotFound);
                properties.timeZoneStandardDayOfWeek = Utils.GetInt(timeServiceObject, JsonTimeZoneStandardDayOfWeek, 0);
                properties.timeZoneDaylightBias      = Utils.GetInt(timeServiceObject, JsonTimeZoneDaylightBias, 0);
                properties.timeZoneDaylightDate      = Utils.GetDateTimeAsString(timeServiceObject, JsonTimeZoneDaylightDate, NotFound);
                properties.timeZoneDaylightName      = Utils.GetString(timeServiceObject, JsonTimeZoneDaylightName, NotFound);
                properties.timeZoneDaylightDayOfWeek = Utils.GetInt(timeServiceObject, JSonTimeZoneDaylightDayOfWeek, 0);
                return(properties);
            }
Ejemplo n.º 13
0
            public static ReportedProperties FromJsonObject(JObject json)
            {
                ReportedProperties reportedProperties = new ReportedProperties();

                return(reportedProperties);
            }