Skip to content

A lightweight Bluetooth scan/connect client for Android applications.

License

Notifications You must be signed in to change notification settings

wanglikun7342/Hydra

Repository files navigation

Hydra Hydrahydrapr welcome

A lightweight Bluetooth scan/connect client for Android applications.

1. Dependency

dependencies {
	...
	implementation 'com.eric.hydra:hydra:1.0.0'
	...
}

Please use the lastest release

2. Guide

  • Request a scan
Request request = Request.Builder()
        .timeout(1000)
        .build();
HydraClient client = new HydraClient();
client.scan(request, new Callback() {
    @Override
    public void onInterrupt(Error error) {
    }

    @Override
    public void onResponse(Response response) {
    }
});
  • Remove a scan
client.removeScan(request)
  • Create a connect session
Session session = new Session(response.getDevice());
session.connect(context);
  • Communication with connect session
session.registerCallback(new SessionCallback() {
    @Override
    public void onCharacteristicWrite(Session session, BluetoothGattCharacteristic characteristic, int status) {

    }
});
session.writeCharacteristic(characteristic);

About

A lightweight Bluetooth scan/connect client for Android applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published