/// <summary> /// Main page constructor /// </summary> public MainPage() { this.InitializeComponent(); // Hard coding guid for sensors. Not an issue for this particular application which is meant for testing and demos List<ConnectTheDotsSensor> sensors = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor("2298a348-e2f9-4438-ab23-82a3930662ab", "Temperature", "F"), }; ctdHelper = new ConnectTheDotsHelper(serviceBusNamespace: "YOURSERVICEBUS-ns", eventHubName: "ehdevices", keyName: "D1", key: "YOUR_KEY", displayName: "YOUR_DEVICE_NAME", organization: "YOUR_ORGANIZATION_OR_SELF", location: "YOUR_LOCATION", sensorList: sensors); Button_Click(null, null); }
/// <summary> /// Main page constructor /// </summary> public MainPage() { this.InitializeComponent(); // Hard coding guid for sensors. Not an issue for this particular application which is meant for testing and demos List <ConnectTheDotsSensor> sensors = new List <ConnectTheDotsSensor> { new ConnectTheDotsSensor("2298a348-e2f9-4438-ab23-82a3930662ab", "Temperature", "F"), }; ctdHelper = new ConnectTheDotsHelper(serviceBusNamespace: "YOURSERVICEBUS-ns", eventHubName: "ehdevices", keyName: "D1", key: "YOUR_KEY", displayName: "YOUR_DEVICE_NAME", organization: "YOUR_ORGANIZATION_OR_SELF", location: "YOUR_LOCATION", sensorList: sensors); Button_Click(null, null); }
/// <summary> /// Main page constructor /// </summary> public MainPage() { this.InitializeComponent(); // Hard coding guid for sensors. Not an issue for this particular application which is meant for testing and demos List<ConnectTheDotsSensor> sensors = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor("2298a348-e2f9-4438-ab23-82a3930662ab", "Temperature", "F"), }; ctdHelper = new ConnectTheDotsHelper(serviceBusNamespace: "smarthomecloud2-ns", eventHubName: "ehdevices", keyName: "D1", key: "hmc/OlZBDYll46ZgfXAxzTZ+oj1gmXSJaqVydFBq9Bo=", displayName: "RPI", organization: "FH Hagenberg", location: "Hagenberg", sensorList: sensors); timer = new DispatcherTimer(); timer.Tick += Timer_Tick; timer.Interval = TimeSpan.FromMilliseconds(1000); timer.Start(); }
/// <summary> /// Main page constructor /// </summary> public MainPage() { this.InitializeComponent(); System.Diagnostics.Debug.WriteLine("IoT Hub\n"); deviceClient = DeviceClient.Create(iotHubUri, new DeviceAuthenticationWithRegistrySymmetricKey("myFirstDevice", deviceKey)); SendDeviceToCloudMessagesAsync(); // Hard coding guid for sensors. Not an issue for this particular application which is meant for testing and demos List<ConnectTheDotsSensor> sensors = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor("2298a348-e2f9-4438-ab23-82a3930662ab", "Temperature", "F"), }; ctdHelper = new ConnectTheDotsHelper(serviceBusNamespace: "dubyahub-ns", eventHubName: "dubyahub", keyName: "SAS", key: "iqJC+Fg/9JSWQo5mzucOvfQOtshqcEGunjoXl/V78GE=", displayName: "minwinpc", organization: "Dubya", location: "Hello World!", sensorList: sensors); //Button_Click(null, null); }
/// <summary> /// Main page constructor /// </summary> public MainPage() { this.InitializeComponent(); InitGPIO(); // Hard coding guid for sensors. Not an issue for this particular application which is meant for testing and demos List<ConnectTheDotsSensor> sensors = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor(), }; //!!!请修改这里,填上相应的值,前四个为必要的修改的值,否则无法连上Event Hub ctdHelper = new ConnectTheDotsHelper( serviceBusNamespace: "这个是Service Bus的命名空间名称", eventHubName: "Event Hub的名字", keyName: "在Event Hub配置的规则名称(如Send)", key: "在Event Hub配置的相应规则的密钥", displayName: "SmartLift", organization: "Microsoft", location: "Beijing", sensorList: sensors); // Start Timer every 1 seconds ReadSensorTimer = new DispatcherTimer(); ReadSensorTimer.Interval = TimeSpan.FromMilliseconds(1000); ReadSensorTimer.Tick += Timer_Tick; ReadSensorTimer.Start(); Unloaded += MainPage_Unloaded; //InitializeSensor(DATA_PIN, SCK_PIN); // Initialize and Start HTTP Server HttpServer WebServer = new HttpServer(); WebServer.RecivedMeg += (meg, eve) => { this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { tbmeg.Text = meg.ToString(); }).AsTask(); }; var asyncAction = ThreadPool.RunAsync((w) => { WebServer.StartServer(); }); }
/// <summary> /// Main page constructor /// </summary> public MainPage() { this.InitializeComponent(); InitGPIO(); // Hard coding guid for sensors. Not an issue for this particular application which is meant for testing and demos List<ConnectTheDotsSensor> sensors = new List<ConnectTheDotsSensor> { new ConnectTheDotsSensor(), }; ctdHelper = new ConnectTheDotsHelper( serviceBusNamespace: "iotwin10msg-ns", eventHubName: "ioteventhub", keyName: "SendRule", key: "OxJ8Nmw3oJBmpZH/S/aXOWT2s5mE2YuRko7OJ+yziec=", displayName: "YOUR_DEVICE_NAME", organization: "YOUR_ORGANIZATION_OR_SELF", location: "YOUR_LOCATION", sensorList: sensors); // Start Timer every 1 seconds ReadSensorTimer = new DispatcherTimer(); ReadSensorTimer.Interval = TimeSpan.FromMilliseconds(500); ReadSensorTimer.Tick += Timer_Tick; ReadSensorTimer.Start(); Unloaded += MainPage_Unloaded; InitializeSensor(DATA_PIN, SCK_PIN); // Initialize and Start HTTP Server HttpServer WebServer = new HttpServer(); WebServer.RecivedMeg += (meg, eve) => { this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { tbmeg.Text = meg.ToString(); }).AsTask(); }; var asyncAction = ThreadPool.RunAsync((w) => { WebServer.StartServer(); }); getip(); }