AdvertiseClient.java revision 27bd5f277ccf471f2fa9cd9151a2a226b51bc825
1e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang/* 2e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * Copyright (C) 2014 The Android Open Source Project 3e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * 4e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * Licensed under the Apache License, Version 2.0 (the "License"); 5e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * you may not use this file except in compliance with the License. 6e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * You may obtain a copy of the License at 7e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * 8e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * http://www.apache.org/licenses/LICENSE-2.0 9e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * 10e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * Unless required by applicable law or agreed to in writing, software 11e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * distributed under the License is distributed on an "AS IS" BASIS, 12e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * See the License for the specific language governing permissions and 14e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang * limitations under the License. 15e65500db39422398f3b87c4f340e66fdfec7e328Wei Wang */ 161a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang 171a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wangpackage com.android.bluetooth.gatt; 181a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang 19ccd5f131d51ef8019c87628b992bc67cbbcc2ea6Wei Wangimport android.annotation.Nullable; 20361e580eb6c07759cdd775ed57902839ff4bfe90Andre Eisenbachimport android.bluetooth.le.AdvertiseData; 2180e7d011fdb511a6583258458e97821176866baaWei Wangimport android.bluetooth.le.AdvertiseSettings; 221a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang 2327bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wangimport java.util.Objects; 2427bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang 251a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang/** 2627bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang * Helper class that represents a client for Bluetooth LE advertise operations. 2727bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang * 281a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang * @hide 291a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang */ 301a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wangclass AdvertiseClient { 311a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang int clientIf; 3280e7d011fdb511a6583258458e97821176866baaWei Wang AdvertiseSettings settings; 33361e580eb6c07759cdd775ed57902839ff4bfe90Andre Eisenbach AdvertiseData advertiseData; 34ccd5f131d51ef8019c87628b992bc67cbbcc2ea6Wei Wang @Nullable 35361e580eb6c07759cdd775ed57902839ff4bfe90Andre Eisenbach AdvertiseData scanResponse; 361a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang 3727bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang /** 3827bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang * @param clientIf - Identifier of the client. 3927bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang */ 4027bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang public AdvertiseClient(int clientIf) { 4127bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang this.clientIf = clientIf; 4227bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang } 4327bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang 4427bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang /** 4527bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang * @param clientIf - Identifier of the client. 4627bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang * @param settings - Settings for the advertising. 4727bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang * @param advertiseData - Advertise data broadcasted over the air. 4827bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang * @param scanResponse - Response of scan request, could be null. 4927bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang */ 5027bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang AdvertiseClient(int clientIf, AdvertiseSettings settings, AdvertiseData advertiseData, 51361e580eb6c07759cdd775ed57902839ff4bfe90Andre Eisenbach AdvertiseData scanResponse) { 521a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang this.clientIf = clientIf; 531a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang this.settings = settings; 5427bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang this.advertiseData = advertiseData; 55ccd5f131d51ef8019c87628b992bc67cbbcc2ea6Wei Wang this.scanResponse = scanResponse; 561a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang } 5727bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang 5827bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang @Override 5927bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang public boolean equals(Object obj) { 6027bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang if (this == obj) { 6127bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang return true; 6227bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang } 6327bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang if (obj == null || getClass() != obj.getClass()) { 6427bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang return false; 6527bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang } 6627bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang AdvertiseClient other = (AdvertiseClient) obj; 6727bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang return clientIf == other.clientIf; 6827bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang } 6927bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang 7027bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang @Override 7127bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang public int hashCode() { 7227bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang return Objects.hash(clientIf); 7327bd5f277ccf471f2fa9cd9151a2a226b51bc825Wei Wang } 741a2f87a202a4d634f0b6b5b6e9a8545796207288Wei Wang} 75