private string createUriToMobileService(SensorLog sensorLog)
 {
     var uriStr = APP_URL_MOBILE_SERVICES + "tables/SensorLog"
         + "?deviceId=" + sensorLog.DeviceId
         + "&pressure=" + sensorLog.Pressure
         + "&humidity=" + sensorLog.Humidity
         + "&temperature=" + sensorLog.Temperature
         + "&magneto_x=" + sensorLog.MagnetoX
         + "&magneto_y=" + sensorLog.MagnetoY
         + "&magneto_z=" + sensorLog.MagnetoZ
         + "&acceleration_x=" + sensorLog.AccelerationX
         + "&acceleration_y=" + sensorLog.AccelerationY
         + "&acceleration_z=" + sensorLog.AccelerationZ
         + "&gyro_x=" + sensorLog.GyroX
         + "&gyro_y=" + sensorLog.GyroY
         + "&gyro_z=" + sensorLog.GyroZ;
     return uriStr;
 }
        public Task ProcessEventsAsync(PartitionContext context, IEnumerable<EventData> messages)
        {
            foreach (EventData msg in messages)
            {
                if (msg.EnqueuedTimeUtc < DateTime.Today)
                {
                    continue;
                }
                SensorLog sensorLog = new SensorLog(context.EventHubPath, msg.Offset, msg.EnqueuedTimeUtc, context.Lease.PartitionId);
                
                foreach (string propKey in msg.Properties.Keys)
                {
                    switch (propKey)
                    {
                        case "deviceId":
                            // DeviceId を PartitionKeyとして使う
                            sensorLog.PartitionKey = (string)msg.Properties[propKey];
                            break;
                        case "pressure":
                            sensorLog.Pressure = (float)msg.Properties[propKey];
                            break;
                        case "humidity":
                            sensorLog.Humidity = (float)msg.Properties[propKey];
                            break;
                        case "temperature":
                            sensorLog.Temperature = (float)msg.Properties[propKey];
                            break;
                        case "accelerationX":
                            sensorLog.AccelerationX = (int)msg.Properties[propKey];
                            break;
                        case "accelerationY":
                            sensorLog.AccelerationY = (int)msg.Properties[propKey];
                            break;
                        case "accelerationZ":
                            sensorLog.AccelerationZ = (int)msg.Properties[propKey];
                            break;
                        case "gyroX":
                            sensorLog.GyroX = (int)msg.Properties[propKey];
                            break;
                        case "gyroY":
                            sensorLog.GyroY = (int)msg.Properties[propKey];
                            break;
                        case "gyroZ":
                            sensorLog.GyroZ = (int)msg.Properties[propKey];
                            break;
                        case "magnetoX":
                            sensorLog.MagnetoX = (int)msg.Properties[propKey];
                            break;
                        case "magnetoY":
                            sensorLog.MagnetoY = (int)msg.Properties[propKey];
                            break;
                        case "magnetoZ":
                            sensorLog.MagnetoZ = (int)msg.Properties[propKey];
                            break;
                    }
                }
                var result = sensorLogTable.ExecuteAsync(TableOperation.Insert(sensorLog));
                checkTodoSendData(sensorLog);

                /*string uriStr = createUriToMobileService(sensorLog);
                var request = new HttpRequestMessage(new HttpMethod("POST"), uriStr);
                client.SendAsync(request);*/
            }
            return Task.FromResult<object>(null);
        }
        private void checkTodoSendData(SensorLog sensorLog)
        {
            if (sensorLog.UploadTime < SensorEventProcessor.StartedTime)
            {
                return;
            }

            if (overDanger)
            {
                if (sensorLog.Temperature < thresholdTempDanger && sensorLog.Temperature > 10)
                {
                    overDanger = false;
                }
            }
            else
            {
                if (sensorLog.Temperature > thresholdTempDanger)
                {
                    overDanger = true;
                    notifyToFamily();
                }
            }
        }