1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 13:26:50 +01:00

Fix connection on GBX-100

This commit is contained in:
Andreas Böhler 2021-09-23 07:09:15 +02:00 committed by Gitea
parent 2d96328d1b
commit 264b003809
4 changed files with 10 additions and 3 deletions

View File

@ -737,7 +737,8 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
intent.putExtra(DeviceCoordinator.EXTRA_DEVICE_CANDIDATE, deviceCandidate);
startActivity(intent);
} else {
if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_NONE) {
if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_NONE ||
coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_LAZY) {
LOG.info("No bonding needed, according to coordinator, so connecting right away");
BondingUtil.connectThenComplete(this, deviceCandidate);
return;

View File

@ -70,6 +70,11 @@ public interface DeviceCoordinator {
*/
int BONDING_STYLE_REQUIRE_KEY = 3;
/**
* Lazy pairing, i.e. device initiated pairing is requested
*/
int BONDING_STYLE_LAZY = 4;
/**
* Checks whether this coordinator handles the given candidate.
* Returns the supported device type for the given candidate or

View File

@ -61,7 +61,7 @@ public class CasioGBX100DeviceCoordinator extends AbstractDeviceCoordinator {
@Override
public int getBondingStyle(){
return BONDING_STYLE_NONE;
return BONDING_STYLE_LAZY;
}
@Override

View File

@ -190,7 +190,8 @@ public class BondingUtil {
*/
public static void initiateCorrectBonding(final BondingInterface bondingInterface, final GBDeviceCandidate deviceCandidate) {
int bondingStyle = DeviceHelper.getInstance().getCoordinator(deviceCandidate).getBondingStyle();
if (bondingStyle == DeviceCoordinator.BONDING_STYLE_NONE) {
if (bondingStyle == DeviceCoordinator.BONDING_STYLE_NONE ||
bondingStyle == DeviceCoordinator.BONDING_STYLE_LAZY ) {
// Do nothing
return;
} else if (bondingStyle == DeviceCoordinator.BONDING_STYLE_ASK) {