1 /* 2 * Copyright (C) 2020 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 #include "Contexthub.h" 17 18 #include <vector> 19 20 namespace android { 21 namespace hardware { 22 namespace contexthub { 23 namespace V1_1 { 24 namespace implementation { 25 26 using ::android::hardware::contexthub::V1_0::Result; 27 onSettingChanged(Setting,SettingValue)28Return<void> Contexthub::onSettingChanged(Setting /*setting*/, SettingValue /*newValue*/) { 29 return Void(); 30 } 31 registerCallback(uint32_t hubId,const sp<IContexthubCallback> & cb)32Return<Result> Contexthub::registerCallback(uint32_t hubId, const sp<IContexthubCallback>& cb) { 33 if (hubId == kMockHubId) { 34 mCallback = cb; 35 return Result::OK; 36 } 37 return Result::BAD_PARAMS; 38 } 39 queryApps(uint32_t hubId)40Return<Result> Contexthub::queryApps(uint32_t hubId) { 41 if (hubId == kMockHubId && mCallback != nullptr) { 42 std::vector<HubAppInfo> nanoapps; 43 mCallback->handleAppsInfo(nanoapps); 44 return Result::OK; 45 } 46 return Result::BAD_PARAMS; 47 } 48 49 } // namespace implementation 50 } // namespace V1_1 51 } // namespace contexthub 52 } // namespace hardware 53 } // namespace android 54