question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bleno cant send 256 bytes on dynamic read and notify

See original GitHub issue

When i try to send 256 bytes using dynamic read or notification using bleno, the other end (Android or noble) receives only 22 bytes. See code below.

However, when 256 bytes are sent using a static readonly characteristic, all 256 bytes are received properly.

The BLE spec says characteristic values can be 512 bytes.

Is this a bug?

Environment: bleno: Macbook pro with Mavericks. Node v0.10.24 noble: Ubuntu 13 desktop with Node v0.10.24 android: API 19, Nexus 4

var chars = [];
for(var i = 0; i < 256; i++) {
    chars.push('a');
}

var StaticReadOnlyCharacteristic = function() {
    StaticReadOnlyCharacteristic.super_.call(this, {
        uuid: 'fffffffffffffffffffffffffffffff1',
        properties: ['read'],
        value: new Buffer(chars.join('')),
        descriptors: [
            new Descriptor({
                uuid: '2901',
                value: 'user description'
            })
        ]
    });
};
util.inherits(StaticReadOnlyCharacteristic, Characteristic);

var DynamicReadOnlyCharacteristic = function() {
    DynamicReadOnlyCharacteristic.super_.call(this, {
        uuid: 'fffffffffffffffffffffffffffffff2',
        properties: ['read']
    });
};

util.inherits(DynamicReadOnlyCharacteristic, Characteristic);

DynamicReadOnlyCharacteristic.prototype.onReadRequest = function(offset, callback) {
    console.log("on -> readRequest");
    var result = this.RESULT_SUCCESS;
    var data = new Buffer(chars.join(''));

    if (offset > data.length) {
        result = this.RESULT_INVALID_OFFSET;
        data = null;
    }

    callback(result, data);
};

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
sandeepmistrycommented, Jan 16, 2014

MTU negotiation is handled by CoreBluetooth/blued on OS X, it’s always 23 from what I’ve seen. We’re stuck with this for unless Apple makes some changes.

Looks like CoreBluetooth/blued doesn’t handle long read characteristics. Typically, if the read response is the MTU size, the central would do another read with an offset to check if there is remaining data. I can look at having a bleno.mtu property or passing the MTU as an argument to the onReadRequest callback - but I don’t think either will help you. What stack are you using for your central?

0reactions
sandeepmistrycommented, May 17, 2014

@aravindanr closing for now, please re-open if you have more info.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android BLE client only returns 600 byte of data in ...
The MTU is adjusted to 256 bytes. Which I reflected on the server when reading the list. The call itself works fine and...
Read more >
bleno
A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals. Latest version: 0.5.0, last published: 5 years ago.
Read more >
How to Use Node.js to Speed Up BLE App Development
You can use bleno, a Node.js module, to mock out a BLE peripheral and get ... to send on read and notify events...
Read more >
BreakMi: Reversing, Exploiting and Fixing Xiaomi ... - HexHive
The client sends read, write, and notification requests to the server. The server answers accordingly to the request type and the availability ...
Read more >
Untitled
R1390 rodenstock, Download malwarebytes premium. ... Omar douglas vs frank de alba, Ocz technology vertex 4 256gb, Jeff grabarkiewicz, Keyrouz number, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found