1 /* 2 * Copyright (C) 2017 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 #define LOG_TAG "Lefty" 17 #include <utils/Log.h> 18 19 #include "Lefty.h" 20 21 namespace vendor { 22 namespace google_clockwork { 23 namespace lefty { 24 namespace V1_0 { 25 namespace implementation { 26 Lefty()27Lefty::Lefty() : mHubConnection(HubConnection::getInstance()) { 28 ALOGI("Created a Lefty interface instance"); 29 } 30 31 // Methods from ::vendor::google_clockwork::lefty::V1_0::ILefty follow. setLeftyMode(bool enabled)32Return<void> Lefty::setLeftyMode(bool enabled) { 33 if (mHubConnection->initCheck() == ::android::OK 34 && mHubConnection->getAliveCheck() == ::android::OK) { 35 mHubConnection->setLeftyMode(enabled); 36 } 37 return Void(); 38 } 39 40 HIDL_FETCH_ILefty(const char *)41ILefty* HIDL_FETCH_ILefty(const char* /* name */) { 42 return new Lefty(); 43 } 44 45 } // namespace implementation 46 } // namespace V1_0 47 } // namespace lefty 48 } // namespace google_clockwork 49 } // namespace vendor 50