1 /* 2 * Copyright (C) 2021 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 package com.android.server.uwb.jni; 17 18 import com.android.server.uwb.data.UwbMulticastListUpdateStatus; 19 import com.android.server.uwb.data.UwbRadarData; 20 import com.android.server.uwb.data.UwbRangingData; 21 import com.android.server.uwb.rftest.RfNotificationEvent; 22 23 public interface INativeUwbManager { 24 /** 25 * Notifies transaction 26 */ 27 interface SessionNotification { 28 /** 29 * Interface for receiving Ranging Data Notification 30 * 31 * @param rangingData : refer to UCI GENERIC SPECIFICATION Table 22:Ranging Data 32 * Notification 33 */ onRangeDataNotificationReceived(UwbRangingData rangingData)34 void onRangeDataNotificationReceived(UwbRangingData rangingData); 35 36 /** 37 * Interface for receiving Session Status Notification 38 * 39 * @param id : Session ID 40 * @param token : Session Token 41 * @param state : Session State 42 * @param reasonCode : Reason Code - UCI GENERIC SPECIFICATION Table 15 : state change with 43 * reason codes 44 */ onSessionStatusNotificationReceived(long id, int token, int state, int reasonCode)45 void onSessionStatusNotificationReceived(long id, int token, int state, int reasonCode); 46 47 /** 48 * Interface for receiving Multicast List Update Data 49 * 50 * @param multicastListUpdateData : refer to SESSION_UPDATE_CONTROLLER_MULTICAST_LIST_NTF 51 */ onMulticastListUpdateNotificationReceived( UwbMulticastListUpdateStatus multicastListUpdateData)52 void onMulticastListUpdateNotificationReceived( 53 UwbMulticastListUpdateStatus multicastListUpdateData); 54 55 /** 56 * Interface for receiving data from remote device 57 * 58 * @param sessionID : Session ID 59 * @param status : Status 60 * @param sequenceNum : Sequence Number 61 * @param address : Address of remote address 62 * @param data : Data received from remote address 63 */ 64 // TODO(b/261762781): Change the type of sessionID & sequenceNum parameters to int (to match 65 // their 4-octet size in the UCI spec). onDataReceived( long sessionID, int status, long sequenceNum, byte[] address, byte[] data)66 void onDataReceived( 67 long sessionID, int status, long sequenceNum, byte[] address, byte[] data); 68 69 /** 70 * Interface for receiving the data transfer status, corresponding to a Data packet 71 * earlier sent from the host to UWBS. 72 * 73 * @param sessionId : Session ID 74 * @param dataTransferStatus : Status codes in the DATA_TRANSFER_STATUS_NTF packet 75 * @param sequenceNum : Sequence Number 76 * @param txCount : Transmission count 77 */ onDataSendStatus(long sessionId, int dataTransferStatus, long sequenceNum, int txCount)78 void onDataSendStatus(long sessionId, int dataTransferStatus, long sequenceNum, 79 int txCount); 80 81 /** 82 * Interface for receiving Radar Data Message 83 * 84 * @param radarData : refer to Android UWB Radar UCI Specification: radar Data Message 85 */ onRadarDataMessageReceived(UwbRadarData radarData)86 void onRadarDataMessageReceived(UwbRadarData radarData); 87 88 /** 89 * Interface for receiving the data transfer phase config notification 90 * 91 * @param sessionId : Session ID 92 * @param dataTransferPhaseConfigStatus : DATA_TRANSFER_PHASE_CONFIG_STATUS_NTF status code 93 */ onDataTransferPhaseConfigNotificationReceived(long sessionId, int dataTransferPhaseConfigStatus)94 void onDataTransferPhaseConfigNotificationReceived(long sessionId, 95 int dataTransferPhaseConfigStatus); 96 97 /** 98 * Interface for receiving RF test notification events 99 * 100 * @param rfNotificationEvent : Protocol specific notification params 101 */ onRfTestNotificationReceived(RfNotificationEvent rfNotificationEvent)102 void onRfTestNotificationReceived(RfNotificationEvent rfNotificationEvent); 103 } 104 105 interface DeviceNotification { 106 /** 107 * Interface for receiving Device Status Notification 108 * 109 * @param state : refer to UCI GENERIC SPECIFICATION Table 9: Device Status Notification 110 * @param chipId : identifier of UWB chip for multi-HAL devices 111 */ onDeviceStatusNotificationReceived(int state, String chipId)112 void onDeviceStatusNotificationReceived(int state, String chipId); 113 114 /** 115 * Interface for receiving Control Message for Generic Error 116 * 117 * @param status : refer to UCI GENERIC SPECIFICATION Table 12: Control Message for Generic 118 * Error 119 * @param chipId : identifier of UWB chip for multi-HAL devices 120 */ onCoreGenericErrorNotificationReceived(int status, String chipId)121 void onCoreGenericErrorNotificationReceived(int status, String chipId); 122 } 123 124 interface VendorNotification { 125 /** 126 * Interface for receiving Vendor UCI notifications. 127 */ onVendorUciNotificationReceived(int gid, int oid, byte[] payload)128 void onVendorUciNotificationReceived(int gid, int oid, byte[] payload); 129 } 130 } 131