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 
17 #pragma once
18 
19 #include <android/hardware/automotive/can/1.0/ICanBus.h>
20 #include <android/hardware/automotive/can/1.0/ICanController.h>
21 
22 namespace android::hardware::automotive::can::libcanhaltools {
23 
24 /**
25  * Fetch the list of registered can controller services.
26  *
27  * \return list of service names identifying the registered can controllers.
28  */
29 hidl_vec<hidl_string> getControlServices();
30 
31 /**
32  * Determine if an can controller supports a specific interface type.
33  *
34  * \param ctrl a pointer to a can controller instance to check for interface support.
35  * \param iftype the interface type we wish to check if ctrl supports.
36  * \return true if iftype is supported by ctrl, false if not supported.
37  */
38 bool isSupported(sp<V1_0::ICanController> ctrl, V1_0::ICanController::InterfaceType iftype);
39 
40 /**
41  * Configures a CAN interface through the CAN HAL and brings it up.
42  *
43  * \param can_config this holds the parameters for configuring a CAN bus.
44  * \return status passed back from the CAN HAL, should be OK on success.
45  */
46 V1_0::ICanController::Result configureIface(V1_0::ICanController::BusConfig can_config);
47 
48 }  // namespace android::hardware::automotive::can::libcanhaltools
49