blob: 6ed89f3b2216967e781cd5c3a3f644dfbb7fd95e [file] [log] [blame]
Tomasz Wasilczyka27d4e42019-06-07 15:21:02 -07001/*
2 * Copyright (C) 2019 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 */
16package android.hardware.automotive.can@1.0;
17
18import ICanMessageListener;
19import ICloseHandle;
20
21/**
22 * Represents a CAN bus interface that's up and configured.
23 *
24 * Configuration part is done in ICanController.
25 */
26interface ICanBus {
27 /**
28 * Send CAN message.
29 *
30 * @param message CAN message to send out
31 * @return result OK in the case of success
32 * PAYLOAD_TOO_LONG if the payload is too long
33 * INTERFACE_DOWN if the bus is down
34 * TRANSMISSION_FAILURE in case of transmission failure
35 */
36 send(CanMessage message) generates (Result result);
37
38 /**
39 * Requests HAL implementation to listen for specific CAN messages.
40 *
41 * HAL is responsible for maintaining listener set and sending out messages
42 * to each listener that matches given filter against received message.
43 *
44 * Empty filter list means no filtering. If two or more listeners requested
45 * different filters, HAL server must merge these to fulfill the superset of
46 * these filters. HAL must not send out a message to a listener which filter
47 * doesn't match given message id.
48 *
49 * If filtering is not supported at the hardware level (what's strongly
50 * recommended), it must be covered in the HAL.
51 *
52 * @param filter The set of requested filters
53 * @param listener The interface to receive the messages on
54 * @return result OK in the case of success
55 * INTERFACE_DOWN if the bus is down
56 * @return close A handle to call in order to remove the listener
57 */
58 listen(vec<CanMessageFilter> filter, ICanMessageListener listener)
59 generates (Result result, ICloseHandle close);
60};