admin管理员组文章数量:1550412
####初始化
bleManager = BleManager.getInstance();
bleManager.init(this);
####扫描指定名称设备、并连接
bleManager.connectDevice(
DEVICE_NAME,
TIME_OUT,
new BleManagerConnectCallback() {
@Override
public void onConnectSuccess(BluetoothGatt gatt, int status) {
Log.i(TAG, "连接成功!");
}
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
Log.i(TAG, "服务被发现!");
}
@Override
public void onConnectFailure(BleException exception) {
Log.i(TAG, "连接失败或连接中断:" + '\n' + exception.toString());
}
});
####notify
bleManager.notifyDevice(
UUID_SERVICE_LISTEN,
UUID_LISTEN_NOTIFY,
UUID_CLIENT_CHARACTERISTIC_CONFIG_DESCRIPTOR,
new B
版权声明:本文标题:android ble写成功的回调,GitHub - wolf0931FastBle: Android BLE 蓝牙开发框架,使用回调方式处理,搜索、连接、notify、indicate、读、写等一... 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1727246114a1104648.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论