• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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.server.uwb.pm;
18 
19 import static com.android.server.uwb.data.UwbConfig.CENTRAL;
20 import static com.android.server.uwb.data.UwbConfig.CONTROLEE_AND_RESPONDER;
21 import static com.android.server.uwb.data.UwbConfig.CONTROLLER_AND_INITIATOR;
22 import static com.android.server.uwb.data.UwbConfig.OOB_TYPE_BLE;
23 import static com.android.server.uwb.data.UwbConfig.PERIPHERAL;
24 
25 import static com.google.uwb.support.fira.FiraParams.MULTI_NODE_MODE_ONE_TO_MANY;
26 import static com.google.uwb.support.fira.FiraParams.RFRAME_CONFIG_SP3;
27 import static com.google.uwb.support.fira.FiraParams.STS_CONFIG_DYNAMIC;
28 
29 import com.android.server.uwb.data.UwbConfig;
30 
31 public class PacsProfile {
32 
33     /** PACS Controlee config */
34     private static UwbConfig sControlee;
35 
36     /** PACS controller config */
37     private static UwbConfig sController;
38 
getPacsControleeProfile()39     public static UwbConfig getPacsControleeProfile() {
40         if (sControlee == null) {
41             UwbConfig.Builder builder = new UwbConfig.Builder();
42             sControlee = builder
43                     .setUwbRole(CONTROLEE_AND_RESPONDER)
44                     .setStsConfig(STS_CONFIG_DYNAMIC)
45                     .setMultiNodeMode(MULTI_NODE_MODE_ONE_TO_MANY)
46                     .setRframeConfig(RFRAME_CONFIG_SP3)
47                     .setTofReport(true)
48                     .setOobType(OOB_TYPE_BLE)
49                     .setOobBleRole(PERIPHERAL)
50                     .build();
51         }
52         return sControlee;
53     }
54 
55     /** Used for testing, only PACS controlee profile is supported for applications */
getPacsControllerProfile()56     public static UwbConfig getPacsControllerProfile() {
57         if (sController == null) {
58             UwbConfig.Builder builder = new UwbConfig.Builder();
59             sController = builder
60                     .setUwbRole(CONTROLLER_AND_INITIATOR)
61                     .setStsConfig(STS_CONFIG_DYNAMIC)
62                     .setMultiNodeMode(MULTI_NODE_MODE_ONE_TO_MANY)
63                     .setRframeConfig(RFRAME_CONFIG_SP3)
64                     .setTofReport(true)
65                     .setOobType(OOB_TYPE_BLE)
66                     .setOobBleRole(CENTRAL)
67                     .build();
68         }
69         return sController;
70     }
71 }
72