private async void MotionTimerThread() { var pirData = new PirData() { DeviceId = deviceId, IsMotionDetected = false }; var messageString = JsonConvert.SerializeObject(pirData); var message = new Message(Encoding.ASCII.GetBytes(messageString)); await deviceClient.SendEventAsync(message); Debug.WriteLine("Motion not detected!"); }
private async void PirSensorOnMotionDetected(object sender, GpioPinValueChangedEventArgs gpioPinValueChangedEventArgs) { var pirData = new PirData() { DeviceId = deviceId, IsMotionDetected = true }; var messageString = JsonConvert.SerializeObject(pirData); var message = new Message(Encoding.ASCII.GetBytes(messageString)); await deviceClient.SendEventAsync(message); Debug.WriteLine("Motion Detected!"); }