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