blob: 24d6c52705457e99bdb781d2230313df9721ff86 [file] [log] [blame]
Brian Duddie01eb01a2020-02-14 15:35:57 -08001/*
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
23namespace android {
24namespace hardware {
25namespace contexthub {
26namespace vts_utils {
27
28// Base callback implementation that just logs all callbacks by default, but
29// records a failure if
Anthony Stangea2c3db12020-12-16 15:04:02 -050030template <class CallbackType>
31class ContexthubCallbackBase : public CallbackType {
Brian Duddie01eb01a2020-02-14 15:35:57 -080032 public:
33 virtual Return<void> handleClientMsg(const V1_0::ContextHubMsg& /*msg*/) override {
34 ALOGD("Got client message callback");
35 return Void();
36 }
37
38 virtual Return<void> handleTxnResult(uint32_t txnId, V1_0::TransactionResult result) override {
39 ALOGD("Got transaction result callback for txnId %" PRIu32 " with result %" PRId32, txnId,
40 result);
41 return Void();
42 }
43
44 virtual Return<void> handleHubEvent(V1_0::AsyncEventType evt) override {
45 ALOGD("Got hub event callback for event type %" PRIu32, evt);
46 return Void();
47 }
48
49 virtual Return<void> handleAppAbort(uint64_t appId, uint32_t abortCode) override {
50 ALOGD("Got app abort notification for appId 0x%" PRIx64 " with abort code 0x%" PRIx32,
51 appId, abortCode);
52 return Void();
53 }
54
55 virtual Return<void> handleAppsInfo(const hidl_vec<V1_0::HubAppInfo>& /*appInfo*/) override {
56 ALOGD("Got app info callback");
57 return Void();
58 }
59};
60
61} // namespace vts_utils
62} // namespace contexthub
63} // namespace hardware
64} // namespace android