summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarie White <mariewhite@google.com>2017-09-07 16:12:13 -0700
committerMarie White <mariewhite@google.com>2017-09-07 20:49:13 -0700
commit45516aab4012fb8eec77b09f20d84d470e6aa8a6 (patch)
treef5e13ffceecd7a12d4a0fcfc4a82702969cb2c5f
parent089038395773ea1af27f6063ab090649cd1df2ed (diff)
downloadnative-45516aab4012fb8eec77b09f20d84d470e6aa8a6.tar.gz
Set enum to fixed size type
Bug: 63683612 Test: Manual. Ran O2 on Marlin, tested image streaming manually. Since DvrPoseRawDataType enum will be part of the public DVR API, explicitly define the size of the enum. Change-Id: I3900470ccb3ca7a2c4e7ed8e7f5586c60486d9e6
-rw-r--r--libs/vr/libdvr/dvr_pose.cpp3
-rw-r--r--libs/vr/libdvr/include/dvr/dvr_api.h4
-rw-r--r--libs/vr/libdvr/include/dvr/dvr_pose.h19
-rw-r--r--libs/vr/libvrsensor/include/dvr/pose_client.h3
-rw-r--r--libs/vr/libvrsensor/include/private/dvr/pose_client_internal.h3
-rw-r--r--libs/vr/libvrsensor/pose_client.cpp10
6 files changed, 18 insertions, 24 deletions
diff --git a/libs/vr/libdvr/dvr_pose.cpp b/libs/vr/libdvr/dvr_pose.cpp
index 2ac3c0c4aa..c379ef55e8 100644
--- a/libs/vr/libdvr/dvr_pose.cpp
+++ b/libs/vr/libdvr/dvr_pose.cpp
@@ -9,8 +9,7 @@
using android::dvr::ConsumerQueue;
-int dvrPoseClientGetDataReader(DvrPoseClient* client,
- DvrPoseRawDataType data_type,
+int dvrPoseClientGetDataReader(DvrPoseClient* client, uint64_t data_type,
DvrReadBufferQueue** queue_out) {
if (!client || !queue_out)
return -EINVAL;
diff --git a/libs/vr/libdvr/include/dvr/dvr_api.h b/libs/vr/libdvr/include/dvr/dvr_api.h
index 8d4995a9ec..6daf157f36 100644
--- a/libs/vr/libdvr/include/dvr/dvr_api.h
+++ b/libs/vr/libdvr/include/dvr/dvr_api.h
@@ -250,11 +250,11 @@ typedef int (*DvrPoseClientSensorsEnablePtr)(DvrPoseClient* client,
typedef int (*DvrPoseClientDataCapturePtr)(DvrPoseClient* client,
const DvrPoseDataCaptureRequest* request);
typedef int (*DvrPoseClientDataReaderDestroyPtr)(DvrPoseClient* client,
- DvrPoseRawDataType data_type);
+ uint64_t data_type);
// dvr_pose.h
typedef int (*DvrPoseClientGetDataReaderPtr)(DvrPoseClient* client,
- DvrPoseRawDataType data_type,
+ uint64_t data_type,
DvrReadBufferQueue** read_queue);
// services/vr/virtual_touchpad/include/dvr/virtual_touchpad_client.h
diff --git a/libs/vr/libdvr/include/dvr/dvr_pose.h b/libs/vr/libdvr/include/dvr/dvr_pose.h
index 85631f7199..87527515b4 100644
--- a/libs/vr/libdvr/include/dvr/dvr_pose.h
+++ b/libs/vr/libdvr/include/dvr/dvr_pose.h
@@ -99,20 +99,20 @@ typedef struct __attribute__((packed, aligned(16))) DvrPose {
} DvrPose;
// Represents a data type that can be streamed from pose service.
-typedef enum DvrPoseRawDataType {
- DVR_POSE_RAW_DATA_STEREO_IMAGE,
- DVR_POSE_RAW_DATA_POINT_CLOUD,
- DVR_POSE_RAW_DATA_FEATURES,
+enum {
+ DVR_POSE_RAW_DATA_STEREO_IMAGE = (1ULL << 0),
+ DVR_POSE_RAW_DATA_POINT_CLOUD = (1ULL << 1),
+ DVR_POSE_RAW_DATA_FEATURES = (1ULL << 2),
// Always last.
- DVR_POSE_RAW_DATA_COUNT,
-} DvrPoseRawDataType;
+ DVR_POSE_RAW_DATA_COUNT = (1ULL << 3),
+};
// A request to retrieve data from the pose service. Expects that a buffer
// queue has been initialized through dvrPoseClientGetDataReader().
typedef struct DvrPoseDataCaptureRequest {
- // The type of data to capture. Refer to enum DvrPoseRawDataType for types.
- DvrPoseRawDataType data_type;
+ // The type of data to capture. Refer to enum DVR_POSE_RAW_DATA_* for types.
+ uint64_t data_type;
// The sample interval. This can be used to skip samples. For example, a
// value of 5 will capture every fifth frame and discard the 4 frames in
// between. Set to 1 to capture all frames.
@@ -144,8 +144,7 @@ typedef struct DvrPoseDataCaptureRequest {
// be found in the metadata struct DvrNativeBufferMetadata, where width is
// |crop_right| and height is |crop_bottom|/2. Each image is contiguous in
// memory with stride equal to width.
-int dvrPoseClientGetDataReader(DvrPoseClient* client,
- DvrPoseRawDataType data_type,
+int dvrPoseClientGetDataReader(DvrPoseClient* client, uint64_t data_type,
DvrReadBufferQueue** queue_out);
// TODO(b/65067592): Move pose api's from pose_client.h to here.
diff --git a/libs/vr/libvrsensor/include/dvr/pose_client.h b/libs/vr/libvrsensor/include/dvr/pose_client.h
index d69d8253cb..bb25f1d325 100644
--- a/libs/vr/libvrsensor/include/dvr/pose_client.h
+++ b/libs/vr/libvrsensor/include/dvr/pose_client.h
@@ -167,8 +167,7 @@ int dvrPoseClientDataCapture(DvrPoseClient* client,
const DvrPoseDataCaptureRequest* request);
// Destroys the write buffer queue for the given |data_type|.
-int dvrPoseClientDataReaderDestroy(DvrPoseClient* client,
- DvrPoseRawDataType data_type);
+int dvrPoseClientDataReaderDestroy(DvrPoseClient* client, uint64_t data_type);
#ifdef __cplusplus
} // extern "C"
diff --git a/libs/vr/libvrsensor/include/private/dvr/pose_client_internal.h b/libs/vr/libvrsensor/include/private/dvr/pose_client_internal.h
index 7198fe88d7..39592bb15d 100644
--- a/libs/vr/libvrsensor/include/private/dvr/pose_client_internal.h
+++ b/libs/vr/libvrsensor/include/private/dvr/pose_client_internal.h
@@ -10,8 +10,7 @@ typedef struct DvrPoseClient DvrPoseClient;
namespace android {
namespace dvr {
-int dvrPoseClientGetDataReaderHandle(DvrPoseClient *client,
- DvrPoseRawDataType data_type,
+int dvrPoseClientGetDataReaderHandle(DvrPoseClient *client, uint64_t data_type,
ConsumerQueue **queue_out);
} // namespace dvr
diff --git a/libs/vr/libvrsensor/pose_client.cpp b/libs/vr/libvrsensor/pose_client.cpp
index 4e23e25079..4acc085428 100644
--- a/libs/vr/libvrsensor/pose_client.cpp
+++ b/libs/vr/libvrsensor/pose_client.cpp
@@ -141,7 +141,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> {
return ReturnStatusOrError(status);
}
- int GetTangoReaderHandle(DvrPoseRawDataType data_type, ConsumerQueue** queue_out) {
+ int GetTangoReaderHandle(uint64_t data_type, ConsumerQueue** queue_out) {
// Get buffer.
Transaction trans{*this};
Status<LocalChannelHandle> status = trans.Send<LocalChannelHandle>(
@@ -169,7 +169,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> {
return ReturnStatusOrError(status);
}
- int DataReaderDestroy(DvrPoseRawDataType data_type) {
+ int DataReaderDestroy(uint64_t data_type) {
Transaction trans{*this};
Status<int> status = trans.Send<int>(DVR_POSE_TANGO_READER_DESTROY,
&data_type, sizeof(data_type), nullptr,
@@ -296,8 +296,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> {
ControllerClientState controllers_[MAX_CONTROLLERS];
};
-int dvrPoseClientGetDataReaderHandle(DvrPoseClient* client,
- DvrPoseRawDataType type,
+int dvrPoseClientGetDataReaderHandle(DvrPoseClient* client, uint64_t type,
ConsumerQueue** queue_out) {
return PoseClient::FromC(client)->GetTangoReaderHandle(type, queue_out);
}
@@ -362,8 +361,7 @@ int dvrPoseClientDataCapture(DvrPoseClient* client,
return PoseClient::FromC(client)->DataCapture(request);
}
-int dvrPoseClientDataReaderDestroy(DvrPoseClient* client,
- DvrPoseRawDataType data_type) {
+int dvrPoseClientDataReaderDestroy(DvrPoseClient* client, uint64_t data_type) {
return PoseClient::FromC(client)->DataReaderDestroy(data_type);
}