Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b571f97 authored by Devin Moore's avatar Devin Moore Committed by Gerrit Code Review
Browse files

Merge "sensors: adding a common convert lib"

parents 45661bec d8598ec6
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,12 @@ cc_library_static {
        "libhidlbase",
        "libhidlbase",
        "android.hardware.sensors@1.0",
        "android.hardware.sensors@1.0",
    ],
    ],
    whole_static_libs: [
        "sensors_common_convert",
    ],
    export_static_lib_headers: [
        "sensors_common_convert",
    ],
    local_include_dirs: ["include/sensors"],
    local_include_dirs: ["include/sensors"],
    export_shared_lib_headers: [
    export_shared_lib_headers: [
        "libhardware",
        "libhardware",
+5 −0
Original line number Original line Diff line number Diff line
@@ -196,6 +196,11 @@ void convertFromSensorEvent(const sensors_event_t &src, Event *dst) {
    }
    }
}
}


void convertFromASensorEvent(const ASensorEvent& src, Event* dst) {
    convertFromSensorEvent(
            android::hardware::sensors::implementation::common::convertASensorEvent(src), dst);
}

void convertToSensorEvent(const Event &src, sensors_event_t *dst) {
void convertToSensorEvent(const Event &src, sensors_event_t *dst) {
    *dst = {.version = sizeof(sensors_event_t),
    *dst = {.version = sizeof(sensors_event_t),
            .sensor = src.sensorHandle,
            .sensor = src.sensorHandle,
+2 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@


#include <android/hardware/sensors/1.0/ISensors.h>
#include <android/hardware/sensors/1.0/ISensors.h>
#include <hardware/sensors.h>
#include <hardware/sensors.h>
#include <sensors/common_convert.h>


namespace android {
namespace android {
namespace hardware {
namespace hardware {
@@ -31,6 +32,7 @@ void convertFromSensor(const sensor_t &src, SensorInfo *dst);
void convertToSensor(const SensorInfo &src, sensor_t *dst);
void convertToSensor(const SensorInfo &src, sensor_t *dst);


void convertFromSensorEvent(const sensors_event_t &src, Event *dst);
void convertFromSensorEvent(const sensors_event_t &src, Event *dst);
void convertFromASensorEvent(const ASensorEvent& src, Event* dst);
void convertToSensorEvent(const Event &src, sensors_event_t *dst);
void convertToSensorEvent(const Event &src, sensors_event_t *dst);


bool convertFromSharedMemInfo(const SharedMemInfo& memIn, sensors_direct_mem_t *memOut);
bool convertFromSharedMemInfo(const SharedMemInfo& memIn, sensors_direct_mem_t *memOut);
+6 −0
Original line number Original line Diff line number Diff line
@@ -37,6 +37,12 @@ cc_library_static {
        "libutils",
        "libutils",
        "android.hardware.sensors-V1-ndk",
        "android.hardware.sensors-V1-ndk",
    ],
    ],
    whole_static_libs: [
        "sensors_common_convert",
    ],
    export_static_lib_headers: [
        "sensors_common_convert",
    ],
    local_include_dirs: ["include/aidl/sensors"],
    local_include_dirs: ["include/aidl/sensors"],
    export_shared_lib_headers: [
    export_shared_lib_headers: [
        "libhardware",
        "libhardware",
+4 −0
Original line number Original line Diff line number Diff line
@@ -490,6 +490,10 @@ void convertFromSensorEvent(const sensors_event_t& src, Event* dst) {
    }
    }
}
}


void convertFromASensorEvent(const ASensorEvent& src, Event* dst) {
    convertFromSensorEvent(common::convertASensorEvent(src), dst);
}

}  // namespace implementation
}  // namespace implementation
}  // namespace sensors
}  // namespace sensors
}  // namespace hardware
}  // namespace hardware
Loading