1 /* 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 */ 16 17 package com.android.car.trust; 18 19 import android.annotation.NonNull; 20 21 import java.util.UUID; 22 23 /** 24 * The callback that will be notified of various actions that occur in a {@link BleMessageStream}. 25 */ 26 interface BleMessageStreamCallback { 27 /** 28 * Called if an error was encountered during a processing of a client message. 29 * 30 * @param uuid The {@link UUID} of the characteristic that the client message was retrieved 31 * from. 32 */ onMessageReceivedError(@onNull UUID uuid)33 void onMessageReceivedError(@NonNull UUID uuid); 34 35 /** 36 * Called when a complete message is received from the client. 37 * 38 * @param message The complete message. 39 * @param uuid The {@link UUID} of the characteristic that the client message was retrieved 40 * from. 41 */ onMessageReceived(@onNull byte[] message, UUID uuid)42 void onMessageReceived(@NonNull byte[] message, UUID uuid); 43 44 /** 45 * Called if there was an error during a write of a message to the stream. 46 */ onWriteMessageError()47 void onWriteMessageError(); 48 } 49