private void findDocDBConnectionString(IoTHub iotHub) { string docDBConnectionString; if (iotHub.Company.DocDBConnectionString == null) { // Use the DocumentDB connection string of default settings docDBConnectionString = Program._sfDocDBConnectionString; ConsoleLog.WriteDocDBLogToConsole("Use the default DocumentDB of SmartFactory..."); } else { // Use the DocumentDB connection string of customer docDBConnectionString = iotHub.Company.DocDBConnectionString; ConsoleLog.WriteDocDBLogToConsole("Use the customer's DocumentDB..."); ConsoleLog.WriteBlobLogDebug("Use the customer's DocumentDB..."); } string accountEndpoint = docDBConnectionString.Split(';')[0]; _documentDB_EndpointUri = accountEndpoint.Replace("AccountEndpoint=", ""); string accountKey = docDBConnectionString.Split(';')[1]; _documentDB_PrimaryKey = accountKey.Replace("AccountKey=", ""); }
public Format_Detail GetById(int id) { using (CDStudioEntities dbEntity = new CDStudioEntities()) { IoTHub existingData = (from c in dbEntity.IoTHub.AsNoTracking() where c.Id == id select c).SingleOrDefault <IoTHub>(); if (existingData == null) { throw new CDSException(10901); } return(new Format_Detail() { Id = existingData.Id, IoTHubName = existingData.IoTHubName, Description = existingData.Description, CompanyName = existingData.Company == null ? "" : existingData.Company.Name, IoTHubEndPoint = existingData.IoTHubEndPoint, IoTHubConnectionString = existingData.IoTHubConnectionString, EventConsumerGroup = existingData.EventConsumerGroup, EventHubStorageConnectionString = existingData.EventHubStorageConnectionString, UploadContainer = existingData.UploadContainer, EnableMultipleReceiver = existingData.EnableMultipleReceiver }); } }
public int Create(int companyId, Format_Create parseData) { using (CDStudioEntities dbEntity = new CDStudioEntities()) { IoTHub newData = new IoTHub() { IoTHubName = parseData.IoTHubName, Description = parseData.Description ?? "", CompanyID = companyId, IoTHubEndPoint = parseData.IoTHubEndPoint ?? "", IoTHubConnectionString = parseData.IoTHubConnectionString ?? "", EventConsumerGroup = parseData.EventConsumerGroup ?? "", EventHubStorageConnectionString = parseData.EventHubStorageConnectionString ?? "", UploadContainer = parseData.UploadContainer ?? "", EnableMultipleReceiver = parseData.EnableMultipleReceiver }; dbEntity.IoTHub.Add(newData); try { dbEntity.SaveChanges(); } catch (DbUpdateException ex) { if (ex.InnerException.InnerException.Message.Contains("Cannot insert duplicate key")) { throw new CDSException(10905); } else { throw ex; } } return(newData.Id); } }
public void deleteIoTHub(string IoTHubAlias) { DBHelper._IoTHub dbhelp = new DBHelper._IoTHub(); IoTHub existingIoTHub = dbhelp.GetByid(IoTHubAlias); dbhelp.Delete(existingIoTHub); }
private CompatibleEventHub findCompatibleEventHub(IoTHub iotHub) { return(new CompatibleEventHub( iotHub.IoTHubEndPoint, // messages/events iotHub.IoTHubConnectionString, // IoT Hub Connection String iotHub.EventConsumerGroup, // Consumer Group iotHub.EventHubStorageConnectionString)); // Storage Connection String }
static void Main(string[] args) { iot = new IoTHub(); // Generate the data GenerateData(args); Console.ReadKey(); }
private ConnectionFactory() { IoTHubClient = new IoTHub(Config.Instance.IoTHubConnectionString); DatabaseClient = new DocumentClient(new Uri(Config.Instance.DocumentDbServer), Config.Instance.DocumentDbKey); CreateDatabaseIfNotExistsAsync().Wait(); DeviceRegistration = new DocumentDbRepository <DeviceRegistration>(DatabaseClient, Config.Instance.DocumentDbDatabaseId, typeof(DeviceRegistration).Name); }
public void deleteIoTHub(int Id) { DBHelper._IoTHub dbhelp = new DBHelper._IoTHub(); IoTHub existingIoTHub = dbhelp.GetByid(Id); if (existingIoTHub == null) { throw new CDSException(10901); } dbhelp.Delete(existingIoTHub); }
/* * 构造函数 * 需要注入DeviceDao, FieldDao, Logger */ public DeviceBus(IDeviceDao deviceDao, IFieldDao fieldDao, ICityDao cityDao, IoTHub iotHub, ILogger <DeviceBus> logger) { this._deviceDao = deviceDao; this._fieldDao = fieldDao; this._cityDao = cityDao; this._iotHub = iotHub; this._logger = logger; }
public async Task RoutesWithConditionsTest1() { var routes = new List <string> { @"FROM /messages WHERE as_number(temp) > 50 INTO BrokeredEndpoint(""/modules/ml/inputs/in1"")", @"FROM /messages/modules/ml WHERE messageType = 'alert' INTO BrokeredEndpoint(""/modules/asa/inputs/input1"")", @"FROM /messages/modules/asa/outputs/output1 WHERE info = 'aggregate' INTO $upstream" }; string edgeDeviceId = "edge"; var iotHub = new IoTHub(); (IEdgeHub edgeHub, IConnectionManager connectionManager) = await SetupEdgeHub(routes, iotHub, edgeDeviceId); TestDevice device1 = await TestDevice.Create("device1", edgeHub, connectionManager); TestModule moduleMl = await TestModule.Create(edgeDeviceId, "ml", "op1", "in1", edgeHub, connectionManager); TestModule moduleAsa = await TestModule.Create(edgeDeviceId, "asa", "output1", "input1", edgeHub, connectionManager); List <IMessage> deviceMessages = GetMessages(); deviceMessages.ForEach(d => d.Properties.Add("temp", "100")); await device1.SendMessages(deviceMessages); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(deviceMessages)); Assert.True(moduleMl.HasReceivedMessages(deviceMessages)); Assert.False(moduleAsa.HasReceivedMessages(deviceMessages)); List <IMessage> mlMessages = GetMessages(); mlMessages.ForEach(d => d.Properties.Add("messageType", "alert")); await moduleMl.SendMessageOnOutput(mlMessages); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(mlMessages)); Assert.False(moduleMl.HasReceivedMessages(mlMessages)); Assert.True(moduleAsa.HasReceivedMessages(mlMessages)); List <IMessage> asaMessages = GetMessages(); asaMessages.ForEach(d => d.Properties.Add("info", "aggregate")); await moduleAsa.SendMessageOnOutput(asaMessages); await Task.Delay(GetSleepTime()); Assert.True(iotHub.HasReceivedMessages(asaMessages)); Assert.False(moduleMl.HasReceivedMessages(asaMessages)); Assert.False(moduleAsa.HasReceivedMessages(asaMessages)); }
public static async Task <IActionResult> RemoveSetpoint( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "setpoint/clear")] HttpRequestMessage req, ILogger log) { try { return(new OkObjectResult(await IoTHub.ClearManualSetpoint())); } catch (Exception ex) { return(new BadRequestObjectResult(ex)); } }
public static async Task <IActionResult> ReadFromApp( [HttpTrigger(AuthorizationLevel.Function, "get", Route = "read")] HttpRequestMessage req, ILogger log) { try { return(new OkObjectResult(await IoTHub.ReadNow())); } catch (Exception ex) { return(new BadRequestObjectResult(ex)); } }
private void shutdownIoTHubReceiver(string companyId, IoTHub iotHub, string partition, string label) { string iotHubReceiverLongName = "C" + companyId + "_I" + iotHub.Id + "_P" + partition + "_" + label + "_" + iotHub.IoTHubName; if (iotHubReceiverLongName.Length > 35) { iotHubReceiverLongName = iotHubReceiverLongName.Substring(0, 35) + ".."; } string endPoint = "Applications/" + iotHubReceiverLongName + "/$/Delete?api-version=1.0"; CallServiceFabricAPI(endPoint, null); }
public static async Task <IActionResult> SetAway( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "away/off")] HttpRequest req, ILogger log) { try { return(new OkObjectResult(await IoTHub.AwayOff())); } catch (Exception ex) { return(new BadRequestObjectResult(ex)); } }
public void DeleteById(int id) { using (CDStudioEntities dbEntity = new CDStudioEntities()) { IoTHub existingData = dbEntity.IoTHub.Find(id); if (existingData == null) { throw new CDSException(10901); } dbEntity.Entry(existingData).State = EntityState.Deleted; dbEntity.SaveChanges(); } }
private void lanuchIoTHubReceiver(string companyId, IoTHub iotHub, string partition, string label) { string iotHubReceiverLongName = "C" + companyId + "_I" + iotHub.Id + "_P" + partition + "_" + label + "_" + iotHub.IoTHubName; if (iotHubReceiverLongName.Length > 35) { iotHubReceiverLongName = iotHubReceiverLongName.Substring(0, 35) + ".."; } string endPoint = "Applications/$/Create?api-version=1.0"; string postData = "{\"Name\":\"fabric:/" + iotHubReceiverLongName + "\",\"TypeName\":\"" + _SrvFabricIoTHubReceiverTypeName + "\",\"TypeVersion\":\"" + _Version + "\",\"ParameterList\":{\"input_CompanyId\":\"" + companyId + "\",\"input_IoTHubId\":\"" + iotHub.Id + "\",\"input_Partition\":\"" + partition + "\",\"input_Label\":\"" + label + "\",\"IoTHubEventProcessor_InstanceCount\":\"1\" }}"; CallServiceFabricAPI(endPoint, postData); }
private void findAllCompatibleEventHubs(IoTHub iotHub) { _Primary_CompatibleEventHub = new CompatibleEventHub( iotHub.P_IoTHubEndPoint, // messages/events iotHub.P_IoTHubConnectionString, // IoT Hub Connection String iotHub.P_EventConsumerGroup, // Consumer Group iotHub.P_EventHubStorageConnectionString); // Storage Connection String _Secondary_CompatibleEventHub = new CompatibleEventHub( iotHub.S_IoTHubEndPoint, // messages/events iotHub.S_IoTHubConnectionString, // IoT Hub Connection String iotHub.S_EventConsumerGroup, // Consumer Group iotHub.S_EventHubStorageConnectionString); // Storage Connection String }
public async Task MultipleRoutesSameModuleTest() { var routes = new List <string> { @"FROM /messages/* WHERE $connectionDeviceId = 'device1' INTO BrokeredEndpoint(""/modules/ml/inputs/in1"")", @"FROM /messages/modules/ml/outputs/op1 WHERE $connectionModuleId = 'ml' INTO BrokeredEndpoint(""/modules/ml/inputs/in2"")", @"FROM /messages/modules/ml/outputs/op2 INTO BrokeredEndpoint(""/modules/asa/inputs/input1"")" }; string edgeDeviceId = "edge"; var iotHub = new IoTHub(); (IEdgeHub edgeHub, IConnectionManager connectionManager) = await SetupEdgeHub(routes, iotHub, edgeDeviceId); TestDevice device1 = await TestDevice.Create("device1", edgeHub, connectionManager); TestModule moduleMl = await TestModule.Create(edgeDeviceId, "ml", "op1", new List <string> { "in1", "in2" }, edgeHub, connectionManager); TestModule moduleAsa = await TestModule.Create(edgeDeviceId, "asa", "output1", "input1", edgeHub, connectionManager); IList <IMessage> deviceMessages = GetMessages(); await device1.SendMessages(deviceMessages); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(deviceMessages)); Assert.True(moduleMl.HasReceivedMessages(deviceMessages)); Assert.False(moduleAsa.HasReceivedMessages(deviceMessages)); IList <IMessage> mlMessages = GetMessages(); await moduleMl.SendMessageOnOutput(mlMessages); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(mlMessages)); Assert.True(moduleMl.HasReceivedMessages(mlMessages)); Assert.False(moduleAsa.HasReceivedMessages(mlMessages)); IList <IMessage> mlMessages2 = GetMessages(); await moduleMl.SendMessageOnOutput(mlMessages2, "op2"); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(mlMessages2)); Assert.False(moduleMl.HasReceivedMessages(mlMessages2)); Assert.True(moduleAsa.HasReceivedMessages(mlMessages2)); }
public void addIoTHub(Edit iotHub) { DBHelper._IoTHub dbhelp = new DBHelper._IoTHub(); var newIoTHub = new IoTHub() { IoTHubName = iotHub.IoTHubName, Description = iotHub.Description, CompanyID = iotHub.CompanyId, IoTHubEndPoint = iotHub.IoTHubEndPoint, IoTHubConnectionString = iotHub.IoTHubConnectionString, EventConsumerGroup = iotHub.EventConsumerGroup, EventHubStorageConnectionString = iotHub.EventHubStorageConnectionString, UploadContainer = iotHub.UploadContainer }; dbhelp.Add(newIoTHub); }
public static async Task <IActionResult> AddSetpoint( [HttpTrigger(AuthorizationLevel.Function, "post", Route = "setpoint/add")] HttpRequestMessage req, ILogger log) { try { var request = await req.Content.ReadAsStringAsync(); var requestData = JsonConvert.DeserializeObject <SetPointMessage>(request); return(new OkObjectResult(await IoTHub.SetManualSetpoint(requestData.Setpoint, requestData.Hours))); } catch (Exception ex) { return(new BadRequestObjectResult(ex)); } }
private Dictionary <int, List <EventRuleCatalogEngine> > findAllEventRules(IoTHub ioTHub) { Dictionary <int, List <EventRuleCatalogEngine> > messageIdAlarmRules = new Dictionary <int, List <EventRuleCatalogEngine> >(); Dictionary <int, MessageCatalog> mcDictionary = new Dictionary <int, MessageCatalog>(); foreach (IoTDevice iotDevice in ioTHub.IoTDevice) { foreach (Equipment equipment in iotDevice.Equipment) { foreach (EquipmentClassMessageCatalog ecmc in equipment.EquipmentClass.EquipmentClassMessageCatalog) { if (mcDictionary.ContainsKey(ecmc.MessageCatalogID) != true) { mcDictionary.Add(ecmc.MessageCatalogID, ecmc.MessageCatalog); } } } } foreach (KeyValuePair <int, MessageCatalog> item in mcDictionary) { List <EventRuleCatalogEngine> arcEngineList = new List <EventRuleCatalogEngine>(); foreach (EventRuleCatalog erc in item.Value.EventRuleCatalog) { if (erc.ActiveFlag) { _consoleLog.MessageEventDebug("EventRuleCatalogId={0}", erc.Id); EventRuleCatalogEngine are = new EventRuleCatalogEngine(); are.EventRuleCatalogId = erc.Id; are.EventRuleCatalog = erc; are.RuleEngineItems = createRuleEngineItem(erc); are.LastTriggerTime = new DateTime(2017, 1, 1); are.Triggered = false; arcEngineList.Add(are); } } messageIdAlarmRules.Add(item.Key, arcEngineList); } return(messageIdAlarmRules); }
public async Task RoutesWithConditionsOnSystemPropertiesTest1() { var routes = new List <string> { @"FROM /messages WHERE $contentType = 'application/json' AND $contentEncoding = 'utf-8' INTO $upstream", @"FROM /messages WHERE $contentType = 'application/json' AND $contentEncoding <> 'utf-8' INTO BrokeredEndpoint(""/modules/mod2/inputs/in2"")", }; string edgeDeviceId = "edge"; var iotHub = new IoTHub(); (IEdgeHub edgeHub, IConnectionManager connectionManager) = await SetupEdgeHub(routes, iotHub, edgeDeviceId); TestDevice device1 = await TestDevice.Create("device1", edgeHub, connectionManager); TestModule module1 = await TestModule.Create(edgeDeviceId, "mod1", "op1", "in1", edgeHub, connectionManager); TestModule module2 = await TestModule.Create(edgeDeviceId, "mod2", "op2", "in2", edgeHub, connectionManager); List <IMessage> message1 = GetMessages(); message1.ForEach(d => d.SystemProperties[SystemProperties.ContentType] = "application/json"); message1.ForEach(d => d.SystemProperties[SystemProperties.ContentEncoding] = "utf-8"); await device1.SendMessages(message1); await Task.Delay(GetSleepTime()); Assert.True(iotHub.HasReceivedMessages(message1)); Assert.False(module1.HasReceivedMessages(message1)); Assert.False(module2.HasReceivedMessages(message1)); List <IMessage> message2 = GetMessages(); message2.ForEach(d => d.SystemProperties[SystemProperties.ContentType] = "application/json"); message2.ForEach(d => d.SystemProperties[SystemProperties.ContentEncoding] = "utf-16"); await device1.SendMessages(message2); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(message2)); Assert.False(module1.HasReceivedMessages(message2)); Assert.True(module2.HasReceivedMessages(message2)); }
private void loadConfigurationFromDB(string iotHubAliasName, MessageProcessorFactoryModel msgProcessorFactoryModel) { DBHelper._IoTHub iotHubHelper = new DBHelper._IoTHub(); IoTHub iotHub = iotHubHelper.GetByid(_IoTHubAliasName); if (iotHub == null) { ConsoleLog.WriteToConsole("IoTHubAlias Not Found. Alias:{0}", iotHubAliasName); ConsoleLog.WriteBlobLogError("IoTHubAlias Not Found. Alias:{0}", iotHubAliasName); throw new Exception("IoTHubAlias Not Found"); } _companyId = iotHub.CompanyID; msgProcessorFactoryModel.SimpleIoTDeviceMessageCatalogList = findAllMessageSchema(iotHub); msgProcessorFactoryModel.MessageIdAlarmRules = findAllMessageAlarmRules(iotHub.IoTHubAlias); findAllCompatibleEventHubs(iotHub); findDocDBConnectionString(iotHub); }
public async Task RoutesWithConditionsTest2() { var routes = new List <string> { @"FROM /messages WHERE as_number(temp) > 50 INTO BrokeredEndpoint(""/modules/mod1/inputs/in1"")", @"FROM /messages/* WHERE as_number(temp) < 50 INTO BrokeredEndpoint(""/modules/mod2/inputs/in2"")", }; string edgeDeviceId = "edge"; var iotHub = new IoTHub(); (IEdgeHub edgeHub, IConnectionManager connectionManager) = await SetupEdgeHub(routes, iotHub, edgeDeviceId); TestDevice device1 = await TestDevice.Create("device1", edgeHub, connectionManager); TestModule module1 = await TestModule.Create(edgeDeviceId, "mod1", "op1", "in1", edgeHub, connectionManager); TestModule module2 = await TestModule.Create(edgeDeviceId, "mod2", "op2", "in2", edgeHub, connectionManager); List <IMessage> messages1 = GetMessages(); messages1.ForEach(d => d.Properties.Add("temp", "100")); await device1.SendMessages(messages1); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(messages1)); Assert.True(module1.HasReceivedMessages(messages1)); Assert.False(module2.HasReceivedMessages(messages1)); List <IMessage> messages2 = GetMessages(); messages2.ForEach(d => d.Properties.Add("temp", "20")); await device1.SendMessages(messages2); await Task.Delay(GetSleepTime()); Assert.False(iotHub.HasReceivedMessages(messages2)); Assert.False(module1.HasReceivedMessages(messages2)); Assert.True(module2.HasReceivedMessages(messages2)); }
public void updateIoTHub(int Id, Edit iotHub) { DBHelper._IoTHub dbhelp = new DBHelper._IoTHub(); IoTHub existingIoTHub = dbhelp.GetByid(Id); if (existingIoTHub == null) { throw new CDSException(10901); } existingIoTHub.IoTHubName = iotHub.IoTHubName; existingIoTHub.Description = iotHub.Description; existingIoTHub.CompanyID = iotHub.CompanyId; existingIoTHub.IoTHubEndPoint = iotHub.IoTHubEndPoint; existingIoTHub.IoTHubConnectionString = iotHub.IoTHubConnectionString; existingIoTHub.EventConsumerGroup = iotHub.EventConsumerGroup; existingIoTHub.EventHubStorageConnectionString = iotHub.EventHubStorageConnectionString; existingIoTHub.UploadContainer = iotHub.UploadContainer; dbhelp.Update(existingIoTHub); }
public void updateIoTHub(string IoTHubAlias, Edit iotHub) { DBHelper._IoTHub dbhelp = new DBHelper._IoTHub(); IoTHub existingIoTHub = dbhelp.GetByid(IoTHubAlias); existingIoTHub.IoTHubAlias = iotHub.IoTHubAlias; existingIoTHub.Description = iotHub.Description; existingIoTHub.CompanyID = iotHub.CompanyId; existingIoTHub.P_IoTHubEndPoint = iotHub.P_IoTHubEndPoint; existingIoTHub.P_IoTHubConnectionString = iotHub.P_IoTHubConnectionString; existingIoTHub.P_EventConsumerGroup = iotHub.P_EventConsumerGroup; existingIoTHub.P_EventHubStorageConnectionString = iotHub.P_EventHubStorageConnectionString; existingIoTHub.P_UploadContainer = iotHub.P_UploadContainer; existingIoTHub.S_IoTHubEndPoint = iotHub.S_IoTHubEndPoint; existingIoTHub.S_IoTHubConnectionString = iotHub.S_IoTHubConnectionString; existingIoTHub.S_EventConsumerGroup = iotHub.S_EventConsumerGroup; existingIoTHub.S_EventHubStorageConnectionString = iotHub.S_EventHubStorageConnectionString; existingIoTHub.S_UploadContainer = iotHub.S_UploadContainer; dbhelp.Update(existingIoTHub); }
public async Task ReportedPropertyUpdatesAsTelemetryTest() { var routes = new List <string> { @"FROM /* INTO $upstream", }; string edgeDeviceId = "edge"; var iotHub = new IoTHub(); (IEdgeHub edgeHub, IConnectionManager connectionManager) = await SetupEdgeHub(routes, iotHub, edgeDeviceId); TestDevice device1 = await TestDevice.Create("device1", edgeHub, connectionManager); IMessage message = GetReportedPropertiesMessage(); await device1.UpdateReportedProperties(message); await Task.Delay(GetSleepTime()); Assert.True(iotHub.HasReceivedTwinChangeNotification(edgeDeviceId, edgeHubModuleId)); }
public IoTHub generateIoTHubForTest(string iotHubId) { IoTHub iotHub = new IoTHub(); iotHub.Id = 1234; iotHub.IoTHubName = "cdsdemo"; iotHub.Description = "Walker's IoT Hub"; iotHub.CompanyID = 69; iotHub.IoTHubEndPoint = "messages/events"; iotHub.IoTHubConnectionString = "HostName=cds-dev.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=XuIGgnCmx7DrOGSj6T3nhTYm60+jhP4gWAsHkSjXDyc="; iotHub.EventConsumerGroup = "cdsdemo"; iotHub.EventHubStorageConnectionString = "DefaultEndpointsProtocol=https;AccountName=sfephost;AccountKey=0Exx0b+nflOF8w+F84I3x7UW949fSoUMlxJa7hmRLEA/X7WTgfswnaE2dipOlLMuu+Y++wrVCNMtz04mFA2KHQ==;EndpointSuffix=core.windows.net"; iotHub.UploadContainer = "cdsdemo-attachment"; Factory factory1 = new Factory(); factory1.Id = 40; iotHub.Company = new Company(); iotHub.Company.Factory.Add(factory1); iotHub.IoTDevice = generateIoTDevicesForTest(iotHub.CompanyID, iotHub.Company.Factory.ElementAt(0).Id, iotHub.Id); return(iotHub); }
private async void MeasureTimerTick(object sender, object e) { // read Temperature double temperature = await bme280Sensor.ReadTemperature(); // convert to Fahrenheit double fahrenheitTemperature = temperature * 1.8 + 32.0; // read Proximity int proximity = vncl4010Sensor.ReadProximity(); TemperatureStatus.Text = "The temperature is currently " + fahrenheitTemperature.ToString("n1") + "°F"; var colorRead = await colorSensor.GetClosestColor(); SolidColorBrush brush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, colorRead.ColorValue.R, colorRead.ColorValue.G, colorRead.ColorValue.B)); this.Background = brush; await IoTHub.SendDeviceToCloudMessage(fahrenheitTemperature, colorRead.ColorName); await IoTCentral.SendTelemetryAsync(fahrenheitTemperature, colorRead.ColorName); }
public void addIoTHub(Edit iotHub) { DBHelper._IoTHub dbhelp = new DBHelper._IoTHub(); var newIoTHub = new IoTHub() { IoTHubAlias = iotHub.IoTHubAlias, Description = iotHub.Description, CompanyID = iotHub.CompanyId, P_IoTHubEndPoint = iotHub.P_IoTHubEndPoint, P_IoTHubConnectionString = iotHub.P_IoTHubConnectionString, P_EventConsumerGroup = iotHub.P_EventConsumerGroup, P_EventHubStorageConnectionString = iotHub.P_EventHubStorageConnectionString, P_UploadContainer = iotHub.P_UploadContainer, S_IoTHubEndPoint = iotHub.S_IoTHubEndPoint, S_IoTHubConnectionString = iotHub.S_IoTHubConnectionString, S_EventConsumerGroup = iotHub.S_EventConsumerGroup, S_EventHubStorageConnectionString = iotHub.S_EventHubStorageConnectionString, S_UploadContainer = iotHub.S_UploadContainer }; dbhelp.Add(newIoTHub); }