Merge changes from topic "Bluetooth_Ranging" into main

* changes:
  Add default implementation for Channel Sounding
  Add HAL interface for Channel Sounding
This commit is contained in:
Chienyuan Huang 2023-12-11 03:43:57 +00:00 committed by Gerrit Code Review
commit 64930a6379
58 changed files with 2366 additions and 0 deletions

View file

@ -0,0 +1,39 @@
// Copyright (C) 2023 The Android Open Source Project
//
// 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
aidl_interface {
name: "android.hardware.bluetooth.ranging",
vendor_available: true,
host_supported: true,
srcs: ["android/hardware/bluetooth/ranging/*.aidl"],
stability: "vintf",
backend: {
ndk: {
apex_available: [
"//apex_available:platform",
"com.android.btservices",
],
min_sdk_version: "33",
},
},
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum AddressType {
PUBLIC = 0x00,
RANDOM = 0x01,
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable BluetoothChannelSoundingParameters {
android.hardware.bluetooth.ranging.SessionType sessionType;
int aclHandle;
int l2capCid;
int realTimeProcedureDataAttHandle;
android.hardware.bluetooth.ranging.Role role;
boolean localSupportsSoundingPhaseBasedRanging;
boolean remoteSupportsSoundingPhaseBaseRanging;
android.hardware.bluetooth.ranging.Config config;
android.hardware.bluetooth.ranging.DeviceAddress address;
@nullable android.hardware.bluetooth.ranging.VendorSpecificData[] vendorSpecificData;
android.hardware.bluetooth.ranging.LocationType locationType;
android.hardware.bluetooth.ranging.SightType sightType;
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable ChannelSoudingRawData {
int procedureCounter;
boolean aborted;
android.hardware.bluetooth.ranging.ChannelSoundingSingleSideData initiatorData;
android.hardware.bluetooth.ranging.ChannelSoundingSingleSideData reflectorData;
byte[] stepChannels;
@nullable int[] toaTodInitiator;
@nullable int[] todToaReflector;
android.hardware.bluetooth.ranging.ModeType[] stepMode;
byte numAntennaPaths;
long timestampMs;
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable ChannelSoundingSingleSideData {
@nullable List<android.hardware.bluetooth.ranging.StepTonePct> stepTonePcts;
@nullable byte[] packetQuality;
@nullable byte[] packetRssiDbm;
@nullable android.hardware.bluetooth.ranging.Nadm[] packetNadm;
@nullable List<android.hardware.bluetooth.ranging.ComplexNumber> packetPct1;
@nullable List<android.hardware.bluetooth.ranging.ComplexNumber> packetPct2;
byte referencePowerDbm;
@nullable byte[] vendorSpecificCsSingleSidedata;
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable ComplexNumber {
double real;
double imaginary;
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable Config {
android.hardware.bluetooth.ranging.ModeType modeType;
android.hardware.bluetooth.ranging.SubModeType subModeType;
android.hardware.bluetooth.ranging.RttType rttType;
byte[10] channelMap;
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum CsSecurityLevel {
NOT_SUPPORTED = 0x00,
ONE = 0x01,
TWO = 0x02,
THREE = 0x03,
FOUR = 0x04,
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable DeviceAddress {
android.hardware.bluetooth.ranging.AddressType addressType;
byte[6] address;
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
interface IBluetoothChannelSounding {
@nullable android.hardware.bluetooth.ranging.VendorSpecificData[] getVendorSpecificData();
@nullable android.hardware.bluetooth.ranging.SessionType[] getSupportedSessionTypes();
android.hardware.bluetooth.ranging.CsSecurityLevel getMaxSupportedCsSecurityLevel();
@nullable android.hardware.bluetooth.ranging.IBluetoothChannelSoundingSession openSession(in android.hardware.bluetooth.ranging.BluetoothChannelSoundingParameters params, in android.hardware.bluetooth.ranging.IBluetoothChannelSoundingSessionCallback callback);
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
interface IBluetoothChannelSoundingSession {
@nullable android.hardware.bluetooth.ranging.VendorSpecificData[] getVendorSpecificReplies();
android.hardware.bluetooth.ranging.ResultType[] getSupportedResultTypes();
boolean isAbortedProcedureRequired();
void writeRawData(in android.hardware.bluetooth.ranging.ChannelSoudingRawData rawData);
void close(android.hardware.bluetooth.ranging.Reason reason);
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
interface IBluetoothChannelSoundingSessionCallback {
void onOpened(android.hardware.bluetooth.ranging.Reason reason);
void onOpenFailed(android.hardware.bluetooth.ranging.Reason reason);
void onResult(in android.hardware.bluetooth.ranging.RangingResult result);
void onClose(android.hardware.bluetooth.ranging.Reason reason);
void onCloseFailed(android.hardware.bluetooth.ranging.Reason reason);
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="byte") @VintfStability
enum LocationType {
UNKNOWN = 0x00,
INDOOR = 0x01,
OUTDOOR = 0x02,
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum ModeType {
ZERO = 0x00,
ONE = 0x01,
TWO = 0x02,
THREE = 0x03,
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="byte") @VintfStability
enum Nadm {
ATTACK_IS_EXTREMELY_UNLIKELY = 0x00,
ATTACK_IS_VERY_UNLIKELY = 0x01,
ATTACK_IS_UNLIKELY = 0x02,
ATTACK_IS_POSSIBLE = 0x03,
ATTACK_IS_LIKELY = 0x04,
ATTACK_IS_VERY_LIKELY = 0x05,
ATTACK_IS_EXTREMELY_LIKELY = 0x06,
UNKNOWN = 0xFFu8,
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable RangingResult {
double resultMeters;
double errorMeters;
double azimuthDegrees;
double errorAzimuthDegrees;
double altitudeDegrees;
double errorAltitudeDegrees;
double delaySpreadMeters;
byte confidenceLevel;
android.hardware.bluetooth.ranging.Nadm detectedAttackLevel;
double velocityMetersPerSecond;
@nullable byte[] vendorSpecificCsRangingResultsData;
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum Reason {
LOCAL_STACK_REQUEST,
HAL_INITIATED,
HARDWARE_INITIATED,
ERROR_INVALID_PARAMETER,
ERROR_UNKNOWN,
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum ResultType {
RESULT_METERS = 0x00,
ERROR_METERS = 0x01,
AZIMUTH_DEGREES = 0x02,
ERROR_AZIMUTH_DEGREES = 0x03,
ALTITUDE_DEGREES = 0x04,
ERROR_ALTITUDE_DEGREES = 0x05,
DELAY_SPREAD_METERS = 0x06,
CONFIDENCE_LEVEL = 0x07,
SECURITY_LEVEL = 0x08,
VELOCITY = 0x09,
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum Role {
INITIATOR = 0,
REFLECTOR = 1,
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum RttType {
AA_COARSE = 0x00,
WITH_32_BIT_SOUNDING_SEQUENCE = 0x01,
WITH_96_BIT_SOUNDING_SEQUENCE = 0x02,
WITH_32_BIT_RANDOM_SEQUENCE = 0x03,
WITH_64_BIT_RANDOM_SEQUENCE = 0x04,
WITH_96_BIT_RANDOM_SEQUENCE = 0x05,
WITH_128_BIT_RANDOM_SEQUENCE = 0x06,
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum SessionType {
SOFTWARE_STACK_DATA_PARSING = 0,
HARDWARE_OFFLOAD_DATA_PARSING = 1,
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="byte") @VintfStability
enum SightType {
UNKNOWN = 0x00,
LINE_OF_SIGHT = 0x01,
NON_LINE_OF_SIGHT = 0x02,
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable StepTonePct {
List<android.hardware.bluetooth.ranging.ComplexNumber> tonePcts;
byte[] toneQualityIndicator;
const int TONE_QUALITY_GOOD = 0;
const int TONE_QUALITY_MEDIUM = 1;
const int TONE_QUALITY_LOW = 2;
const int TONE_QUALITY_UNAVAILABLE = 3;
const int EXTENSION_SLOT_NONE = 0;
const int EXTENSION_SLOT_TONE_NOT_EXPECTED_TO_BE_PRESENT = 1;
const int EXTENSION_SLOT_TONE_EXPECTED_TO_BE_PRESENT = 2;
const int EXTENSION_SLOT_SHIFT_AMOUNT = 4;
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@Backing(type="int") @VintfStability
enum SubModeType {
ONE = 0x01,
TWO = 0x02,
THREE = 0x03,
UNUSED = 0xff,
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable VendorSpecificData {
byte[16] characteristicUuid;
byte[] opaqueValue;
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum AddressType {
PUBLIC = 0x00,
RANDOM = 0x01,
}

View file

@ -0,0 +1,81 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.Config;
import android.hardware.bluetooth.ranging.DeviceAddress;
import android.hardware.bluetooth.ranging.LocationType;
import android.hardware.bluetooth.ranging.Role;
import android.hardware.bluetooth.ranging.SessionType;
import android.hardware.bluetooth.ranging.SightType;
import android.hardware.bluetooth.ranging.VendorSpecificData;
/**
* Parameters for IBluetoothChannelSoundingSession.openSession().
*/
@VintfStability
parcelable BluetoothChannelSoundingParameters {
SessionType sessionType;
/**
* Acl handle of the connection.
*/
int aclHandle;
/**
* L2CAP Cid, needed in case of EATT which may use dynamic channel for GATT.
*/
int l2capCid;
/**
* ATT handle of the Real-time Procedure Data.
*/
int realTimeProcedureDataAttHandle;
/**
* Role of the local device.
*/
Role role;
/**
* If sounding phase-based ranging is supported by the local device.
*/
boolean localSupportsSoundingPhaseBasedRanging;
/**
* If sounding phase-based ranging is supported by the remote device.
*/
boolean remoteSupportsSoundingPhaseBaseRanging;
/**
* CS conifg used for procedure enable.
*/
Config config;
/**
* Device address of the remote device.
*/
DeviceAddress address;
/**
* Vendor-specific data get from remote GATT Server
*/
@nullable VendorSpecificData[] vendorSpecificData;
/**
* Specifies the preferred location type of the use case (indoor, outdoor, unknown), this is
* used by the HAL to choose the corresponding ranging algorithm if it supports multiple
* algorithms
*/
LocationType locationType;
/**
* Specifies the preferred sight type of the use case (line-of-sight, non-line-of-sight,
* unknown), this is used by the HAL to choose the corresponding ranging algorithm if it
* supports multiple algorithms
*/
SightType sightType;
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.ChannelSoundingSingleSideData;
import android.hardware.bluetooth.ranging.ModeType;
/**
* Raw ranging data of Channel Sounding.
*/
@VintfStability
parcelable ChannelSoudingRawData {
/**
* Procedure counter of the CS procedure.
*/
int procedureCounter;
/**
* Indicate if the procedure aborted.
*/
boolean aborted;
/**
* Common data for both initator and reflector sided.
*/
ChannelSoundingSingleSideData initiatorData;
ChannelSoundingSingleSideData reflectorData;
/**
* The channel indices of every step in a CS procedure (in time order).
*/
byte[] stepChannels;
/**
* Toa_tod_initator from mode-1 or mode-3 steps in a CS procedure (in time order).
* Time of flight = 0.5 * (toa_tod_initiator - tod_toa_reflector).
*/
@nullable int[] toaTodInitiator;
/**
* Tod_toa_reflector from mode-1 or mode-3 steps in a CS procedure (in time order).
* Time of flight = 0.5 * (toa_tod_initiator - tod_toa_reflector).
*/
@nullable int[] todToaReflector;
/**
* CS mode (0, 1, 2, 3) of each CS step.
*/
ModeType[] stepMode;
/**
* Number of antenna paths (1 to 4) reported in the CS procedure.
*/
byte numAntennaPaths;
/**
* Timestamp when the procedure is created. Using epoch time in ms (e.g., 1697673127175).
*/
long timestampMs;
}

View file

@ -0,0 +1,58 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.ComplexNumber;
import android.hardware.bluetooth.ranging.Nadm;
import android.hardware.bluetooth.ranging.StepTonePct;
/**
* Raw ranging data of Channel Sounding from either Initator or Reflector
*/
@VintfStability
parcelable ChannelSoundingSingleSideData {
/**
* PCT (complex value) measured from mode-2 or mode-3 steps in a CS procedure (in time order).
*/
@nullable List<StepTonePct> stepTonePcts;
/**
* Packet Quality from mode-1 or mode-3 steps in a CS procedures (in time order).
*/
@nullable byte[] packetQuality;
/**
* Packet RSSI (-127 to 20) of mode-0, mode-1, or mode-3 step data, in dBm.
*/
@nullable byte[] packetRssiDbm;
/**
* Packet NADM of mode-1 or mode-3 step data for attack detection.
*/
@nullable Nadm[] packetNadm;
/**
* Packet_PCT1 or packet_PCT2 of mode-1 or mode-3, if sounding sequence is used and sounding
* phase-based ranging is supported.
*/
@nullable List<ComplexNumber> packetPct1;
@nullable List<ComplexNumber> packetPct2;
/**
* Reference power level (-127 to 20) of the signal in the procedure, in dBm.
*/
byte referencePowerDbm;
/**
* Parameter for vendors to place vendor-specific raw ranging data.
*/
@nullable byte[] vendorSpecificCsSingleSidedata;
}

View file

@ -0,0 +1,23 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
parcelable ComplexNumber {
double real;
double imaginary;
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.ModeType;
import android.hardware.bluetooth.ranging.RttType;
import android.hardware.bluetooth.ranging.SubModeType;
@VintfStability
parcelable Config {
/**
* Main_Mode_Type of the CS conifg
*/
ModeType modeType;
/**
* Sub_Mode_Type of the CS conifg
*/
SubModeType subModeType;
/**
* RTT_Type of the CS conifg
*/
RttType rttType;
/**
* Channel_Map of the CS conifg, this parameter contains 80 1-bit fields. The nth such field
* (in the range 0 to 78) contains the value for the CS channel index n.
*
* Channel n is enabled for CS procedure = 1
* Channel n is disabled for CS procedure = 0
*/
byte[10] channelMap;
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum CsSecurityLevel {
/**
* Ranging algorithm is not implemented.
*/
NOT_SUPPORTED = 0x00,
/**
* Either CS tone or CS RTT.
*/
ONE = 0x01,
/**
* 150 ns CS RTT accuracy and CS tones.
*/
TWO = 0x02,
/**
* 10 ns CS RTT accuracy and CS tones.
*/
THREE = 0x03,
/**
* Level 3 with the addition of CS RTT sounding sequence or random sequence
* payloads, and support of the Normalized Attack Detector Metric requirements.
*/
FOUR = 0x04,
}

View file

@ -0,0 +1,28 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.AddressType;
/**
* Bluetooth address with address type
*/
@VintfStability
parcelable DeviceAddress {
AddressType addressType;
byte[6] address;
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.BluetoothChannelSoundingParameters;
import android.hardware.bluetooth.ranging.CsSecurityLevel;
import android.hardware.bluetooth.ranging.IBluetoothChannelSoundingSession;
import android.hardware.bluetooth.ranging.IBluetoothChannelSoundingSessionCallback;
import android.hardware.bluetooth.ranging.Nadm;
import android.hardware.bluetooth.ranging.SessionType;
import android.hardware.bluetooth.ranging.VendorSpecificData;
/**
* The interface for the Bluetooth stack to get vendor specifc data and open session
* for channel sounding.
*/
@VintfStability
interface IBluetoothChannelSounding {
/**
* API to get vendor-specific data, the Bluetooth stack will provision the GATT server with
* these vendor-specific UUIDs and data.
*
* @return an array of vendor specifc data
*/
@nullable VendorSpecificData[] getVendorSpecificData();
/**
* API to get supported session types of the HAL
*
* @return an array of supported session types
*/
@nullable SessionType[] getSupportedSessionTypes();
/**
* API to get max supported security level (0 to 4) of CS for ranging algorithms.
*
* See: https://bluetooth.com/specifications/specs/channel-sounding-cr-pr/
*
* @return CsSecurityLevel that indicates max supported security level of CS for ranging
* algorithms.
*/
CsSecurityLevel getMaxSupportedCsSecurityLevel();
/**
* API to open session for channel sounding and register the corresponeding callback
*
* @return an instance of IBluetoothChannelSoundingSession
*/
@nullable IBluetoothChannelSoundingSession openSession(
in BluetoothChannelSoundingParameters params,
in IBluetoothChannelSoundingSessionCallback callback);
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.ChannelSoudingRawData;
import android.hardware.bluetooth.ranging.Reason;
import android.hardware.bluetooth.ranging.ResultType;
import android.hardware.bluetooth.ranging.VendorSpecificData;
/**
* Session of Channel Sounding get from IBluetoothChannelSounding.openSession().
* Used by the Bluetooth stack to get preferred config from HAL and provide raw ranging data to
* the HAL.
*/
@VintfStability
interface IBluetoothChannelSoundingSession {
/**
* API to get vendor-specifc replies
*
* @return an array of vendor-specifc data
*/
@nullable VendorSpecificData[] getVendorSpecificReplies();
/**
* API to obtain supported result types. The Bluetooth stack should use this function to check
* for supported result types and ignore unsupported types in the RangingResult.
*
* @return an array of vendor-specifc data
*/
ResultType[] getSupportedResultTypes();
/**
* Indicate whether the HAL would like to receive raw data of abort procedures.
* If this function returns true, the Bluetooth stack should pass the data to the HAL using
* the writeRawData() function, even if the CS procedure is aborted.
*
* @return true if the HAL would like to receive raw data of abort procedures.
*/
boolean isAbortedProcedureRequired();
/**
* API to provide raw ranging data to the HAL. The HAL converts this data into meaningful
* ranging results using a proprietary algorithm and then calls back to the Bluetooth stack via
* IBluetoothChannelSoundingSessionCallback.onResult().
*/
void writeRawData(in ChannelSoudingRawData rawData);
/**
* Close the current session. Object is no longer useful after this method.
*/
void close(Reason reason);
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.RangingResult;
import android.hardware.bluetooth.ranging.Reason;
/**
* The callback from the HAL to the stack.
* Register by IBluetoothChannelSoundingSession.openSession().
*/
@VintfStability
interface IBluetoothChannelSoundingSessionCallback {
/**
* Invoked when IBluetoothChannelSounding.openSession() is successful.
*/
void onOpened(Reason reason);
/**
* Invoked when IBluetoothChannelSounding.openSession() fails.
*/
void onOpenFailed(Reason reason);
/**
* Invoked when HAL get raning result.
*/
void onResult(in RangingResult result);
/**
* Invoked when IBluetoothChannelSoundingSession.close() is successful.
*/
void onClose(Reason reason);
/**
* Invoked when IBluetoothChannelSoundingSession.close() fails.
*/
void onCloseFailed(Reason reason);
}

View file

@ -0,0 +1,25 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="byte")
enum LocationType {
UNKNOWN = 0x00,
INDOOR = 0x01,
OUTDOOR = 0x02,
}

View file

@ -0,0 +1,26 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum ModeType {
ZERO = 0x00,
ONE = 0x01,
TWO = 0x02,
THREE = 0x03,
}

View file

@ -0,0 +1,30 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="byte")
enum Nadm {
ATTACK_IS_EXTREMELY_UNLIKELY = 0x00,
ATTACK_IS_VERY_UNLIKELY = 0x01,
ATTACK_IS_UNLIKELY = 0x02,
ATTACK_IS_POSSIBLE = 0x03,
ATTACK_IS_LIKELY = 0x04,
ATTACK_IS_VERY_LIKELY = 0x05,
ATTACK_IS_EXTREMELY_LIKELY = 0x06,
UNKNOWN = 0xFFu8,
}

View file

@ -0,0 +1,93 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.Nadm;
/**
* Generic structure to return the ranging result
*/
@VintfStability
parcelable RangingResult {
/**
* Estimated distance in meters.
*/
double resultMeters;
/**
* Potential distance estimate error (plus or minus) in meters, always positive.
*/
double errorMeters;
/**
* Azimuth Angle measurement in degrees.
*
* Azimuth of remote device in horizontal coordinate system, this measured from azimuth north
* and increasing eastward. When the remote device in azimuth north, this angle is 0, when the
* remote device in azimuth south, this angle is 180.
*
* See: <a href="https://en.wikipedia.org/wiki/Horizontal_coordinate_system">Horizontal
* coordinate system</a>for the details
*
* On an Android device, azimuth north is defined as the angle perpendicular away from the
* back of the device when holding it in portrait mode upright.
*
* The Azimuth north is defined as the direction in which the top edge of the device is
* facing when it is placed flat.
*
*/
double azimuthDegrees;
/**
* Estimated error (plus or minus) of azimuth angle measurement in degrees, always positive.
*/
double errorAzimuthDegrees;
/**
* Altitude Angle measurement in degrees.
*
* Altitude of remote device in horizontal coordinate system, this is the angle between the
* remote device and the top edge of local device. When local device is placed flat, the angle
* of the zenith is 90, the angle of the nadir is -90.
*
* See: https://en.wikipedia.org/wiki/Horizontal_coordinate_system
*/
double altitudeDegrees;
/**
* Estimated error (plus or minus) of altitude angle measurement in degrees, always positive.
*/
double errorAltitudeDegrees;
/**
* Estimated delay spread in meters of the measured channel. This is a measure of multipath
* richness of the channel.
*/
double delaySpreadMeters;
/**
* A normalized value from 0 (low confidence) to 100 (high confidence) representing the
* confidence of estimated distance.
*/
byte confidenceLevel;
/**
* A value representing the chance of being attacked for the measurement.
*/
Nadm detectedAttackLevel;
/**
* Estimated velocity, in the direction of line between two devices, of the moving object in
* meters/sec.
*/
double velocityMetersPerSecond;
/**
* Parameter for vendors to place vendor-specific ranging results data.
*/
@nullable byte[] vendorSpecificCsRangingResultsData;
}

View file

@ -0,0 +1,27 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum Reason {
LOCAL_STACK_REQUEST,
HAL_INITIATED,
HARDWARE_INITIATED,
ERROR_INVALID_PARAMETER,
ERROR_UNKNOWN,
}

View file

@ -0,0 +1,32 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum ResultType {
RESULT_METERS = 0x00,
ERROR_METERS = 0x01,
AZIMUTH_DEGREES = 0x02,
ERROR_AZIMUTH_DEGREES = 0x03,
ALTITUDE_DEGREES = 0x04,
ERROR_ALTITUDE_DEGREES = 0x05,
DELAY_SPREAD_METERS = 0x06,
CONFIDENCE_LEVEL = 0x07,
SECURITY_LEVEL = 0x08,
VELOCITY = 0x09,
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum Role {
INITIATOR = 0,
REFLECTOR = 1,
}

View file

@ -0,0 +1,29 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum RttType {
AA_COARSE = 0x00,
WITH_32_BIT_SOUNDING_SEQUENCE = 0x01,
WITH_96_BIT_SOUNDING_SEQUENCE = 0x02,
WITH_32_BIT_RANDOM_SEQUENCE = 0x03,
WITH_64_BIT_RANDOM_SEQUENCE = 0x04,
WITH_96_BIT_RANDOM_SEQUENCE = 0x05,
WITH_128_BIT_RANDOM_SEQUENCE = 0x06,
}

View file

@ -0,0 +1,30 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum SessionType {
/**
* Stack parses raw data and passes it to the HAL
*/
SOFTWARE_STACK_DATA_PARSING = 0,
/**
* Offloader parses raw data
*/
HARDWARE_OFFLOAD_DATA_PARSING = 1
}

View file

@ -0,0 +1,25 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="byte")
enum SightType {
UNKNOWN = 0x00,
LINE_OF_SIGHT = 0x01,
NON_LINE_OF_SIGHT = 0x02,
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
import android.hardware.bluetooth.ranging.ComplexNumber;
/**
* Tone PCT data with quality indicator from a mode-2 or mode-3 step.
*/
@VintfStability
parcelable StepTonePct {
List<ComplexNumber> tonePcts;
const int TONE_QUALITY_GOOD = 0;
const int TONE_QUALITY_MEDIUM = 1;
const int TONE_QUALITY_LOW = 2;
const int TONE_QUALITY_UNAVAILABLE = 3;
const int EXTENSION_SLOT_NONE = 0;
const int EXTENSION_SLOT_TONE_NOT_EXPECTED_TO_BE_PRESENT = 1;
const int EXTENSION_SLOT_TONE_EXPECTED_TO_BE_PRESENT = 2;
/**
* Shift amount for extension slot (bits 4 to 7).
*/
const int EXTENSION_SLOT_SHIFT_AMOUNT = 4;
/**
* Tone_Quality_Indicator defined in the LE CS Subevent Result event
*
* Bits 0 to 3:
* 0x0 = Tone quality is good
* 0x1 = Tone quality is medium
* 0x2 = Tone quality is low
* 0x3 = Tone quality is unavailable
*
* Bits 4 to 7:
* 0x0 = Not tone extension slot
* 0x1 = Tone extension slot; tone not expected to be present
* 0x2 = Tone extension slot; tone expected to be present
*
* See: https://bluetooth.com/specifications/specs/channel-sounding-cr-pr/
*/
byte[] toneQualityIndicator;
}

View file

@ -0,0 +1,26 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
@VintfStability
@Backing(type="int")
enum SubModeType {
ONE = 0x01,
TWO = 0x02,
THREE = 0x03,
UNUSED = 0xff,
}

View file

@ -0,0 +1,26 @@
/*
* Copyright 2023 The Android Open Source Project
*
* 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.bluetooth.ranging;
/**
* Vendor specific data for GATT.
*/
@VintfStability
parcelable VendorSpecificData {
byte[16] characteristicUuid;
byte[] opaqueValue;
}

View file

@ -0,0 +1,29 @@
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_binary {
name: "android.hardware.bluetooth.ranging-service.default",
relative_install_path: "hw",
init_rc: ["bluetooth-ranging-service-default.rc"],
vintf_fragments: [":manifest_android.hardware.bluetooth.ranging-service.default.xml"],
vendor: true,
srcs: [
"BluetoothChannelSounding.cpp",
"BluetoothChannelSoundingSession.cpp",
"service.cpp",
],
shared_libs: [
"android.hardware.bluetooth.ranging-V1-ndk",
"libbase",
"libbinder_ndk",
"libhidlbase",
"libutils",
"liblog",
],
}
filegroup {
name: "manifest_android.hardware.bluetooth.ranging-service.default.xml",
srcs: ["bluetooth-ranging-service-default.xml"],
}

View file

@ -0,0 +1,58 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* 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.
*/
#include "BluetoothChannelSounding.h"
#include "BluetoothChannelSoundingSession.h"
namespace aidl::android::hardware::bluetooth::ranging::impl {
BluetoothChannelSounding::BluetoothChannelSounding() {}
BluetoothChannelSounding::~BluetoothChannelSounding() {}
ndk::ScopedAStatus BluetoothChannelSounding::getVendorSpecificData(
std::optional<
std::vector<std::optional<VendorSpecificData>>>* /*_aidl_return*/) {
return ::ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus BluetoothChannelSounding::getSupportedSessionTypes(
std::optional<std::vector<SessionType>>* _aidl_return) {
std::vector<SessionType> supported_session_types = {};
*_aidl_return = supported_session_types;
return ::ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus BluetoothChannelSounding::getMaxSupportedCsSecurityLevel(
CsSecurityLevel* _aidl_return) {
CsSecurityLevel security_level = CsSecurityLevel::NOT_SUPPORTED;
*_aidl_return = security_level;
return ::ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus BluetoothChannelSounding::openSession(
const BluetoothChannelSoundingParameters& /*in_params*/,
const std::shared_ptr<IBluetoothChannelSoundingSessionCallback>&
in_callback,
std::shared_ptr<IBluetoothChannelSoundingSession>* _aidl_return) {
if (in_callback == nullptr) {
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
EX_ILLEGAL_ARGUMENT, "Invalid nullptr callback");
}
std::shared_ptr<BluetoothChannelSoundingSession> session = nullptr;
session = ndk::SharedRefBase::make<BluetoothChannelSoundingSession>(
in_callback, Reason::LOCAL_STACK_REQUEST);
*_aidl_return = session;
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::bluetooth::ranging::impl

View file

@ -0,0 +1,52 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* 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.
*/
#include <aidl/android/hardware/bluetooth/ranging/BnBluetoothChannelSounding.h>
#include <vector>
namespace aidl::android::hardware::bluetooth::ranging::impl {
using ::aidl::android::hardware::bluetooth::ranging::
BluetoothChannelSoundingParameters;
using ::aidl::android::hardware::bluetooth::ranging::BnBluetoothChannelSounding;
using ::aidl::android::hardware::bluetooth::ranging::CsSecurityLevel;
using ::aidl::android::hardware::bluetooth::ranging::
IBluetoothChannelSoundingSession;
using ::aidl::android::hardware::bluetooth::ranging::
IBluetoothChannelSoundingSessionCallback;
using ::aidl::android::hardware::bluetooth::ranging::SessionType;
using ::aidl::android::hardware::bluetooth::ranging::VendorSpecificData;
class BluetoothChannelSounding : public BnBluetoothChannelSounding {
public:
BluetoothChannelSounding();
~BluetoothChannelSounding(); // Add the destructor declaration
ndk::ScopedAStatus getVendorSpecificData(
std::optional<std::vector<std::optional<VendorSpecificData>>>*
_aidl_return) override;
ndk::ScopedAStatus getSupportedSessionTypes(
std::optional<std::vector<SessionType>>* _aidl_return) override;
ndk::ScopedAStatus getMaxSupportedCsSecurityLevel(
CsSecurityLevel* _aidl_return) override;
ndk::ScopedAStatus openSession(
const BluetoothChannelSoundingParameters& in_params,
const std::shared_ptr<IBluetoothChannelSoundingSessionCallback>&
in_callback,
std::shared_ptr<IBluetoothChannelSoundingSession>* _aidl_return) override;
};
} // namespace aidl::android::hardware::bluetooth::ranging::impl

View file

@ -0,0 +1,55 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* 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.
*/
#include "BluetoothChannelSoundingSession.h"
namespace aidl::android::hardware::bluetooth::ranging::impl {
BluetoothChannelSoundingSession::BluetoothChannelSoundingSession(
std::shared_ptr<IBluetoothChannelSoundingSessionCallback> callback,
Reason reason) {
callback_ = callback;
callback_->onOpened(reason);
}
ndk::ScopedAStatus BluetoothChannelSoundingSession::getVendorSpecificReplies(
std::optional<
std::vector<std::optional<VendorSpecificData>>>* /*_aidl_return*/) {
return ::ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus BluetoothChannelSoundingSession::getSupportedResultTypes(
std::vector<ResultType>* _aidl_return) {
std::vector<ResultType> supported_result_types = {ResultType::RESULT_METERS};
*_aidl_return = supported_result_types;
return ::ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus BluetoothChannelSoundingSession::isAbortedProcedureRequired(
bool* _aidl_return) {
*_aidl_return = false;
return ::ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus BluetoothChannelSoundingSession::writeRawData(
const ChannelSoudingRawData& /*in_rawData*/) {
RangingResult ranging_result;
ranging_result.resultMeters = 0.0;
callback_->onResult(ranging_result);
return ::ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus BluetoothChannelSoundingSession::close(Reason in_reason) {
callback_->onClose(in_reason);
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::bluetooth::ranging::impl

View file

@ -0,0 +1,50 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* 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.
*/
#include <aidl/android/hardware/bluetooth/ranging/BnBluetoothChannelSoundingSession.h>
#include <aidl/android/hardware/bluetooth/ranging/IBluetoothChannelSoundingSessionCallback.h>
#include <vector>
namespace aidl::android::hardware::bluetooth::ranging::impl {
using ::aidl::android::hardware::bluetooth::ranging::ChannelSoudingRawData;
using ::aidl::android::hardware::bluetooth::ranging::Reason;
using ::aidl::android::hardware::bluetooth::ranging::ResultType;
using ::aidl::android::hardware::bluetooth::ranging::VendorSpecificData;
class BluetoothChannelSoundingSession
: public BnBluetoothChannelSoundingSession {
public:
BluetoothChannelSoundingSession(
std::shared_ptr<IBluetoothChannelSoundingSessionCallback> callback,
Reason reason);
ndk::ScopedAStatus getVendorSpecificReplies(
std::optional<std::vector<std::optional<VendorSpecificData>>>*
_aidl_return) override;
ndk::ScopedAStatus getSupportedResultTypes(
std::vector<ResultType>* _aidl_return) override;
ndk::ScopedAStatus isAbortedProcedureRequired(bool* _aidl_return) override;
ndk::ScopedAStatus writeRawData(
const ChannelSoudingRawData& in_rawData) override;
ndk::ScopedAStatus close(Reason in_reason) override;
private:
std::shared_ptr<IBluetoothChannelSoundingSessionCallback> callback_;
};
} // namespace aidl::android::hardware::bluetooth::ranging::impl

View file

@ -0,0 +1,6 @@
service vendor.bluetooth.ranging-default /vendor/bin/hw/android.hardware.bluetooth.ranging-service.default
class hal
capabilities BLOCK_SUSPEND NET_ADMIN SYS_NICE
user bluetooth
group bluetooth
task_profiles HighPerformance

View file

@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.bluetooth.ranging</name>
<version>1</version>
<fqname>IBluetoothChannelSounding/default</fqname>
</hal>
</manifest>

View file

@ -0,0 +1,48 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* 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.
*/
#define LOG_TAG "aidl.android.hardware.bluetooth.ranging.service.default"
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <utils/Log.h>
#include "BluetoothChannelSounding.h"
#include "BluetoothChannelSoundingSession.h"
using ::aidl::android::hardware::bluetooth::ranging::impl::
BluetoothChannelSounding;
int main(int /* argc */, char** /* argv */) {
ALOGI("Bluetooth Ranging HAL registering");
if (!ABinderProcess_setThreadPoolMaxThreadCount(0)) {
ALOGE("Failed to set thread pool max thread count");
return 1;
}
std::shared_ptr<BluetoothChannelSounding> service =
ndk::SharedRefBase::make<BluetoothChannelSounding>();
std::string instance =
std::string() + BluetoothChannelSounding::descriptor + "/default";
auto result =
AServiceManager_addService(service->asBinder().get(), instance.c_str());
if (result == STATUS_OK) {
ABinderProcess_joinThreadPool();
} else {
ALOGE("Could not register as a service!");
}
return 0;
}

View file

@ -146,6 +146,14 @@
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.bluetooth.ranging</name>
<version>1</version>
<interface>
<name>IBluetoothChannelSounding</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.bluetooth.finder</name>
<version>1</version>