public SmartWatchSensors ConvertJsonToSmartWatchSensor(SensorDataJson jsonData, SmartWatchSensors sensorData) { sensorData.accelerometer_acc = jsonData.accelerometer_acc; sensorData.accelerometer_X = jsonData.accelerometer_x; sensorData.accelerometer_Y = jsonData.accelerometer_y; sensorData.accelerometer_Z = jsonData.accelerometer_z; sensorData.magneticfield_acc = jsonData.magneticfield_acc; sensorData.magneticfield_x = jsonData.magneticfield_x; sensorData.magneticfield_y = jsonData.magneticfield_y; sensorData.magneticfield_z = jsonData.magneticfield_z; sensorData.gravity_acc = jsonData.gravity_acc; sensorData.gravity_x = jsonData.gravity_x; sensorData.gravity_y = jsonData.gravity_y; sensorData.gravity_z = jsonData.gravity_y; sensorData.gyroscope_acc = jsonData.gyroscope_acc; sensorData.gyroscope_x = jsonData.gyroscope_x; sensorData.gyroscope_y = jsonData.gyroscope_y; sensorData.gyroscope_z = jsonData.gyroscope_z; sensorData.heartRate_acc = jsonData.heartRate_acc; sensorData.heartRate = jsonData.heartRate; sensorData.stepCount_acc = jsonData.stepCount_acc; sensorData.stepCount_Value = jsonData.stepCount_Value; sensorData.TimeStamp = jsonData.TimeStamp; return(sensorData); }
public static double[] GetDoubleArray(SensorDataJson watchData) { double[] data = new double[Constants.LENGTH]; data[Constants.XAccelerationValue] = watchData.accelerometer_x; data[Constants.YAccelerationValue] = watchData.accelerometer_x; data[Constants.ZAccelerationValue] = watchData.accelerometer_z; data[Constants.XMagnetometerValue] = watchData.magneticfield_x; data[Constants.YMagnetometerValue] = watchData.magneticfield_y; data[Constants.ZMagnetometerValue] = watchData.magneticfield_z; data[Constants.XGyroscopeValue] = watchData.gyroscope_x; data[Constants.YGyroscopeValue] = watchData.gyroscope_y; data[Constants.ZGyroscopeValue] = watchData.gyroscope_z; data[Constants.StepCount] = watchData.stepCount_Value; data[Constants.HeartRate] = watchData.heartRate; return(data); }
public static SensorActivityWatch GetSensorActivityWatchFromJson(SensorDataJson watchData) { try { newData.XAccelerationValue = watchData.accelerometer_x; newData.YAccelerationValue = watchData.accelerometer_y; newData.ZAccelerationValue = watchData.accelerometer_z; newData.XMagnetometerValue = watchData.magneticfield_x; newData.YMagnetometerValue = watchData.magneticfield_y; newData.ZMagnetometerValue = watchData.magneticfield_z; newData.XGyroscopeValue = watchData.magneticfield_x; newData.YGyroscopeValue = watchData.magneticfield_y; newData.ZGyroscopeValue = watchData.magneticfield_z; newData.HeartRateValue = watchData.heartRate; newData.StepCountValue = watchData.stepCount_Value; newData.TimeStamp = watchData.TimeStamp; } catch (Exception e) { Console.WriteLine("Could not convert"); } return(newData); }