2 * Copyright (C) 2016 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define LOG_TAG "VrService"
21 #include <hardware/hardware.h>
22 #include <hardware/vr.h>
30 namespace implementation {
32 Vr::Vr(vr_module_t *device) : mDevice(device) {}
34 // Methods from ::android::hardware::vr::V1_0::IVr follow.
35 Return<void> Vr::init() {
36 mDevice->init(mDevice);
40 Return<void> Vr::setVrMode(bool enabled) {
41 mDevice->set_vr_mode(mDevice, enabled);
45 IVr* HIDL_FETCH_IVr(const char * /*name*/) {
46 const hw_module_t *hw_module = NULL;
48 int ret = hw_get_module(VR_HARDWARE_MODULE_ID, &hw_module);
50 return new Vr(reinterpret_cast<vr_module_t*>(
51 const_cast<hw_module_t*>(hw_module)));
53 ALOGE("hw_get_module %s failed: %d", VR_HARDWARE_MODULE_ID, ret);
58 } // namespace implementation
61 } // namespace hardware
62 } // namespace android