Home | History | Annotate | Download | only in hidl
      1 /*
      2  * Copyright (C) 2018 The Android Open Source Project
      3  *
      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
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     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.
     15  */
     16 
     17 #include <hidl/AidlCameraServiceListener.h>
     18 #include <hidl/Convert.h>
     19 
     20 namespace android {
     21 namespace frameworks {
     22 namespace cameraservice {
     23 namespace service {
     24 namespace V2_0 {
     25 namespace implementation {
     26 
     27 using hardware::cameraservice::utils::conversion::convertToHidlCameraDeviceStatus;
     28 
     29 binder::Status H2BCameraServiceListener::onStatusChanged(
     30     int32_t status, const ::android::String16& cameraId) {
     31   HCameraDeviceStatus hCameraDeviceStatus = convertToHidlCameraDeviceStatus(status);
     32   CameraStatusAndId cameraStatusAndId;
     33   cameraStatusAndId.deviceStatus = hCameraDeviceStatus;
     34   cameraStatusAndId.cameraId = String8(cameraId).string();
     35   auto ret = mBase->onStatusChanged(cameraStatusAndId);
     36   if (!ret.isOk()) {
     37       ALOGE("%s OnStatusChanged callback failed due to %s",__FUNCTION__,
     38             ret.description().c_str());
     39   }
     40   return binder::Status::ok();
     41 }
     42 
     43 ::android::binder::Status H2BCameraServiceListener::onTorchStatusChanged(
     44     int32_t, const ::android::String16&) {
     45   // We don't implement onTorchStatusChanged
     46   return binder::Status::ok();
     47 }
     48 
     49 } // implementation
     50 } // V2_0
     51 } // common
     52 } // cameraservice
     53 } // frameworks
     54 } // android
     55