1 /* 2 * Copyright (C) 2014 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.gatt; 18 19 import android.annotation.Nullable; 20 import android.bluetooth.le.AdvertiseData; 21 import android.bluetooth.le.AdvertiseSettings; 22 23 import java.util.Objects; 24 25 /** 26 * Helper class that represents a client for Bluetooth LE advertise operations. 27 * 28 * @hide 29 */ 30 class AdvertiseClient { 31 int clientIf; 32 // Associated application died. 33 boolean appDied; 34 AdvertiseSettings settings; 35 AdvertiseData advertiseData; 36 @Nullable 37 AdvertiseData scanResponse; 38 39 /** 40 * @param clientIf - Identifier of the client. 41 */ AdvertiseClient(int clientIf)42 AdvertiseClient(int clientIf) { 43 this.clientIf = clientIf; 44 } 45 46 /** 47 * @param clientIf - Identifier of the client. 48 * @param settings - Settings for the advertising. 49 * @param advertiseData - Advertise data broadcasted over the air. 50 * @param scanResponse - Response of scan request, could be null. 51 */ AdvertiseClient(int clientIf, AdvertiseSettings settings, AdvertiseData advertiseData, AdvertiseData scanResponse)52 AdvertiseClient(int clientIf, AdvertiseSettings settings, AdvertiseData advertiseData, 53 AdvertiseData scanResponse) { 54 this.clientIf = clientIf; 55 this.settings = settings; 56 this.advertiseData = advertiseData; 57 this.scanResponse = scanResponse; 58 } 59 60 @Override equals(Object obj)61 public boolean equals(Object obj) { 62 if (this == obj) { 63 return true; 64 } 65 if (obj == null || getClass() != obj.getClass()) { 66 return false; 67 } 68 AdvertiseClient other = (AdvertiseClient) obj; 69 return clientIf == other.clientIf; 70 } 71 72 @Override hashCode()73 public int hashCode() { 74 return Objects.hash(clientIf); 75 } 76 } 77