blob: 124a11601a873c7d4303cdb761b55b8921c87be2 [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
30class ContexthubCallbackBase : public V1_0::IContexthubCallback {
31 public:
32 virtual Return<void> handleClientMsg(const V1_0::ContextHubMsg& /*msg*/) override {
33 ALOGD("Got client message callback");
34 return Void();
35 }
36
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
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
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
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