Loading libs/vr/libvrsensor/include/dvr/pose_client.h +9 −3 Original line number Original line Diff line number Diff line Loading @@ -119,7 +119,7 @@ int dvrPoseClientPoll(DvrPoseClient* client, DvrPose* state); // Freezes the pose to the provided state. // Freezes the pose to the provided state. // // // Future poll operations will return this state until a different state is // Future poll operations will return this state until a different state is // frozen or dvrPoseSetMode() is called with a different mode. The timestamp is // frozen or dvrPoseClientModeSet() is called with a different mode. The timestamp is // not frozen. // not frozen. // // // @param client Pointer to the pose client. // @param client Pointer to the pose client. Loading @@ -131,13 +131,13 @@ int dvrPoseClientFreeze(DvrPoseClient* client, const DvrPose* frozen_state); // // // @param mode The requested pose mode. // @param mode The requested pose mode. // @return Zero on success, negative error code on failure. // @return Zero on success, negative error code on failure. int dvrPoseClientSetMode(DvrPoseClient* client, DvrPoseMode mode); int dvrPoseClientModeSet(DvrPoseClient* client, DvrPoseMode mode); // Gets the pose service mode. // Gets the pose service mode. // // // @param mode Return value for the current pose mode. // @param mode Return value for the current pose mode. // @return Zero on success, negative error code on failure. // @return Zero on success, negative error code on failure. int dvrPoseClientGetMode(DvrPoseClient* client, DvrPoseMode* mode); int dvrPoseClientModeGet(DvrPoseClient* client, DvrPoseMode* mode); // Get access to the shared memory pose ring buffer. // Get access to the shared memory pose ring buffer. // A future pose at vsync <current> + <offset> is accessed at index: // A future pose at vsync <current> + <offset> is accessed at index: Loading @@ -151,6 +151,12 @@ int dvrPoseClientGetMode(DvrPoseClient* client, DvrPoseMode* mode); int dvrPoseClientGetRingBuffer(DvrPoseClient* client, int dvrPoseClientGetRingBuffer(DvrPoseClient* client, DvrPoseRingBufferInfo* out_info); DvrPoseRingBufferInfo* out_info); // Sets enabled state for sensors pose processing. // // @param enabled Whether sensors are enabled or disabled. // @return Zero on success int dvrPoseClientSensorsEnable(DvrPoseClient* client, bool enabled); #ifdef __cplusplus #ifdef __cplusplus } // extern "C" } // extern "C" #endif #endif Loading libs/vr/libvrsensor/include/private/dvr/pose-ipc.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ enum { DVR_POSE_GET_MODE, DVR_POSE_GET_MODE, DVR_POSE_GET_CONTROLLER_RING_BUFFER, DVR_POSE_GET_CONTROLLER_RING_BUFFER, DVR_POSE_LOG_CONTROLLER, DVR_POSE_LOG_CONTROLLER, DVR_POSE_SENSORS_ENABLE, }; }; #ifdef __cplusplus #ifdef __cplusplus Loading libs/vr/libvrsensor/pose_client.cpp +15 −5 Original line number Original line Diff line number Diff line Loading @@ -130,6 +130,16 @@ class PoseClient : public pdx::ClientBase<PoseClient> { return ReturnStatusOrError(status); return ReturnStatusOrError(status); } } // Enables or disables all pose processing from sensors int EnableSensors(bool enabled) { Transaction trans{*this}; Status<int> status = trans.Send<int>(DVR_POSE_SENSORS_ENABLE, &enabled, sizeof(enabled), nullptr, 0); ALOGE_IF(!status, "Pose EnableSensors() failed because: %s\n", status.GetErrorMessage().c_str()); return ReturnStatusOrError(status); } int GetRingBuffer(DvrPoseRingBufferInfo* out_info) { int GetRingBuffer(DvrPoseRingBufferInfo* out_info) { // First time mapping the buffer? // First time mapping the buffer? const auto vsync_buffer = GetVsyncBuffer(); const auto vsync_buffer = GetVsyncBuffer(); Loading Loading @@ -277,17 +287,17 @@ int dvrPoseClientFreeze(DvrPoseClient* client, const DvrPose* frozen_state) { return PoseClient::FromC(client)->Freeze(*frozen_state); return PoseClient::FromC(client)->Freeze(*frozen_state); } } int dvrPoseClientSetMode(DvrPoseClient* client, DvrPoseMode mode) { int dvrPoseClientModeSet(DvrPoseClient* client, DvrPoseMode mode) { return PoseClient::FromC(client)->SetMode(mode); return PoseClient::FromC(client)->SetMode(mode); } } int dvrPoseClientGetMode(DvrPoseClient* client, DvrPoseMode* mode) { int dvrPoseClientModeGet(DvrPoseClient* client, DvrPoseMode* mode) { return PoseClient::FromC(client)->GetMode(mode); return PoseClient::FromC(client)->GetMode(mode); } } int dvrPoseClientGetRingBuffer(DvrPoseClient* client, DvrPoseRingBufferInfo* out_info) { int dvrPoseClientSensorsEnable(DvrPoseClient* client, bool enabled) { return PoseClient::FromC(client)->GetRingBuffer(out_info); return PoseClient::FromC(client)->EnableSensors(enabled); } } } // extern "C" } // extern "C" Loading
libs/vr/libvrsensor/include/dvr/pose_client.h +9 −3 Original line number Original line Diff line number Diff line Loading @@ -119,7 +119,7 @@ int dvrPoseClientPoll(DvrPoseClient* client, DvrPose* state); // Freezes the pose to the provided state. // Freezes the pose to the provided state. // // // Future poll operations will return this state until a different state is // Future poll operations will return this state until a different state is // frozen or dvrPoseSetMode() is called with a different mode. The timestamp is // frozen or dvrPoseClientModeSet() is called with a different mode. The timestamp is // not frozen. // not frozen. // // // @param client Pointer to the pose client. // @param client Pointer to the pose client. Loading @@ -131,13 +131,13 @@ int dvrPoseClientFreeze(DvrPoseClient* client, const DvrPose* frozen_state); // // // @param mode The requested pose mode. // @param mode The requested pose mode. // @return Zero on success, negative error code on failure. // @return Zero on success, negative error code on failure. int dvrPoseClientSetMode(DvrPoseClient* client, DvrPoseMode mode); int dvrPoseClientModeSet(DvrPoseClient* client, DvrPoseMode mode); // Gets the pose service mode. // Gets the pose service mode. // // // @param mode Return value for the current pose mode. // @param mode Return value for the current pose mode. // @return Zero on success, negative error code on failure. // @return Zero on success, negative error code on failure. int dvrPoseClientGetMode(DvrPoseClient* client, DvrPoseMode* mode); int dvrPoseClientModeGet(DvrPoseClient* client, DvrPoseMode* mode); // Get access to the shared memory pose ring buffer. // Get access to the shared memory pose ring buffer. // A future pose at vsync <current> + <offset> is accessed at index: // A future pose at vsync <current> + <offset> is accessed at index: Loading @@ -151,6 +151,12 @@ int dvrPoseClientGetMode(DvrPoseClient* client, DvrPoseMode* mode); int dvrPoseClientGetRingBuffer(DvrPoseClient* client, int dvrPoseClientGetRingBuffer(DvrPoseClient* client, DvrPoseRingBufferInfo* out_info); DvrPoseRingBufferInfo* out_info); // Sets enabled state for sensors pose processing. // // @param enabled Whether sensors are enabled or disabled. // @return Zero on success int dvrPoseClientSensorsEnable(DvrPoseClient* client, bool enabled); #ifdef __cplusplus #ifdef __cplusplus } // extern "C" } // extern "C" #endif #endif Loading
libs/vr/libvrsensor/include/private/dvr/pose-ipc.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ enum { DVR_POSE_GET_MODE, DVR_POSE_GET_MODE, DVR_POSE_GET_CONTROLLER_RING_BUFFER, DVR_POSE_GET_CONTROLLER_RING_BUFFER, DVR_POSE_LOG_CONTROLLER, DVR_POSE_LOG_CONTROLLER, DVR_POSE_SENSORS_ENABLE, }; }; #ifdef __cplusplus #ifdef __cplusplus Loading
libs/vr/libvrsensor/pose_client.cpp +15 −5 Original line number Original line Diff line number Diff line Loading @@ -130,6 +130,16 @@ class PoseClient : public pdx::ClientBase<PoseClient> { return ReturnStatusOrError(status); return ReturnStatusOrError(status); } } // Enables or disables all pose processing from sensors int EnableSensors(bool enabled) { Transaction trans{*this}; Status<int> status = trans.Send<int>(DVR_POSE_SENSORS_ENABLE, &enabled, sizeof(enabled), nullptr, 0); ALOGE_IF(!status, "Pose EnableSensors() failed because: %s\n", status.GetErrorMessage().c_str()); return ReturnStatusOrError(status); } int GetRingBuffer(DvrPoseRingBufferInfo* out_info) { int GetRingBuffer(DvrPoseRingBufferInfo* out_info) { // First time mapping the buffer? // First time mapping the buffer? const auto vsync_buffer = GetVsyncBuffer(); const auto vsync_buffer = GetVsyncBuffer(); Loading Loading @@ -277,17 +287,17 @@ int dvrPoseClientFreeze(DvrPoseClient* client, const DvrPose* frozen_state) { return PoseClient::FromC(client)->Freeze(*frozen_state); return PoseClient::FromC(client)->Freeze(*frozen_state); } } int dvrPoseClientSetMode(DvrPoseClient* client, DvrPoseMode mode) { int dvrPoseClientModeSet(DvrPoseClient* client, DvrPoseMode mode) { return PoseClient::FromC(client)->SetMode(mode); return PoseClient::FromC(client)->SetMode(mode); } } int dvrPoseClientGetMode(DvrPoseClient* client, DvrPoseMode* mode) { int dvrPoseClientModeGet(DvrPoseClient* client, DvrPoseMode* mode) { return PoseClient::FromC(client)->GetMode(mode); return PoseClient::FromC(client)->GetMode(mode); } } int dvrPoseClientGetRingBuffer(DvrPoseClient* client, DvrPoseRingBufferInfo* out_info) { int dvrPoseClientSensorsEnable(DvrPoseClient* client, bool enabled) { return PoseClient::FromC(client)->GetRingBuffer(out_info); return PoseClient::FromC(client)->EnableSensors(enabled); } } } // extern "C" } // extern "C"