BlePeerDiscoverer implements BleAdvertiser.Listener, BleScanner.Listener { public void setBluetoothMacAddress(String myBluetoothMacAddress) { if (BluetoothUtils.isValidBluetoothMacAddress(myBluetoothMacAddress)) { Log.d(TAG, "setBluetoothMacAddress: " + myBluetoothMacAddress); mMyBluetoothMacAddress = myBluetoothMacAddress; mOurRequestId = null; } else { Log.e(TAG, "setBluetoothMacAddress: The given Bluetooth MAC address is invalid: " + myBluetoothMacAddress); } } BlePeerDiscoverer(
            BlePeerDiscoveryListener listener, BluetoothAdapter bluetoothAdapter,
            UUID serviceUuid, UUID provideBluetoothMacAddressRequestUuid,
            String myBluetoothMacAddress,
            AdvertisementData advertisementData);   BlePeerDiscoverer(BlePeerDiscoveryListener listener, BluetoothAdapter bluetoothAdapter,
                      UUID serviceUuid, UUID provideBluetoothMacAddressRequestUuid,
                      String myBluetoothMacAddress, AdvertisementData advertisementData,
                      BleAdvertiser bleAdvertiser, BleScanner bleScanner); static UUID generateNewProvideBluetoothMacAddressRequestUuid(UUID serviceUuid); EnumSet<BlePeerDiscovererStateSet> getState(); String getProvideBluetoothMacAddressRequestId(); String getBluetoothMacAddress(); void setBluetoothMacAddress(String myBluetoothMacAddress); boolean applySettings(AdvertisementData advertisementData, int advertiseMode,
                                 int advertiseTxPowerLevel, int scanMode, long scanReportDelayInMilliseconds); synchronized boolean startScanner(); synchronized void stopScanner(); synchronized boolean startAdvertiser(); synchronized void stopAdvertiser(); synchronized boolean startScannerAndAdvertiser(); synchronized void stopScannerAndAdvertiser(); synchronized boolean startPeerAddressHelperAdvertiser(
            final String requestId, String bluetoothMacAddress, long durationInMilliseconds); @Override void onAdvertiserFailedToStart(int errorCode); @Override void onIsAdvertiserStartedChanged(boolean isStarted); @Override void onScannerFailed(int errorCode); @Override void onIsScannerStartedChanged(boolean isStarted); @Override void onScanResult(ScanResult result); @Override void onBatchScanResults(List<ScanResult> results); void releaseListener();  }
@Test public void testSetBluetoothMacAddress() throws Exception { String validMacAddress = "00:11:22:33:44:55"; String invalidMacAddress = "I:N:V:A:L:I:D"; blePeerDiscoverer.setBluetoothMacAddress(validMacAddress); assertThat("The Bluetooth MAC address set to this instance is properly returned", blePeerDiscoverer.getBluetoothMacAddress(), is(validMacAddress)); assertThat("The \"provide Bluetooth MAC address\" request ID is null", blePeerDiscoverer.getProvideBluetoothMacAddressRequestId(), is(nullValue())); blePeerDiscoverer.setBluetoothMacAddress(invalidMacAddress); assertThat("The Bluetooth MAC address set to this instance is properly returned", blePeerDiscoverer.getBluetoothMacAddress(), is(validMacAddress)); }