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