/// <summary> /// Azure IoT Suite Simulated Device schema /// </summary> /// <param name="deviceId"></param> /// <param name="measureName"></param> /// <param name="sensorUnit"></param> public SensorIoTHub(ISensor sensor, string deviceID) { this.Sensor = sensor; this.component = sensor as IComponent; // Only Device ID is not hard-coded, the rest of the Device Properties are hard-coded below, and the DeviceInfo message is sent to the IoT Hub to update var loc = ConfigurationManager.DeviceLocations.Find(x => x.UniqueRPiDeviceID.Contains(deviceID.ToUpperInvariant())); if (loc == null) { // just defaults to 1 Epping Road loc = new ConfigurationManager.DeviceLocation("F4D9C1B3-F68C-47B6-8894-855E3D78CF4C", "rpi01", "HostName=FaisterRemote.azure-devices.net;DeviceId=rpi01;SharedAccessKey=JvGy9y1z6GlZFywrdAbFGw==", -33.796875, 151.138428); // Microsoft Sydney, 1 Epping Road, North Ryde, NSW 2113, Australia } this.DeviceId = loc.DeviceID; }
public ServiceManagerIoTHub(string deviceID) { // Only Device ID is not hard-coded, the rest of the Device Properties are hard-coded below, and the DeviceInfo message is sent to the IoT Hub to update var loc = ConfigurationManager.DeviceLocations.Find(x => x.UniqueRPiDeviceID.Contains(deviceID.ToUpperInvariant())); if (loc == null) { // just defaults to 1 Epping Road loc = new ConfigurationManager.DeviceLocation("F4D9C1B3-F68C-47B6-8894-855E3D78CF4C", "rpi01", "HostName=FaisterRemote.azure-devices.net;DeviceId=rpi01;SharedAccessKey=JvGy9y1z6GlZFywrdAbFGw==", -33.796875, 151.138428); // Microsoft Sydney, 1 Epping Road, North Ryde, NSW 2113, Australia } this.IoTConnectionString = loc.IoTHubConnectionString; this.Latitude = loc.Latitude; this.Longitude = loc.Longitude; // Only HTTP/1 is supported in UWP apps currently //deviceClient = DeviceClient.CreateFromConnectionString(IoTConnectionString, TransportType.Http1); InitIoTHubConnection(); UpdateDeviceInfo(); }