Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value sent several times on read request #452

Open
abelhoui opened this issue May 4, 2020 · 3 comments
Open

value sent several times on read request #452

abelhoui opened this issue May 4, 2020 · 3 comments

Comments

@abelhoui
Copy link

abelhoui commented May 4, 2020

Hi all,

I've been working on bleno to implement a peripheral BLE device, and i'm now facing a problem when i execute the read request from my phone using a ble scanner app, to read a characteristic value from my peripheral device which is a rpi running a BLE peripheral demo using bleno : the value is sent several times when the value size exceeds some particular number of bytes !!!

  • Here i present two cases where one is working fine and the second is beiig sent several times:
    ++++exemple 1:

`var vehicle_id = 'ivESK_Wagen 1.03'

var vehicle_id_buf = Buffer.from(vehicle_id);

VehicleIDCharacteristic.prototype.onReadRequest = function(offset, callback) {
callback(this.RESULT_SUCCESS, vehicle_id_buf);
};
`
++++exemple 2:

`var vehicle_id = 'ivESK_Wagen 1.03 : here we are running a read test for the vehicle_id read operation'

var vehicle_id_buf = Buffer.from(vehicle_id);

VehicleIDCharacteristic.prototype.onReadRequest = function(offset, callback) {
callback(this.RESULT_SUCCESS, vehicle_id_buf);
};
`

  • Is there a specification for a limited number of bytes to be sent? am I missing sth?

Thanks !

@aptarmy
Copy link

aptarmy commented Oct 2, 2020

Any update on this? I am facing the same issue on my Raspi Zero W. With few bytes response onRead, the library works very well, but if Raspi peripheral response is exceeded some number of bytes, onRead method get called several times.

@abelhoui
Copy link
Author

abelhoui commented Oct 5, 2020

Any update on this? I am facing the same issue on my Raspi Zero W. With few bytes response onRead, the library works very well, but if Raspi peripheral response is exceeded some number of bytes, onRead method get called several times.

Heyy @aptarmy yeah that's due to Ble limitation you cannot send more than 21 bytes at time so you should use fragmentation for that. check the link below:
https://github.com/noble/bleno/blob/master/test.js#L36

@aptarmy
Copy link

aptarmy commented Oct 16, 2020

Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants