diff options
author | Sven Gothel <[email protected]> | 2020-11-17 10:09:21 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-11-17 10:09:21 +0100 |
commit | 23b77ddb306722a8fe37e999bf1f7974612b99ed (patch) | |
tree | 6bb103a71b37a003657aaf0078e2e32909b21dc9 /java/org/tinyb | |
parent | 142a51decedf513b252db45dba3f317d788a80c7 (diff) |
Native/Java: Adjust PairingMode/State enum naming in code and API doc; Fix *Device::setPairingPasskey(..) and setPairingNumericComparison(..) API doc (act upon state)
PairingState::NUMERIC_COMPARISON_EXPECTED -> NUMERIC_COMPARE_EXPECTED
and use PairingMode::PASSKEY_ENTRY_ini, PairingMode::NUMERIC_COMPARE_ini in API doc.
Diffstat (limited to 'java/org/tinyb')
-rw-r--r-- | java/org/tinyb/AdapterStatusListener.java | 5 | ||||
-rw-r--r-- | java/org/tinyb/BluetoothDevice.java | 36 | ||||
-rw-r--r-- | java/org/tinyb/SMPPairingState.java | 8 |
3 files changed, 22 insertions, 27 deletions
diff --git a/java/org/tinyb/AdapterStatusListener.java b/java/org/tinyb/AdapterStatusListener.java index efb157af..d27439aa 100644 --- a/java/org/tinyb/AdapterStatusListener.java +++ b/java/org/tinyb/AdapterStatusListener.java @@ -115,13 +115,12 @@ public abstract class AdapterStatusListener { /** * An already connected {@link BluetoothDevice}'s {@link SMPPairingState} has changed. - * <p> - * If currentMode == {@link PairingMode#NONE}, the device is not paired, otherwise it is paired using the given {@link PairingMode}. - * </p> * @param device the device which {@link PairingMode} has been changed. * @param state the current {@link SMPPairingState} of the connected device, see DBTDevice::getCurrentPairingState() * @param mode the current {@link PairingMode} of the connected device, see DBTDevice::getCurrentPairingMode() * @param timestamp the time in monotonic milliseconds when this event occurred. See {@link BluetoothUtils#currentTimeMillis()}. + * @see BluetoothDevice#setPairingPasskey(int) + * @see BluetoothDevice#setPairingNumericComparison(boolean) */ public void devicePairingState(final BluetoothDevice device, final SMPPairingState state, final PairingMode mode, final long timestamp) {} diff --git a/java/org/tinyb/BluetoothDevice.java b/java/org/tinyb/BluetoothDevice.java index 3af372d2..871e14d2 100644 --- a/java/org/tinyb/BluetoothDevice.java +++ b/java/org/tinyb/BluetoothDevice.java @@ -194,23 +194,21 @@ public interface BluetoothDevice extends BluetoothObject boolean pair() throws BluetoothException; /** - * Method sets the given passkey entry, see {@link PairingMode#PASSKEY_ENTRY}. + * Method sets the given passkey entry, see {@link PairingMode#PASSKEY_ENTRY_ini}. * <p> - * Call this method if the device shall be securely paired with {@link PairingMode#PASSKEY_ENTRY}, - * when notified via {@link AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) devicePairingState}. - * <p> - * If returning {@link HCIStatusCode#SUCCESS}, caller shall continue listening to - * {@link AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) devicePairingState} - * to wait for either {@link SMPPairingState#PROCESS_COMPLETED} or {@link SMPPairingState#FAILED}. + * Call this method if the device shall be securely paired with {@link PairingMode#PASSKEY_ENTRY_ini}, + * i.e. when notified via {@link AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) devicePairingState} + * in state {@link SMPPairingState#PASSKEY_EXPECTED}. * </p> - * @param passkey used for {@link PairingMode#PASSKEY_ENTRY} method. + * + * @param passkey used for {@link PairingMode#PASSKEY_ENTRY_ini} method. * Will be encrypted before sending to counter-party. * * @return {@link HCIStatusCode#SUCCESS} if the command has been accepted, otherwise {@link HCIStatusCode} may disclose reason for rejection. * @see PairingMode * @see SMPPairingState * @see AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) - * @see #setPairingPasskey(String) + * @see #setPairingPasskey(int) * @see #setPairingNumericComparison(boolean) * @see #getPairingMode() * @see #getPairingState() @@ -220,23 +218,21 @@ public interface BluetoothDevice extends BluetoothObject HCIStatusCode setPairingPasskey(final int passkey); /** - * Method sets the numeric comparison result, see {@link PairingMode#NUMERIC_COMPARISON}. + * Method sets the numeric comparison result, see {@link PairingMode#NUMERIC_COMPARE_ini}. * <p> - * Call this method if the device shall be securely paired with {@link PairingMode#NUMERIC_COMPARISON}, - * when notified via {@link AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) devicePairingState}. - * <p> - * If returning {@link HCIStatusCode#SUCCESS}, caller shall continue listening to - * {@link AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) devicePairingState} - * to wait for either {@link SMPPairingState#PROCESS_COMPLETED} or {@link SMPPairingState#FAILED}. + * Call this method if the device shall be securely paired with {@link PairingMode#NUMERIC_COMPARE_ini}, + * i.e. when notified via {@link AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) devicePairingState} + * in state {@link SMPPairingState#NUMERIC_COMPARE_EXPECTED}. * </p> - * @param equal used for {@link PairingMode#NUMERIC_COMPARISON} method. + * + * @param equal used for {@link PairingMode#NUMERIC_COMPARE_ini} method. * Will be encrypted before sending to counter-party. * * @return {@link HCIStatusCode#SUCCESS} if the command has been accepted, otherwise {@link HCIStatusCode} may disclose reason for rejection. * @see PairingMode * @see SMPPairingState * @see AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) - * @see #setPairingPasskey(String) + * @see #setPairingPasskey(int) * @see #setPairingNumericComparison(boolean) * @see #getPairingMode() * @see #getPairingState() @@ -263,7 +259,7 @@ public interface BluetoothDevice extends BluetoothObject * @see PairingMode * @see SMPPairingState * @see AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) - * @see #setPairingPasskey(String) + * @see #setPairingPasskey(int) * @see #setPairingNumericComparison(boolean) * @see #getPairingMode() * @see #getPairingState() @@ -280,7 +276,7 @@ public interface BluetoothDevice extends BluetoothObject * @see PairingMode * @see SMPPairingState * @see AdapterStatusListener#devicePairingState(BluetoothDevice, SMPPairingState, PairingMode, long) - * @see #setPairingPasskey(String) + * @see #setPairingPasskey(int) * @see #setPairingNumericComparison(boolean) * @see #getPairingMode() * @see #getPairingState() diff --git a/java/org/tinyb/SMPPairingState.java b/java/org/tinyb/SMPPairingState.java index 77cb66b1..3d111bf9 100644 --- a/java/org/tinyb/SMPPairingState.java +++ b/java/org/tinyb/SMPPairingState.java @@ -63,10 +63,10 @@ public enum SMPPairingState { */ FEATURE_EXCHANGE_COMPLETED((byte)4), - /** Phase 2: Authentication (MITM) PASSKEY expected, see {@link PairingMode#PASSKEY_ENTRY} */ + /** Phase 2: Authentication (MITM) PASSKEY expected, see {@link PairingMode#PASSKEY_ENTRY_ini} */ PASSKEY_EXPECTED((byte)5), - /** Phase 2: Authentication (MITM) Numeric Comparison Reply expected, see {@link PairingMode#NUMERIC_COMPARISON} */ - NUMERIC_COMPARISON_EXPECTED((byte)6), + /** Phase 2: Authentication (MITM) Numeric Comparison Reply expected, see {@link PairingMode#NUMERIC_COMPARE_ini} */ + NUMERIC_COMPARE_EXPECTED((byte)6), /** Phase 2: Authentication (MITM) OOB data expected, see {@link PairingMode#OUT_OF_BAND} */ OOB_EXPECTED((byte)7), @@ -108,7 +108,7 @@ public enum SMPPairingState { case (byte) 0x03: return FEATURE_EXCHANGE_STARTED; case (byte) 0x04: return FEATURE_EXCHANGE_COMPLETED; case (byte) 0x05: return PASSKEY_EXPECTED; - case (byte) 0x06: return NUMERIC_COMPARISON_EXPECTED; + case (byte) 0x06: return NUMERIC_COMPARE_EXPECTED; case (byte) 0x07: return OOB_EXPECTED; case (byte) 0x08: return PROCESS_STARTED; case (byte) 0x09: return PROCESS_COMPLETED; |