1 /*
2  * Copyright (c) 2021, 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 
17 #ifndef CPP_TELEMETRY_CARTELEMETRYD_SRC_CARTELEMETRYIMPL_H_
18 #define CPP_TELEMETRY_CARTELEMETRYD_SRC_CARTELEMETRYIMPL_H_
19 
20 #include "TelemetryServer.h"
21 
22 #include <aidl/android/frameworks/automotive/telemetry/BnCarTelemetry.h>
23 #include <aidl/android/frameworks/automotive/telemetry/CallbackConfig.h>
24 #include <aidl/android/frameworks/automotive/telemetry/CarData.h>
25 #include <utils/String16.h>
26 #include <utils/Vector.h>
27 
28 #include <vector>
29 
30 namespace android {
31 namespace automotive {
32 namespace telemetry {
33 
34 using ::aidl::android::frameworks::automotive::telemetry::CallbackConfig;
35 using ::aidl::android::frameworks::automotive::telemetry::CarData;
36 using ::aidl::android::frameworks::automotive::telemetry::ICarTelemetryCallback;
37 
38 // Implementation of android.frameworks.automotive.telemetry.ICarTelemetry.
39 class CarTelemetryImpl : public aidl::android::frameworks::automotive::telemetry::BnCarTelemetry {
40 public:
41     // Doesn't own `server`.
42     explicit CarTelemetryImpl(TelemetryServer* server);
43 
44     ndk::ScopedAStatus write(const std::vector<CarData>& dataList) override;
45 
46     ndk::ScopedAStatus addCallback(const CallbackConfig& config,
47                                    const std::shared_ptr<ICarTelemetryCallback>& callback) override;
48 
49     ndk::ScopedAStatus removeCallback(
50             const std::shared_ptr<ICarTelemetryCallback>& callback) override;
51 
52 private:
53     TelemetryServer* mTelemetryServer;  // not owned
54 };
55 
56 }  // namespace telemetry
57 }  // namespace automotive
58 }  // namespace android
59 
60 #endif  // CPP_TELEMETRY_CARTELEMETRYD_SRC_CARTELEMETRYIMPL_H_
61