| /* |
| * Copyright (C) 2020 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package com.google.android.connecteddevice.api; |
| |
| import android.os.ParcelUuid; |
| |
| import com.google.android.connecteddevice.api.IConnectionCallback; |
| import com.google.android.connecteddevice.api.IDeviceAssociationCallback; |
| import com.google.android.connecteddevice.api.IDeviceCallback; |
| import com.google.android.connecteddevice.api.IOnLogRequestedListener; |
| import com.google.android.connecteddevice.model.ConnectedDevice; |
| import com.google.android.connecteddevice.model.DeviceMessage; |
| |
| /** Manager of devices connected to the car. */ |
| interface IConnectedDeviceManager { |
| |
| /** Returns {@link List<ConnectedDevice>} of devices currently connected. */ |
| List<ConnectedDevice> getActiveUserConnectedDevices(); |
| |
| /** |
| * Register a callback for manager triggered connection events for only the currently active |
| * user's devices. |
| * |
| * @param callback {@link IConnectionCallback} to register. |
| */ |
| void registerActiveUserConnectionCallback(in IConnectionCallback callback); |
| |
| /** |
| * Unregister a connection callback from manager. |
| * |
| * @param callback {@link IConnectionCallback} to unregister. |
| */ |
| void unregisterConnectionCallback(in IConnectionCallback callback); |
| |
| /** |
| * Register a callback for a specific connectedDevice and recipient. |
| * |
| * @param connectedDevice {@link ConnectedDevice} to register triggers on. |
| * @param recipientId {@link ParcelUuid} to register as recipient of. |
| * @param callback {@link IDeviceCallback} to register. |
| */ |
| void registerDeviceCallback(in ConnectedDevice connectedDevice, in ParcelUuid recipientId, |
| in IDeviceCallback callback); |
| |
| /** |
| * Unregister callback from connectedDevice events. |
| * |
| * @param connectedDevice {@link ConnectedDevice} callback was registered on. |
| * @param recipientId {@link ParcelUuid} callback was registered under. |
| * @param callback {@link IDeviceCallback} to unregister. |
| */ |
| void unregisterDeviceCallback(in ConnectedDevice connectedDevice, in ParcelUuid recipientId, |
| in IDeviceCallback callback); |
| |
| /** |
| * Send a message to a connected device. |
| * |
| * @param connectedDevice {@link ConnectedDevice} to send the message to. |
| * @param message Message to send. |
| */ |
| boolean sendMessage(in ConnectedDevice connectedDevice, in DeviceMessage message); |
| |
| |
| /** |
| * Register a callback for associated devic erelated events. |
| * |
| * @param callback {@link IDeviceAssociationCallback} to register. |
| */ |
| void registerDeviceAssociationCallback(in IDeviceAssociationCallback callback); |
| |
| /** |
| * Unregister a device association callback from manager. |
| * |
| * @param callback {@link IDeviceAssociationCallback} to unregister. |
| */ |
| void unregisterDeviceAssociationCallback(in IDeviceAssociationCallback callback); |
| |
| /** |
| * Register listener for the log request with the given logger identifier. |
| * |
| * @param listener {@link IOnLogRequestedListener} to register. |
| */ |
| void registerOnLogRequestedListener(in int loggerId, in IOnLogRequestedListener listener); |
| |
| /** |
| * Unregister listener from the log request. |
| * |
| * @param listener {@link IOnLogRequestedListener} to unregister. |
| */ |
| void unregisterOnLogRequestedListener(in int loggerId, in IOnLogRequestedListener listener); |
| |
| /** |
| * Process log records in the logger with given id so it can be combined with log records |
| * from other loggers. |
| * |
| * @param loggerId of the logger. |
| * @param logRecords to process. |
| */ |
| void processLogRecords(in int loggerId, in byte[] logRecords); |
| } |