summaryrefslogtreecommitdiffstats
path: root/hal/gonk/GonkSensorsHelpers.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-05-14 10:50:01 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-05-14 10:50:01 +0200
commite9dd029f5d00590e1a53e63b0ab805110a10b54c (patch)
tree1126ca5dda925a62be3dc12c99c90e953d08afcf /hal/gonk/GonkSensorsHelpers.cpp
parent9d6a7ae25d7f5da855a8f8df884de483b4e2a538 (diff)
parent36b8fd734f590eb726ca2e50f8d1ff9cc968b8e1 (diff)
downloadUXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar.gz
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar.lz
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.tar.xz
UXP-e9dd029f5d00590e1a53e63b0ab805110a10b54c.zip
Merge branch 'master' into Basilisk-release
Diffstat (limited to 'hal/gonk/GonkSensorsHelpers.cpp')
-rw-r--r--hal/gonk/GonkSensorsHelpers.cpp112
1 files changed, 0 insertions, 112 deletions
diff --git a/hal/gonk/GonkSensorsHelpers.cpp b/hal/gonk/GonkSensorsHelpers.cpp
deleted file mode 100644
index ccc940c7c..000000000
--- a/hal/gonk/GonkSensorsHelpers.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "GonkSensorsHelpers.h"
-
-namespace mozilla {
-namespace hal {
-
-//
-// Unpacking
-//
-
-nsresult
-UnpackPDU(DaemonSocketPDU& aPDU, SensorsEvent& aOut)
-{
- nsresult rv = UnpackPDU(aPDU, aOut.mType);
- if (NS_FAILED(rv)) {
- return rv;
- }
- rv = UnpackPDU(aPDU, aOut.mTimestamp);
- if (NS_FAILED(rv)) {
- return rv;
- }
- rv = UnpackPDU(aPDU, aOut.mStatus);
- if (NS_FAILED(rv)) {
- return rv;
- }
-
- size_t i = 0;
-
- switch (aOut.mType) {
- case SENSORS_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
- case SENSORS_TYPE_GYROSCOPE_UNCALIBRATED:
- /* 6 data values */
- rv = UnpackPDU(aPDU, aOut.mData.mFloat[i++]);
- if (NS_FAILED(rv)) {
- return rv;
- }
- /* fall through */
- case SENSORS_TYPE_ROTATION_VECTOR:
- case SENSORS_TYPE_GAME_ROTATION_VECTOR:
- case SENSORS_TYPE_GEOMAGNETIC_ROTATION_VECTOR:
- /* 5 data values */
- rv = UnpackPDU(aPDU, aOut.mData.mFloat[i++]);
- if (NS_FAILED(rv)) {
- return rv;
- }
- rv = UnpackPDU(aPDU, aOut.mData.mFloat[i++]);
- if (NS_FAILED(rv)) {
- return rv;
- }
- /* fall through */
- case SENSORS_TYPE_ACCELEROMETER:
- case SENSORS_TYPE_GEOMAGNETIC_FIELD:
- case SENSORS_TYPE_ORIENTATION:
- case SENSORS_TYPE_GYROSCOPE:
- case SENSORS_TYPE_GRAVITY:
- case SENSORS_TYPE_LINEAR_ACCELERATION:
- /* 3 data values */
- rv = UnpackPDU(aPDU, aOut.mData.mFloat[i++]);
- if (NS_FAILED(rv)) {
- return rv;
- }
- rv = UnpackPDU(aPDU, aOut.mData.mFloat[i++]);
- if (NS_FAILED(rv)) {
- return rv;
- }
- /* fall through */
- case SENSORS_TYPE_LIGHT:
- case SENSORS_TYPE_PRESSURE:
- case SENSORS_TYPE_TEMPERATURE:
- case SENSORS_TYPE_PROXIMITY:
- case SENSORS_TYPE_RELATIVE_HUMIDITY:
- case SENSORS_TYPE_AMBIENT_TEMPERATURE:
- case SENSORS_TYPE_HEART_RATE:
- case SENSORS_TYPE_TILT_DETECTOR:
- case SENSORS_TYPE_WAKE_GESTURE:
- case SENSORS_TYPE_GLANCE_GESTURE:
- case SENSORS_TYPE_PICK_UP_GESTURE:
- case SENSORS_TYPE_WRIST_TILT_GESTURE:
- case SENSORS_TYPE_SIGNIFICANT_MOTION:
- case SENSORS_TYPE_STEP_DETECTED:
- /* 1 data value */
- rv = UnpackPDU(aPDU, aOut.mData.mFloat[i++]);
- if (NS_FAILED(rv)) {
- return rv;
- }
- break;
- case SENSORS_TYPE_STEP_COUNTER:
- /* 1 data value */
- rv = UnpackPDU(aPDU, aOut.mData.mUint[0]);
- if (NS_FAILED(rv)) {
- return rv;
- }
- break;
- default:
- if (MOZ_HAL_IPC_UNPACK_WARN_IF(true, SensorsEvent)) {
- return NS_ERROR_ILLEGAL_VALUE;
- }
- }
- rv = UnpackPDU(aPDU, aOut.mDeliveryMode);
- if (NS_FAILED(rv)) {
- return rv;
- }
- return NS_OK;
-}
-
-} // namespace hal
-} // namespace mozilla