标签: bleno

覆盆子BLE外围设备替代bleno

到目前为止,我已经开发了几个程序,用于我的Raspberry Rpi2和RPi3,作为使用bleno的 BLE perifpherals.有没有人可以告诉我,如果有替代Bleno的东西,在Python中甚至更好用C语言,为我的Raspberry开发BLE外围设备服务的代码?

python peripherals bluetooth-lowenergy bleno

16
推荐指数
1
解决办法
2598
查看次数

Android BLE 客户端仅在 onCharacteristicRead 中返回 600 字节的数据

我有一个蓝牙服务器,它使用 bleno 并向客户端返回可用 Wifi 网络的列表。的代码readCharacteristic看起来基本上是这样的:

class ReadCharacteristic extends bleno.Characteristic {

constructor(uuid, name, action) {
    super({
        uuid: uuid,
        properties: ["read"],
        value: null,
        descriptors: [
            new bleno.Descriptor({
                uuid: "2901",
                value: name
              })
        ]
    });
    this.actionFunction = action;
}

onReadRequest(offset, callback) {
    console.log("Offset: " + offset);

if(offset === 0) {
        const result = this.actionFunction();
    result.then(value => {
        this.actionFunctionResult = value;
            const data = new Buffer.from(value).slice(0,bleno.mtu);
            console.log("onReadRequest: " + data.toString('utf-8'));

            callback(this.RESULT_SUCCESS, data);
        }, err => {
            console.log("onReadRequest error: " + err);
            callback(this.RESULT_UNLIKELY_ERROR); …
Run Code Online (Sandbox Code Playgroud)

javascript android bluetooth-lowenergy android-bluetooth bleno

7
推荐指数
1
解决办法
1820
查看次数

外设自身改变特征值时如何实现更新值回调

假设外设正在侦听某些套接字或管道,我正在其中发送一个值,该值将修改特性。如何将更改通知中央设备?外围设备和中央设备都在Linux平台上运行。因为任何给Linux设备的Pizza示例都将在Central正在编写内容时通知Central。假设如果值由Bleno以外的某个程序更改,那我应该在哪里实现updateValueCallback()?是开onSubscribe还是onNotify

bleno

1
推荐指数
1
解决办法
2779
查看次数