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 android.annotation.NonNull; 19 import android.annotation.Nullable; 20 import android.util.Log; 21 22 import com.android.internal.annotations.Keep; 23 import com.android.server.uwb.UciLogModeStore; 24 import com.android.server.uwb.UwbInjector; 25 import com.android.server.uwb.data.DtTagUpdateRangingRoundsStatus; 26 import com.android.server.uwb.data.UwbConfigStatusData; 27 import com.android.server.uwb.data.UwbDeviceInfoResponse; 28 import com.android.server.uwb.data.UwbMulticastListUpdateStatus; 29 import com.android.server.uwb.data.UwbRadarData; 30 import com.android.server.uwb.data.UwbRangingData; 31 import com.android.server.uwb.data.UwbTlvData; 32 import com.android.server.uwb.data.UwbUciConstants; 33 import com.android.server.uwb.data.UwbVendorUciResponse; 34 import com.android.server.uwb.info.UwbPowerStats; 35 import com.android.server.uwb.multchip.UwbMultichipData; 36 37 import java.util.Arrays; 38 import java.util.HashMap; 39 import java.util.Map; 40 41 @Keep 42 public class NativeUwbManager { 43 private static final String TAG = NativeUwbManager.class.getSimpleName(); 44 45 public final Object mNativeLock = new Object(); 46 private final UwbInjector mUwbInjector; 47 private final UciLogModeStore mUciLogModeStore; 48 private final UwbMultichipData mUwbMultichipData; 49 protected INativeUwbManager.DeviceNotification mDeviceListener; 50 protected INativeUwbManager.SessionNotification mSessionListener; 51 private long mDispatcherPointer; 52 protected INativeUwbManager.VendorNotification mVendorListener; 53 NativeUwbManager(@onNull UwbInjector uwbInjector, UciLogModeStore uciLogModeStore, UwbMultichipData uwbMultichipData)54 public NativeUwbManager(@NonNull UwbInjector uwbInjector, UciLogModeStore uciLogModeStore, 55 UwbMultichipData uwbMultichipData) { 56 mUwbInjector = uwbInjector; 57 mUciLogModeStore = uciLogModeStore; 58 mUwbMultichipData = uwbMultichipData; 59 loadLibrary(); 60 } 61 loadLibrary()62 protected void loadLibrary() { 63 System.loadLibrary("uwb_uci_jni_rust"); 64 synchronized (mNativeLock) { 65 nativeInit(); 66 } 67 } 68 setDeviceListener(INativeUwbManager.DeviceNotification deviceListener)69 public void setDeviceListener(INativeUwbManager.DeviceNotification deviceListener) { 70 mDeviceListener = deviceListener; 71 } 72 setSessionListener(INativeUwbManager.SessionNotification sessionListener)73 public void setSessionListener(INativeUwbManager.SessionNotification sessionListener) { 74 mSessionListener = sessionListener; 75 } 76 setVendorListener(INativeUwbManager.VendorNotification vendorListener)77 public void setVendorListener(INativeUwbManager.VendorNotification vendorListener) { 78 mVendorListener = vendorListener; 79 } 80 81 /** 82 * Device status callback invoked via the JNI 83 */ onDeviceStatusNotificationReceived(int deviceState, String chipId)84 public void onDeviceStatusNotificationReceived(int deviceState, String chipId) { 85 Log.d(TAG, "onDeviceStatusNotificationReceived(" + deviceState + ", " + chipId + ")"); 86 mDeviceListener.onDeviceStatusNotificationReceived(deviceState, chipId); 87 } 88 89 /** 90 * Error callback invoked via the JNI 91 */ onCoreGenericErrorNotificationReceived(int status, String chipId)92 public void onCoreGenericErrorNotificationReceived(int status, String chipId) { 93 Log.d(TAG, "onCoreGenericErrorNotificationReceived(" + status + ", " + chipId + ")"); 94 mDeviceListener.onCoreGenericErrorNotificationReceived(status, chipId); 95 } 96 onSessionStatusNotificationReceived(long id, int token, int state, int reasonCode)97 public void onSessionStatusNotificationReceived(long id, int token, int state, int reasonCode) { 98 Log.d(TAG, "onSessionStatusNotificationReceived(" + id + ", " + token + ", " 99 + state + ", " + reasonCode + ")"); 100 mSessionListener.onSessionStatusNotificationReceived(id, token, state, reasonCode); 101 } 102 onRangeDataNotificationReceived(UwbRangingData rangeData)103 public void onRangeDataNotificationReceived(UwbRangingData rangeData) { 104 Log.d(TAG, "onRangeDataNotificationReceived : " + rangeData); 105 mSessionListener.onRangeDataNotificationReceived(rangeData); 106 } 107 onMulticastListUpdateNotificationReceived( UwbMulticastListUpdateStatus multicastListUpdateData)108 public void onMulticastListUpdateNotificationReceived( 109 UwbMulticastListUpdateStatus multicastListUpdateData) { 110 Log.d(TAG, "onMulticastListUpdateNotificationReceived : " + multicastListUpdateData); 111 mSessionListener.onMulticastListUpdateNotificationReceived(multicastListUpdateData); 112 } 113 114 /** 115 * Radar data message callback invoked via the JNI 116 */ onRadarDataMessageReceived(UwbRadarData radarData)117 public void onRadarDataMessageReceived(UwbRadarData radarData) { 118 Log.d(TAG, "onRadarDataMessageReceived : " + radarData); 119 mSessionListener.onRadarDataMessageReceived(radarData); 120 } 121 122 /** 123 * Vendor callback invoked via the JNI 124 */ onVendorUciNotificationReceived(int gid, int oid, byte[] payload)125 public void onVendorUciNotificationReceived(int gid, int oid, byte[] payload) { 126 Log.d(TAG, "onVendorUciNotificationReceived: " + gid + ", " + oid + ", " 127 + Arrays.toString(payload)); 128 mVendorListener.onVendorUciNotificationReceived(gid, oid, payload); 129 } 130 131 /** 132 * Enable UWB hardware. 133 * 134 * @return : {@code Map<String,UwbDeviceInfoResponse>}, error is indicated by it being null. 135 * The key for the map is the ChipId (string). 136 */ 137 @Nullable doInitialize()138 public Map<String, UwbDeviceInfoResponse> doInitialize() { 139 UwbDeviceInfoResponse deviceInfoResponse = null; 140 Map<String, UwbDeviceInfoResponse> chipIdToDeviceInfoResponseMap = new HashMap<>(); 141 synchronized (mNativeLock) { 142 mDispatcherPointer = nativeDispatcherNew(mUwbMultichipData.getChipIds().toArray()); 143 for (String chipId : mUwbMultichipData.getChipIds()) { 144 deviceInfoResponse = nativeDoInitialize(chipId); 145 if (deviceInfoResponse == null 146 || deviceInfoResponse.mStatusCode != UwbUciConstants.STATUS_CODE_OK) { 147 return null; 148 } 149 chipIdToDeviceInfoResponseMap.put(chipId, deviceInfoResponse); 150 } 151 nativeSetLogMode(mUciLogModeStore.getMode()); 152 } 153 return chipIdToDeviceInfoResponseMap; 154 } 155 156 /** 157 * Disable UWB hardware. 158 * 159 * @return : If this returns true, UWB is off 160 */ doDeinitialize()161 public boolean doDeinitialize() { 162 synchronized (mNativeLock) { 163 for (String chipId : mUwbMultichipData.getChipIds()) { 164 nativeDoDeinitialize(chipId); 165 } 166 167 nativeDispatcherDestroy(); 168 mDispatcherPointer = 0L; 169 } 170 return true; 171 } 172 173 /** 174 * Gets the timestamp resolution in nanosecond 175 * 176 * @return : timestamp resolution in nanosecond 177 */ getTimestampResolutionNanos()178 public long getTimestampResolutionNanos() { 179 return 0L; 180 /* TODO: Not Implemented in native stack 181 return nativeGetTimestampResolutionNanos(); */ 182 } 183 184 /** 185 * Retrieves power related stats 186 */ getPowerStats(String chipId)187 public UwbPowerStats getPowerStats(String chipId) { 188 synchronized (mNativeLock) { 189 return nativeGetPowerStats(chipId); 190 } 191 } 192 193 /** 194 * Creates the new UWB session with parameter session ID and type of the session. 195 * 196 * @param sessionId : Session ID is 4 Octets unique random number generated by application 197 * @param sessionType : Type of session 0x00: Ranging session 0x01: Data transfer 0x02-0x9F: RFU 198 * 0xA0-0xCF: Reserved for Vendor Specific use case 0xD0: Device Test Mode 199 * 0xD1-0xDF: RFU 0xE0-0xFF: Vendor Specific use 200 * @param chipId : Identifier of UWB chip for multi-HAL devices 201 * @return : {@link UwbUciConstants} Status code 202 */ initSession(int sessionId, byte sessionType, String chipId)203 public byte initSession(int sessionId, byte sessionType, String chipId) { 204 synchronized (mNativeLock) { 205 return nativeSessionInit(sessionId, sessionType, chipId); 206 } 207 } 208 209 /** 210 * De-initializes the session. 211 * 212 * @param sessionId : Session ID for which session to be de-initialized 213 * @param chipId : Identifier of UWB chip for multi-HAL devices 214 * @return : {@link UwbUciConstants} Status code 215 */ deInitSession(int sessionId, String chipId)216 public byte deInitSession(int sessionId, String chipId) { 217 synchronized (mNativeLock) { 218 return nativeSessionDeInit(sessionId, chipId); 219 } 220 } 221 222 /** 223 * reset the UWBs 224 * 225 * @param resetConfig : Reset config 226 * @param chipId : Identifier of UWB chip for multi-HAL devices 227 * @return : {@link UwbUciConstants} Status code 228 */ deviceReset(byte resetConfig, String chipId)229 public byte deviceReset(byte resetConfig, String chipId) { 230 synchronized (mNativeLock) { 231 return nativeDeviceReset(resetConfig, chipId); 232 } 233 } 234 235 /** 236 * Retrieves number of UWB sessions in the UWBS. 237 * 238 * @param chipId : Identifier of UWB chip for multi-HAL devices 239 * @return : Number of UWB sessions present in the UWBS. 240 */ getSessionCount(String chipId)241 public byte getSessionCount(String chipId) { 242 synchronized (mNativeLock) { 243 return nativeGetSessionCount(chipId); 244 } 245 } 246 247 /** 248 * Queries the current state of the UWB session. 249 * 250 * @param sessionId : Session of the UWB session for which current session state to be queried 251 * @param chipId : Identifier of UWB chip for multi-HAL devices 252 * @return : {@link UwbUciConstants} Session State 253 */ getSessionState(int sessionId, String chipId)254 public byte getSessionState(int sessionId, String chipId) { 255 synchronized (mNativeLock) { 256 return nativeGetSessionState(sessionId, chipId); 257 } 258 } 259 260 /** 261 * Starts a UWB session. 262 * 263 * @param sessionId : Session ID for which ranging shall start 264 * @param chipId : Identifier of UWB chip for multi-HAL devices 265 * @return : {@link UwbUciConstants} Status code 266 */ startRanging(int sessionId, String chipId)267 public byte startRanging(int sessionId, String chipId) { 268 synchronized (mNativeLock) { 269 return nativeRangingStart(sessionId, chipId); 270 } 271 } 272 273 /** 274 * Stops the ongoing UWB session. 275 * 276 * @param sessionId : Stop the requested ranging session. 277 * @param chipId : Identifier of UWB chip for multi-HAL devices 278 * @return : {@link UwbUciConstants} Status code 279 */ stopRanging(int sessionId, String chipId)280 public byte stopRanging(int sessionId, String chipId) { 281 synchronized (mNativeLock) { 282 return nativeRangingStop(sessionId, chipId); 283 } 284 } 285 286 /** 287 * Set APP Configuration Parameters for the requested UWB session 288 * 289 * @param noOfParams : The number (n) of APP Configuration Parameters 290 * @param appConfigParamLen : The length of APP Configuration Parameters 291 * @param appConfigParams : APP Configuration Parameter 292 * @param chipId : Identifier of UWB chip for multi-HAL devices 293 * @return : {@link UwbConfigStatusData} : Contains statuses for all cfg_id 294 */ setAppConfigurations(int sessionId, int noOfParams, int appConfigParamLen, byte[] appConfigParams, String chipId)295 public UwbConfigStatusData setAppConfigurations(int sessionId, int noOfParams, 296 int appConfigParamLen, byte[] appConfigParams, String chipId) { 297 synchronized (mNativeLock) { 298 return nativeSetAppConfigurations(sessionId, noOfParams, appConfigParamLen, 299 appConfigParams, chipId); 300 } 301 } 302 303 /** 304 * Set radar APP Configuration Parameters for the requested UWB radar session 305 * 306 * @param noOfParams : The number (n) of APP Configuration Parameters 307 * @param appConfigParamLen : The length of APP Configuration Parameters 308 * @param appConfigParams : APP Configuration Parameter 309 * @param chipId : Identifier of UWB chip for multi-HAL devices 310 * @return : {@link UwbConfigStatusData} : Contains statuses for all cfg_id 311 */ setRadarAppConfigurations(int sessionId, int noOfParams, int appConfigParamLen, byte[] appConfigParams, String chipId)312 public UwbConfigStatusData setRadarAppConfigurations(int sessionId, int noOfParams, 313 int appConfigParamLen, byte[] appConfigParams, String chipId) { 314 synchronized (mNativeLock) { 315 return nativeSetRadarAppConfigurations(sessionId, noOfParams, appConfigParamLen, 316 appConfigParams, chipId); 317 } 318 } 319 320 /** 321 * Get APP Configuration Parameters for the requested UWB session 322 * 323 * @param noOfParams : The number (n) of APP Configuration Parameters 324 * @param appConfigParamLen : The length of APP Configuration Parameters 325 * @param appConfigIds : APP Configuration Parameter 326 * @param chipId : Identifier of UWB chip for multi-HAL devices 327 * @return : {@link UwbTlvData} : All tlvs that are to be decoded 328 */ getAppConfigurations(int sessionId, int noOfParams, int appConfigParamLen, byte[] appConfigIds, String chipId)329 public UwbTlvData getAppConfigurations(int sessionId, int noOfParams, int appConfigParamLen, 330 byte[] appConfigIds, String chipId) { 331 synchronized (mNativeLock) { 332 return nativeGetAppConfigurations(sessionId, noOfParams, appConfigParamLen, 333 appConfigIds, chipId); 334 } 335 } 336 337 /** 338 * Get Core Capabilities information 339 * 340 * @param chipId : Identifier of UWB chip for multi-HAL devices 341 * @return : {@link UwbTlvData} : All tlvs that are to be decoded 342 */ getCapsInfo(String chipId)343 public UwbTlvData getCapsInfo(String chipId) { 344 synchronized (mNativeLock) { 345 return nativeGetCapsInfo(chipId); 346 } 347 } 348 349 /** 350 * Update Multicast list for the requested UWB session using V1 command. 351 * 352 * @param sessionId : Session ID to which multicast list to be updated 353 * @param action : Update the multicast list by adding or removing 354 * 0x00 - Adding 355 * 0x01 - removing 356 * 0x02 - Adding with 16 bits sub-session key 357 * 0x03 - Adding with 32 bits sub-session key 358 * @param noOfControlee : The number(n) of Controlees 359 * @param addresses : address list of Controlees 360 * @param subSessionIds : Specific sub-session ID list of Controlees 361 * @param subSessionKeyList : Sub-session key list of Controlees 362 * @return : refer to SESSION_SET_APP_CONFIG_RSP 363 * in the Table 16: Control messages to set Application configurations 364 */ controllerMulticastListUpdate(int sessionId, int action, int noOfControlee, byte[] addresses, int[] subSessionIds, byte[] subSessionKeyList, String chipId)365 public UwbMulticastListUpdateStatus controllerMulticastListUpdate(int sessionId, int action, 366 int noOfControlee, byte[] addresses, int[] subSessionIds, byte[] subSessionKeyList, 367 String chipId) { 368 synchronized (mNativeLock) { 369 return nativeControllerMulticastListUpdate(sessionId, (byte) action, 370 (byte) noOfControlee, addresses, subSessionIds, subSessionKeyList, chipId, 371 mUwbInjector.isMulticastListNtfV2Supported(), 372 mUwbInjector.isMulticastListRspV2Supported()); 373 } 374 } 375 376 /** 377 * Set country code. 378 * 379 * @param countryCode 2 char ISO country code 380 */ setCountryCode(byte[] countryCode)381 public byte setCountryCode(byte[] countryCode) { 382 Log.i(TAG, "setCountryCode: " + new String(countryCode)); 383 384 synchronized (mNativeLock) { 385 for (String chipId : mUwbMultichipData.getChipIds()) { 386 byte status = nativeSetCountryCode(countryCode, chipId); 387 if (status != UwbUciConstants.STATUS_CODE_OK) { 388 return status; 389 } 390 } 391 return UwbUciConstants.STATUS_CODE_OK; 392 } 393 } 394 395 /** 396 * Sets the log mode for the current and future UWB UCI messages. 397 * 398 * @param logModeStr is one of Disabled, Filtered, or Unfiltered (case insensitive). 399 * @return true if the log mode is set successfully, false otherwise. 400 */ setLogMode(String logModeStr)401 public boolean setLogMode(String logModeStr) { 402 synchronized (mNativeLock) { 403 return nativeSetLogMode(mUciLogModeStore.getMode()); 404 } 405 } 406 407 @NonNull sendRawVendorCmd(int mt, int gid, int oid, byte[] payload, String chipId)408 public UwbVendorUciResponse sendRawVendorCmd(int mt, int gid, int oid, byte[] payload, 409 String chipId) { 410 synchronized (mNativeLock) { 411 return nativeSendRawVendorCmd(mt, gid, oid, payload, chipId); 412 } 413 } 414 415 /** 416 * Receive payload data from a remote device in a UWB ranging session. 417 */ onDataReceived( long sessionID, int status, long sequenceNum, byte[] address, byte[] data)418 public void onDataReceived( 419 long sessionID, int status, long sequenceNum, byte[] address, byte[] data) { 420 Log.d(TAG, "onDataReceived "); 421 mSessionListener.onDataReceived(sessionID, status, sequenceNum, address, data); 422 } 423 424 /** 425 * Send payload data to a remote device in a UWB ranging session. 426 */ sendData( int sessionId, byte[] address, short sequenceNum, byte[] appData, String chipId)427 public byte sendData( 428 int sessionId, byte[] address, short sequenceNum, byte[] appData, String chipId) { 429 synchronized (mNativeLock) { 430 return nativeSendData(sessionId, address, sequenceNum, appData, chipId); 431 } 432 } 433 434 /** 435 * Receive the data transfer status for a UCI data packet earlier sent from Host to UWBS. 436 */ onDataSendStatus(long sessionId, int dataTransferStatus, long sequenceNum, int txCount)437 public void onDataSendStatus(long sessionId, int dataTransferStatus, long sequenceNum, 438 int txCount) { 439 Log.d(TAG, "onDataSendStatus "); 440 mSessionListener.onDataSendStatus(sessionId, dataTransferStatus, sequenceNum, txCount); 441 } 442 443 /** 444 * Set Data transfer phase configuration 445 */ setDataTransferPhaseConfig(int sessionId, byte dtpcmRepetition, byte dataTransferControl, byte dtpmlSize, byte[] macAddress, byte[] slotBitmap, String chipId)446 public byte setDataTransferPhaseConfig(int sessionId, byte dtpcmRepetition, 447 byte dataTransferControl, byte dtpmlSize, byte[] macAddress, byte[] slotBitmap, 448 String chipId) { 449 synchronized (mNativeLock) { 450 return nativeSessionDataTransferPhaseConfig(sessionId, dtpcmRepetition, 451 dataTransferControl, dtpmlSize, macAddress, slotBitmap, chipId); 452 } 453 } 454 455 /** 456 * Receive the data transfer phase config status 457 */ onDataTransferPhaseConfigNotificationReceived(long sessionId, int dataTransferPhaseConfigStatus)458 public void onDataTransferPhaseConfigNotificationReceived(long sessionId, 459 int dataTransferPhaseConfigStatus) { 460 Log.d(TAG, "onDataTransferPhaseConfigNotificationReceived "); 461 mSessionListener.onDataTransferPhaseConfigNotificationReceived(sessionId, 462 dataTransferPhaseConfigStatus); 463 } 464 465 /** 466 * Update Ranging Rounds for DT Tag 467 * 468 * @param sessionId Session ID to which ranging round to be updated 469 * @param noOfRangingRounds new active ranging round 470 * @param rangingRoundIndexes Indexes of ranging rounds 471 * @return refer to SESSION_SET_APP_CONFIG_RSP 472 * in the Table 16: Control messages to set Application configurations 473 */ sessionUpdateDtTagRangingRounds(int sessionId, int noOfRangingRounds, byte[] rangingRoundIndexes, String chipId)474 public DtTagUpdateRangingRoundsStatus sessionUpdateDtTagRangingRounds(int sessionId, 475 int noOfRangingRounds, byte[] rangingRoundIndexes, String chipId) { 476 synchronized (mNativeLock) { 477 return nativeSessionUpdateDtTagRangingRounds(sessionId, noOfRangingRounds, 478 rangingRoundIndexes, chipId); 479 } 480 } 481 482 /** 483 * Queries the max Application data size for the UWB session. 484 * 485 * @param sessionId : Session of the UWB session for which current max data size to be queried 486 * @param chipId : Identifier of UWB chip for multi-HAL devices 487 * @return : Max application data size that can be sent by UWBS. 488 */ queryMaxDataSizeBytes(int sessionId, String chipId)489 public int queryMaxDataSizeBytes(int sessionId, String chipId) { 490 synchronized (mNativeLock) { 491 return nativeQueryDataSize(sessionId, chipId); 492 } 493 } 494 495 /** 496 * query device timestamp 497 * 498 * @return : uwb device timestamp 499 */ queryUwbsTimestamp(String chipId)500 public long queryUwbsTimestamp(String chipId) { 501 synchronized (mNativeLock) { 502 return nativeQueryUwbTimestamp(chipId); 503 } 504 } 505 506 /** 507 * Get session token from session id. 508 * 509 * @param sessionId : session id of uwb session 510 * @param chipId : Identifier of UWB chip for multi-HAL devices 511 * @return : session token generated for the session. 512 */ getSessionToken(int sessionId, String chipId)513 public int getSessionToken(int sessionId, String chipId) { 514 synchronized (mNativeLock) { 515 return nativeGetSessionToken(sessionId, chipId); 516 } 517 } 518 519 /** 520 * Sets the Hybrid UWB Session Controller Configuration 521 * 522 * @param sessionId : Primary session ID 523 * @param numberOfPhases : Number of secondary sessions 524 * @param updateTime : Absolute time in UWBS Time domain 525 * @param phaseList : list of secondary sessions which have been previously initialized and 526 * configured 527 * @param chipId : Identifier of UWB chip for multi-HAL devices 528 * @return Byte representing the status of the operation 529 */ setHybridSessionControllerConfiguration(int sessionId, byte messageControl, int numberOfPhases, byte[] updateTime, byte[] phaseList, String chipId)530 public byte setHybridSessionControllerConfiguration(int sessionId, byte messageControl, 531 int numberOfPhases, byte[] updateTime, byte[] phaseList, String chipId) { 532 synchronized (mNativeLock) { 533 return nativeSetHybridSessionControllerConfigurations(sessionId, messageControl, 534 numberOfPhases, updateTime, phaseList, chipId); 535 } 536 } 537 538 /** 539 * Sets the Hybrid UWB Session Controlee Configuration 540 * 541 * @param sessionId : Primary session ID 542 * @param numberOfPhases : Number of secondary sessions 543 * @param phaseList : list of secondary sessions 544 * @param chipId : Identifier of UWB chip for multi-HAL devices 545 * @return Byte representing the status of the operation 546 */ setHybridSessionControleeConfiguration(int sessionId, int numberOfPhases, byte[] phaseList, String chipId)547 public byte setHybridSessionControleeConfiguration(int sessionId, int numberOfPhases, 548 byte[] phaseList, String chipId) { 549 synchronized (mNativeLock) { 550 return nativeSetHybridSessionControleeConfigurations(sessionId, numberOfPhases, 551 phaseList, chipId); 552 } 553 } 554 nativeSendData(int sessionId, byte[] address, short sequenceNum, byte[] appData, String chipId)555 private native byte nativeSendData(int sessionId, byte[] address, 556 short sequenceNum, byte[] appData, String chipId); 557 nativeSessionDataTransferPhaseConfig(int sessionId, byte dtpcmRepetition, byte dataTransferControl, byte dtpmlSize, byte[] macAddress, byte[] slotBitmap, String chipId)558 private native byte nativeSessionDataTransferPhaseConfig(int sessionId, byte dtpcmRepetition, 559 byte dataTransferControl, byte dtpmlSize, byte[] macAddress, byte[] slotBitmap, 560 String chipId); 561 nativeDispatcherNew(Object[] chipIds)562 private native long nativeDispatcherNew(Object[] chipIds); 563 nativeDispatcherDestroy()564 private native void nativeDispatcherDestroy(); 565 nativeInit()566 private native boolean nativeInit(); 567 nativeDoInitialize(String chipIds)568 private native UwbDeviceInfoResponse nativeDoInitialize(String chipIds); 569 nativeDoDeinitialize(String chipId)570 private native boolean nativeDoDeinitialize(String chipId); 571 nativeGetTimestampResolutionNanos()572 private native long nativeGetTimestampResolutionNanos(); 573 nativeGetPowerStats(String chipId)574 private native UwbPowerStats nativeGetPowerStats(String chipId); 575 nativeDeviceReset(byte resetConfig, String chipId)576 private native byte nativeDeviceReset(byte resetConfig, String chipId); 577 nativeSessionInit(int sessionId, byte sessionType, String chipId)578 private native byte nativeSessionInit(int sessionId, byte sessionType, String chipId); 579 nativeSessionDeInit(int sessionId, String chipId)580 private native byte nativeSessionDeInit(int sessionId, String chipId); 581 nativeGetSessionCount(String chipId)582 private native byte nativeGetSessionCount(String chipId); 583 nativeRangingStart(int sessionId, String chipId)584 private native byte nativeRangingStart(int sessionId, String chipId); 585 nativeRangingStop(int sessionId, String chipId)586 private native byte nativeRangingStop(int sessionId, String chipId); 587 nativeGetSessionState(int sessionId, String chipId)588 private native byte nativeGetSessionState(int sessionId, String chipId); 589 nativeSetAppConfigurations(int sessionId, int noOfParams, int appConfigParamLen, byte[] appConfigParams, String chipId)590 private native UwbConfigStatusData nativeSetAppConfigurations(int sessionId, int noOfParams, 591 int appConfigParamLen, byte[] appConfigParams, String chipId); 592 nativeGetAppConfigurations(int sessionId, int noOfParams, int appConfigParamLen, byte[] appConfigParams, String chipId)593 private native UwbTlvData nativeGetAppConfigurations(int sessionId, int noOfParams, 594 int appConfigParamLen, byte[] appConfigParams, String chipId); 595 nativeSetRadarAppConfigurations(int sessionId, int noOfParams, int appConfigParamLen, byte[] appConfigParams, String chipId)596 private native UwbConfigStatusData nativeSetRadarAppConfigurations(int sessionId, 597 int noOfParams, int appConfigParamLen, byte[] appConfigParams, String chipId); 598 nativeGetCapsInfo(String chipId)599 private native UwbTlvData nativeGetCapsInfo(String chipId); 600 nativeControllerMulticastListUpdate(int sessionId, byte action, byte noOfControlee, byte[] address, int[] subSessionId, byte[] subSessionKeyList, String chipId, boolean isMulticastListNtfV2Supported, boolean isMulticastListRspV2Supported)601 private native UwbMulticastListUpdateStatus nativeControllerMulticastListUpdate(int sessionId, 602 byte action, byte noOfControlee, byte[] address, int[] subSessionId, 603 byte[] subSessionKeyList, String chipId, boolean isMulticastListNtfV2Supported, 604 boolean isMulticastListRspV2Supported); 605 nativeSetCountryCode(byte[] countryCode, String chipId)606 private native byte nativeSetCountryCode(byte[] countryCode, String chipId); 607 nativeSetLogMode(String logMode)608 private native boolean nativeSetLogMode(String logMode); 609 nativeSendRawVendorCmd(int mt, int gid, int oid, byte[] payload, String chipId)610 private native UwbVendorUciResponse nativeSendRawVendorCmd(int mt, int gid, int oid, 611 byte[] payload, String chipId); 612 nativeSessionUpdateDtTagRangingRounds( int sessionId, int noOfActiveRangingRounds, byte[] rangingRoundIndexes, String chipId)613 private native DtTagUpdateRangingRoundsStatus nativeSessionUpdateDtTagRangingRounds( 614 int sessionId, int noOfActiveRangingRounds, byte[] rangingRoundIndexes, String chipId); 615 nativeQueryDataSize(int sessionId, String chipId)616 private native short nativeQueryDataSize(int sessionId, String chipId); 617 nativeQueryUwbTimestamp(String chipId)618 private native long nativeQueryUwbTimestamp(String chipId); 619 nativeGetSessionToken(int sessionId, String chipId)620 private native int nativeGetSessionToken(int sessionId, String chipId); 621 nativeSetHybridSessionControllerConfigurations(int sessionId, byte messageControl, int noOfPhases, byte[] updateTime, byte[] phaseList, String chipId)622 private native byte nativeSetHybridSessionControllerConfigurations(int sessionId, 623 byte messageControl, int noOfPhases, byte[] updateTime, byte[] phaseList, 624 String chipId); 625 nativeSetHybridSessionControleeConfigurations(int sessionId, int noOfPhases, byte[] phaseList, String chipId)626 private native byte nativeSetHybridSessionControleeConfigurations(int sessionId, 627 int noOfPhases, byte[] phaseList, String chipId); 628 } 629