@Ignore("https: @Test public void testOnStartFailure() throws Exception { mBleAdvertiser.setAdvertiseData(mMockAdvertiseData); mBleAdvertiser.start(); mBleAdvertiser.onStartFailure(AdvertiseCallback.ADVERTISE_FAILED_ALREADY_STARTED); verify(mMockListener, times(1)).onIsAdvertiserStartedChanged(false); verify(mMockListener, times(1)).onAdvertiserFailedToStart( AdvertiseCallback.ADVERTISE_FAILED_ALREADY_STARTED); }
@Override public void onStartFailure(int errorCode) { String reason = ""; Log.d(TAG, "onStartFailure: " + ThreadUtils.currentThreadToString()); switch (errorCode) { case ADVERTISE_FAILED_ALREADY_STARTED: reason = "Advertising is already started"; break; case ADVERTISE_FAILED_DATA_TOO_LARGE: reason = "The advertise data to be broadcast is larger than 31 bytes"; break; case ADVERTISE_FAILED_FEATURE_UNSUPPORTED: reason = "This feature is not supported on this platform"; break; case ADVERTISE_FAILED_INTERNAL_ERROR: reason = "Operation failed due to an internal error"; break; case ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: reason = "No advertising instance is available"; break; default: reason = "Unknown error"; break; } Log.e(TAG, "onStartFailure: " + reason + ", error code is " + errorCode); setState(State.NOT_STARTED, true); if (mListener != null) { mListener.onAdvertiserFailedToStart(errorCode); } }
BleAdvertiser extends AdvertiseCallback { @Override public void onStartFailure(int errorCode) { String reason = ""; Log.d(TAG, "onStartFailure: " + ThreadUtils.currentThreadToString()); switch (errorCode) { case ADVERTISE_FAILED_ALREADY_STARTED: reason = "Advertising is already started"; break; case ADVERTISE_FAILED_DATA_TOO_LARGE: reason = "The advertise data to be broadcast is larger than 31 bytes"; break; case ADVERTISE_FAILED_FEATURE_UNSUPPORTED: reason = "This feature is not supported on this platform"; break; case ADVERTISE_FAILED_INTERNAL_ERROR: reason = "Operation failed due to an internal error"; break; case ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: reason = "No advertising instance is available"; break; default: reason = "Unknown error"; break; } Log.e(TAG, "onStartFailure: " + reason + ", error code is " + errorCode); setState(State.NOT_STARTED, true); if (mListener != null) { mListener.onAdvertiserFailedToStart(errorCode); } } }
BleAdvertiser extends AdvertiseCallback { @Override public void onStartFailure(int errorCode) { String reason = ""; Log.d(TAG, "onStartFailure: " + ThreadUtils.currentThreadToString()); switch (errorCode) { case ADVERTISE_FAILED_ALREADY_STARTED: reason = "Advertising is already started"; break; case ADVERTISE_FAILED_DATA_TOO_LARGE: reason = "The advertise data to be broadcast is larger than 31 bytes"; break; case ADVERTISE_FAILED_FEATURE_UNSUPPORTED: reason = "This feature is not supported on this platform"; break; case ADVERTISE_FAILED_INTERNAL_ERROR: reason = "Operation failed due to an internal error"; break; case ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: reason = "No advertising instance is available"; break; default: reason = "Unknown error"; break; } Log.e(TAG, "onStartFailure: " + reason + ", error code is " + errorCode); setState(State.NOT_STARTED, true); if (mListener != null) { mListener.onAdvertiserFailedToStart(errorCode); } } BleAdvertiser(Listener listener, BluetoothAdapter bluetoothAdapter);   BleAdvertiser(Listener listener, BluetoothAdapter bluetoothAdapter,
                  AdvertiseSettings.Builder builder, DiscoveryManagerSettings settings); }
BleAdvertiser extends AdvertiseCallback { @Override public void onStartFailure(int errorCode) { String reason = ""; Log.d(TAG, "onStartFailure: " + ThreadUtils.currentThreadToString()); switch (errorCode) { case ADVERTISE_FAILED_ALREADY_STARTED: reason = "Advertising is already started"; break; case ADVERTISE_FAILED_DATA_TOO_LARGE: reason = "The advertise data to be broadcast is larger than 31 bytes"; break; case ADVERTISE_FAILED_FEATURE_UNSUPPORTED: reason = "This feature is not supported on this platform"; break; case ADVERTISE_FAILED_INTERNAL_ERROR: reason = "Operation failed due to an internal error"; break; case ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: reason = "No advertising instance is available"; break; default: reason = "Unknown error"; break; } Log.e(TAG, "onStartFailure: " + reason + ", error code is " + errorCode); setState(State.NOT_STARTED, true); if (mListener != null) { mListener.onAdvertiserFailedToStart(errorCode); } } BleAdvertiser(Listener listener, BluetoothAdapter bluetoothAdapter);   BleAdvertiser(Listener listener, BluetoothAdapter bluetoothAdapter,
                  AdvertiseSettings.Builder builder, DiscoveryManagerSettings settings); void setAdvertiseSettings(AdvertiseSettings advertiseSettings); boolean isStarted(); synchronized boolean start(); synchronized void stop(boolean notifyStateChanged); @Override void onStartFailure(int errorCode); @Override void onStartSuccess(AdvertiseSettings settingsInEffect); }
BleAdvertiser extends AdvertiseCallback { @Override public void onStartFailure(int errorCode) { String reason = ""; Log.d(TAG, "onStartFailure: " + ThreadUtils.currentThreadToString()); switch (errorCode) { case ADVERTISE_FAILED_ALREADY_STARTED: reason = "Advertising is already started"; break; case ADVERTISE_FAILED_DATA_TOO_LARGE: reason = "The advertise data to be broadcast is larger than 31 bytes"; break; case ADVERTISE_FAILED_FEATURE_UNSUPPORTED: reason = "This feature is not supported on this platform"; break; case ADVERTISE_FAILED_INTERNAL_ERROR: reason = "Operation failed due to an internal error"; break; case ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: reason = "No advertising instance is available"; break; default: reason = "Unknown error"; break; } Log.e(TAG, "onStartFailure: " + reason + ", error code is " + errorCode); setState(State.NOT_STARTED, true); if (mListener != null) { mListener.onAdvertiserFailedToStart(errorCode); } } BleAdvertiser(Listener listener, BluetoothAdapter bluetoothAdapter);   BleAdvertiser(Listener listener, BluetoothAdapter bluetoothAdapter,
                  AdvertiseSettings.Builder builder, DiscoveryManagerSettings settings); void setAdvertiseSettings(AdvertiseSettings advertiseSettings); boolean isStarted(); synchronized boolean start(); synchronized void stop(boolean notifyStateChanged); @Override void onStartFailure(int errorCode); @Override void onStartSuccess(AdvertiseSettings settingsInEffect);  }