Esempio n. 1
0
        private async Task initialzation(string certificatePath)
        {
            _restfulAPIHelper = new RestfulAPIHelper(_hwProductKey.email, _hwProductKey.password);

            // Get the Device Model
            string resp = await _restfulAPIHelper.callDeviceAPIService("GET", _hwProductKey.email, null);

            _deviceModels = DeviceModels.CreateDeviceModels(resp);

            verifyAndAppendIoTHubAuthCertificatePath(_deviceModels, _certificatePath);

            // Get the Message Schema of Device
            resp = await _restfulAPIHelper.getDeviceMessageSchemaAPIService(_hwProductKey.email);

            _messageCatalogSchemaList = MessageCatalogSchema.CreateMessageCatalogSchemaList(resp);

            _deviceClient = getAzureIoTDeviceSDKClient(_deviceModels);

            // Get SfTwin Properties Helper
            _sfTwinPropertiesHelper = new SfTwinPropertiesHelper(_deviceClient);

            // Sync System Config of Twin
            await _sfTwinPropertiesHelper.SyncAndUpdateSfTwinPropertiesFromTwin();
        }