1 /* 2 * Copyright 2024 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 android.hardware.contexthub; 18 19 import android.hardware.contexthub.HubEndpointInfo; 20 import android.hardware.contexthub.HubMessage; 21 import android.hardware.contexthub.HubServiceInfo; 22 23 /** 24 * @hide 25 */ 26 oneway interface IContextHubEndpointCallback { 27 /** 28 * Request from system service to open a session, requested by a specific initiator. 29 * 30 * @param sessionId An integer identifying the session, assigned by the initiator 31 * @param initiator HubEndpointInfo representing the requester 32 * @param serviceDescriptor Nullable string representing the service associated with this session 33 */ onSessionOpenRequest(int sessionId, in HubEndpointInfo initiator, in @nullable String serviceDescriptor)34 void onSessionOpenRequest(int sessionId, in HubEndpointInfo initiator, in @nullable String serviceDescriptor); 35 36 /** 37 * Request from system service to close a specific session 38 * 39 * @param sessionId An integer identifying the session 40 * @param reason An integer identifying the reason 41 */ onSessionClosed(int sessionId, int reason)42 void onSessionClosed(int sessionId, int reason); 43 44 /** 45 * Notifies the system service that the session requested by IContextHubEndpoint.openSession 46 * is ready to use. 47 * 48 * @param sessionId The integer representing the communication session, previously set in 49 * IContextHubEndpoint.openSession(). This id is assigned by the HAL. 50 */ onSessionOpenComplete(int sessionId)51 void onSessionOpenComplete(int sessionId); 52 53 /** 54 * Message notification from system service for a specific session 55 56 * @param sessionId The integer representing the communication session, previously set in 57 * IContextHubEndpoint.openSession(). This id is assigned by the HAL. 58 * @param message The HubMessage parcelable that represents the message. 59 */ onMessageReceived(int sessionId, in HubMessage message)60 void onMessageReceived(int sessionId, in HubMessage message); 61 } 62