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.bluetooth.BluetoothDevice; 20 import android.util.Log; 21 22 /** 23 * Periodic Advertisement Result 24 */ 25 public class PeriodicAdvertisementResult { 26 private static final String TAG = PeriodicAdvertisementResult.class.getSimpleName(); 27 28 private BluetoothDevice mDevice; 29 private int mAddressType; 30 private int mAdvSid; 31 private int mSyncHandle; 32 private int mPAInterval; 33 private int mBroadcastId; 34 PeriodicAdvertisementResult(BluetoothDevice device, int addressType, int syncHandle, int advSid, int paInterval, int broadcastId)35 PeriodicAdvertisementResult(BluetoothDevice device, 36 int addressType, 37 int syncHandle, 38 int advSid, 39 int paInterval, 40 int broadcastId) { 41 mDevice = device; 42 mAddressType = addressType; 43 mAdvSid = advSid; 44 mSyncHandle = syncHandle; 45 mPAInterval = paInterval; 46 mBroadcastId = broadcastId; 47 } 48 49 /** 50 * Update Sync handle 51 */ updateSyncHandle(int syncHandle)52 public void updateSyncHandle(int syncHandle) { 53 mSyncHandle = syncHandle; 54 } 55 56 /** 57 * Get Sync handle 58 */ getSyncHandle()59 public int getSyncHandle() { 60 return mSyncHandle; 61 } 62 63 /** 64 * Update Adv ID 65 */ updateAdvSid(int advSid)66 public void updateAdvSid(int advSid) { 67 mAdvSid = advSid; 68 } 69 70 /** 71 * Get Adv ID 72 */ getAdvSid()73 public int getAdvSid() { 74 return mAdvSid; 75 } 76 77 /** 78 * Update address type 79 */ updateAddressType(int addressType)80 public void updateAddressType(int addressType) { 81 mAddressType = addressType; 82 } 83 84 /** 85 * Get address type 86 */ getAddressType()87 public int getAddressType() { 88 return mAddressType; 89 } 90 91 /** 92 * Update Adv interval 93 */ updateAdvInterval(int advInterval)94 public void updateAdvInterval(int advInterval) { 95 mPAInterval = advInterval; 96 } 97 98 /** 99 * Get Adv interval 100 */ getAdvInterval()101 public int getAdvInterval() { 102 return mPAInterval; 103 } 104 105 /** 106 * Update broadcast ID 107 */ updateBroadcastId(int broadcastId)108 public void updateBroadcastId(int broadcastId) { 109 mBroadcastId = broadcastId; 110 } 111 112 /** 113 * Get broadcast ID 114 */ getBroadcastId()115 public int getBroadcastId() { 116 return mBroadcastId; 117 } 118 119 /** 120 * print 121 */ print()122 public void print() { 123 log("-- PeriodicAdvertisementResult --"); 124 log("mDevice:" + mDevice); 125 log("mAddressType:" + mAddressType); 126 log("mAdvSid:" + mAdvSid); 127 log("mSyncHandle:" + mSyncHandle); 128 log("mPAInterval:" + mPAInterval); 129 log("mBroadcastId:" + mBroadcastId); 130 log("-- END: PeriodicAdvertisementResult --"); 131 } 132 log(String msg)133 static void log(String msg) { 134 if (BassConstants.BASS_DBG) { 135 Log.d(TAG, msg); 136 } 137 } 138 } 139