uwb(hal): Refactor HAL to support multiple UWB chips

Changes:
1. Move existing IUwb interface to IUwbChip.
2. Rename |write| to |sendUciMessage|

Bug: 197638976
Test: Compiles
Change-Id: Ie152bf54029fdf4584b45ad81a5fdb8ae09b41d4
This commit is contained in:
Roshan Pius
2021-08-24 09:31:16 -07:00
parent 5cdf1b444c
commit a040b1f5a7
5 changed files with 127 additions and 36 deletions

View File

@@ -36,8 +36,6 @@
package android.hardware.uwb;
@VintfStability
interface IUwb {
void close();
void coreInit();
void open(in android.hardware.uwb.IUwbClientCallback clientCallback);
int write(in byte[] data);
List<String> getChips();
android.hardware.uwb.IUwbChip getChip(String name);
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Copyright 2021 NXP.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.uwb;
@VintfStability
interface IUwbChip {
String getName();
void open(in android.hardware.uwb.IUwbClientCallback clientCallback);
void close();
void coreInit();
int getSupportedVendorUciVersion();
int sendUciMessage(in byte[] data);
}

View File

@@ -18,8 +18,7 @@
package android.hardware.uwb;
import android.hardware.uwb.IUwbClientCallback;
import android.hardware.uwb.UwbStatus;
import android.hardware.uwb.IUwbChip;
/**
* HAL Interface for UWB (Ultrawideband) subsystem.
@@ -28,38 +27,14 @@ import android.hardware.uwb.UwbStatus;
@VintfStability
interface IUwb {
/**
* Close the UWB Subsystem. Should free all resources.
*
* Returns list of IUwbChip instance names representing each UWB chip on the device.
*/
void close();
List<String> getChips();
/**
* Perform UWB Subsystem initialization by applying all vendor configuration.
* Returns IUwbChip instance corresponding to the name.
*
* @param Unique identifier of the chip.
*/
void coreInit();
/**
* Performs the UWB HAL initialization and power on UWB Subsystem. If open completes
* successfully, then UWB Subsystem is ready to accept UCI message through write() API
*
* @param clientCallback Client callback instance.
*/
void open(in IUwbClientCallback clientCallback);
/**
* Write the UCI message to the UWB Subsystem.
* The UCI message format is as per UCI protocol and it is
* defined in "FiRa Consortium - UCI Generic Specification_v1.0" specification at FiRa
* consortium.
* WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
* TODO(b/196004116): Link to the published specification.
*
* This method may queue writes and return immediately, or it may block until data is written.
* Implementation must guarantee that writes are executed in order.
*
* @param data UCI packet to write.
* @return number of bytes written to the UWB Subsystem
*/
int write(in byte[] data);
IUwbChip getChip(String name);
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Copyright 2021 NXP.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.uwb;
import android.hardware.uwb.IUwbClientCallback;
import android.hardware.uwb.UwbStatus;
/**
* Controls a UWB chip on the device. On some devices, there could be multiple UWB chips.
*/
@VintfStability
interface IUwbChip {
/**
* Get unique idenitifer for the chip.
*/
String getName();
/**
* Performs the UWB HAL initialization and power on UWB Subsystem. If open completes
* successfully, then UWB Subsystem is ready to accept UCI message through write() API
*
* @param clientCallback Client callback instance.
*/
void open(in IUwbClientCallback clientCallback);
/**
* Close the UWB Subsystem. Should free all resources.
*/
void close();
/**
* Perform UWB Subsystem initialization by applying all vendor configuration.
*/
void coreInit();
/**
* Supported version of vendor UCI specification.
*/
int getSupportedVendorUciVersion();
/**
* Write the UCI message to the UWB Subsystem.
* The UCI message format is as per UCI protocol and it is
* defined in "FiRa Consortium - UCI Generic Specification_v1.0" specification at FiRa
* consortium.
* WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
* TODO(b/196004116): Link to the published specification.
*
* This method may queue writes and return immediately, or it may block until data is written.
* Implementation must guarantee that writes are executed in order.
*
* @param data UCI packet to write.
* @return number of bytes written to the UWB Subsystem
*/
int sendUciMessage(in byte[] data);
}

View File

@@ -25,7 +25,8 @@ import android.hardware.uwb.UwbStatus;
oneway interface IUwbClientCallback {
/**
* The callback passed in from the UWB stack that the HAL
* can use to pass incomming data to the stack.
* can use to pass incoming data to the stack. These include UCI
* responses and notifications from the UWB subsystem.
*
* WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
* TODO(b/196004116): Link to the published specification.