1 /*
2  * Copyright 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.bluetooth.bass_client;
18 
19 import android.os.ParcelUuid;
20 
21 import java.util.UUID;
22 
23 /** Broadcast Audio Scan Service constants class */
24 public class BassConstants {
25     public static final ParcelUuid BAAS_UUID =
26             ParcelUuid.fromString("00001852-0000-1000-8000-00805F9B34FB");
27     public static final UUID BASS_UUID = UUID.fromString("0000184F-0000-1000-8000-00805F9B34FB");
28     public static final UUID BASS_BCAST_AUDIO_SCAN_CTRL_POINT =
29             UUID.fromString("00002BC7-0000-1000-8000-00805F9B34FB");
30     public static final UUID BASS_BCAST_RECEIVER_STATE =
31             UUID.fromString("00002BC8-0000-1000-8000-00805F9B34FB");
32     public static final UUID CLIENT_CHARACTERISTIC_CONFIG =
33             UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
34     public static final ParcelUuid BASIC_AUDIO_UUID =
35             ParcelUuid.fromString("00001851-0000-1000-8000-00805F9B34FB");
36     public static final ParcelUuid PUBLIC_BROADCAST_UUID =
37             ParcelUuid.fromString("00001856-0000-1000-8000-00805F9B34FB");
38 
39     public static final int INVALID_SYNC_HANDLE = -1;
40     public static final int INVALID_ADV_SID = -1;
41     public static final int INVALID_ADV_ADDRESS_TYPE = -1;
42     public static final int INVALID_ADV_INTERVAL = -1;
43     public static final int INVALID_BROADCAST_ID = -1;
44     public static final int BROADCAST_ASSIST_ADDRESS_TYPE_PUBLIC = 0;
45     public static final int INVALID_SOURCE_ID = -1;
46     public static final int INVALID_PA_SYNC_VALUE = -1;
47     public static final int ADV_ADDRESS_DONT_MATCHES_EXT_ADV_ADDRESS = 0x00000001;
48     public static final int ADV_ADDRESS_DONT_MATCHES_SOURCE_ADV_ADDRESS = 0x00000002;
49     // types of command for select and add Broadcast source operations
50     public static final int AUTO = 1;
51     public static final int USER = 2;
52     public static final int BASS_MAX_BYTES = 100;
53     // broadcast receiver state indices
54     public static final int BCAST_RCVR_STATE_SRC_ID_IDX = 0;
55     public static final int BCAST_RCVR_STATE_SRC_ADDR_TYPE_IDX = 1;
56     public static final int BCAST_RCVR_STATE_SRC_ADDR_START_IDX = 2;
57     public static final int BCAST_RCVR_STATE_SRC_BCAST_ID_START_IDX = 9;
58     public static final int BCAST_RCVR_STATE_SRC_ADDR_SIZE = 6;
59     public static final int BCAST_RCVR_STATE_SRC_ADV_SID_IDX = 8;
60     public static final int BCAST_RCVR_STATE_PA_SYNC_IDX = 12;
61     public static final int BCAST_RCVR_STATE_ENC_STATUS_IDX = 13;
62     public static final int BCAST_RCVR_STATE_BADCODE_START_IDX = 14;
63     public static final int BCAST_RCVR_STATE_BADCODE_SIZE = 16;
64     public static final int BCAST_RCVR_STATE_BIS_SYNC_SIZE = 4;
65     // 30 secs time out for all gatt writes
66     public static final int GATT_TXN_TIMEOUT_MS = 30000;
67     public static final int SOURCE_OPERATION_TIMEOUT_MS = 3000;
68     // 3 min time out for keeping PSYNC active
69     public static final int PSYNC_ACTIVE_TIMEOUT_MS = 3 * 60000;
70     // 2 secs time out achieving psync
71     public static final int PSYNC_TIMEOUT = 200;
72     public static final int PIN_CODE_CMD_LEN = 18;
73     public static final int CONNECT_TIMEOUT_MS = 30000;
74     // broadcast name AD type and length
75     public static final int BCAST_NAME_AD_TYPE = 0x30;
76     public static final int BCAST_NAME_LEN_MIN = 4;
77     public static final int BCAST_NAME_LEN_MAX = 32;
78     // PA_Sync parameter value
79     public static final int PA_SYNC_DO_NOT_SYNC = 0x00;
80     public static final int PA_SYNC_PAST_AVAILABLE = 0x01;
81     public static final int PA_SYNC_PAST_NOT_AVAILABLE = 0x02;
82     // BIS_Sync parameter value
83     public static final long BIS_SYNC_NOT_SYNC_TO_BIS = 0x00000000L;
84     public static final long BIS_SYNC_FAILED_SYNC_TO_BIG = 0xFFFFFFFFL;
85 }
86