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 #pragma once 17 18 #include <android/hardware/contexthub/1.0/IContexthubCallback.h> 19 #include <log/log.h> 20 21 #include <cinttypes> 22 23 namespace android { 24 namespace hardware { 25 namespace contexthub { 26 namespace vts_utils { 27 28 // Base callback implementation that just logs all callbacks by default, but 29 // records a failure if 30 class ContexthubCallbackBase : public V1_0::IContexthubCallback { 31 public: handleClientMsg(const V1_0::ContextHubMsg &)32 virtual Return<void> handleClientMsg(const V1_0::ContextHubMsg& /*msg*/) override { 33 ALOGD("Got client message callback"); 34 return Void(); 35 } 36 handleTxnResult(uint32_t txnId,V1_0::TransactionResult result)37 virtual Return<void> handleTxnResult(uint32_t txnId, V1_0::TransactionResult result) override { 38 ALOGD("Got transaction result callback for txnId %" PRIu32 " with result %" PRId32, txnId, 39 result); 40 return Void(); 41 } 42 handleHubEvent(V1_0::AsyncEventType evt)43 virtual Return<void> handleHubEvent(V1_0::AsyncEventType evt) override { 44 ALOGD("Got hub event callback for event type %" PRIu32, evt); 45 return Void(); 46 } 47 handleAppAbort(uint64_t appId,uint32_t abortCode)48 virtual Return<void> handleAppAbort(uint64_t appId, uint32_t abortCode) override { 49 ALOGD("Got app abort notification for appId 0x%" PRIx64 " with abort code 0x%" PRIx32, 50 appId, abortCode); 51 return Void(); 52 } 53 handleAppsInfo(const hidl_vec<V1_0::HubAppInfo> &)54 virtual Return<void> handleAppsInfo(const hidl_vec<V1_0::HubAppInfo>& /*appInfo*/) override { 55 ALOGD("Got app info callback"); 56 return Void(); 57 } 58 }; 59 60 } // namespace vts_utils 61 } // namespace contexthub 62 } // namespace hardware 63 } // namespace android 64