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

Merge this small changes with the "/sandbox/rzr/abandonware/review/master" in order to release it as @abadonware/bleno on npm #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions lib/hci-socket/hci.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Hci.prototype.resetBuffers = function() {
this._handleAclsInProgress = {};
this._handleBuffers = {};
this._aclOutQueue = [];
}
};

Hci.prototype.pollIsDevUp = function() {
var isDevUp = this._socket.isDevUp();
Expand Down Expand Up @@ -146,7 +146,7 @@ Hci.prototype.initDev = function() {
this.readLeHostSupported();
this.readBdAddr();
this.leReadBufferSize();
}
};

Hci.prototype.setSocketFilter = function() {
var filter = new Buffer(14);
Expand Down Expand Up @@ -467,14 +467,14 @@ Hci.prototype.pushAclOutQueue = function() {
debug("\tin progress = " + inProgress);
debug("\twaiting = " + this._aclOutQueue.length);
}
}
};

Hci.prototype.writeOneAclDataPkt = function() {
var pkt = this._aclOutQueue.shift();
this._handleAclsInProgress[pkt.handle]++;
debug('write acl data pkt frag ' + pkt.fragId + ' handle ' + pkt.handle + ' - writing: ' + pkt.pkt.toString('hex'));
this._socket.write(pkt.pkt);
}
};

Hci.prototype.onSocketData = function(data) {
debug('onSocketData: ' + data.toString('hex'));
Expand Down Expand Up @@ -550,22 +550,22 @@ Hci.prototype.onSocketData = function(data) {
this.processLeMetaEvent(leMetaEventType, leMetaEventStatus, leMetaEventData);
} else if (subEventType === EVT_NUMBER_OF_COMPLETED_PACKETS) {
var handles = data.readUInt8(3);
for (var i = 0; i < handles; i++) {
var handle = data.readUInt16LE(4 + i * 4);
var pkts = data.readUInt16LE(6 + i * 4);
debug("\thandle = " + handle);
for (var j = 0; j < handles; j++) {
var handle_ = data.readUInt16LE(4 + j * 4);
var pkts = data.readUInt16LE(6 + j * 4);
debug("\thandle = " + handle_);
debug("\t\tcompleted = " + pkts);
if (this._handleAclsInProgress[handle] === undefined) {
if (this._handleAclsInProgress[handle_] === undefined) {
debug("\t\talready closed");
continue;
}
if (pkts > this._handleAclsInProgress[handle]) {
if (pkts > this._handleAclsInProgress[handle_]) {
// Linux kernel may send acl packets by itself, so be ready for underflow
this._handleAclsInProgress[handle] = 0;
this._handleAclsInProgress[handle_] = 0;
} else {
this._handleAclsInProgress[handle] -= pkts;
this._handleAclsInProgress[handle_] -= pkts;
}
debug("\t\tin progress = " + this._handleAclsInProgress[handle]);
debug("\t\tin progress = " + this._handleAclsInProgress[handle_]);
}
this.pushAclOutQueue();
}
Expand Down Expand Up @@ -712,7 +712,7 @@ Hci.prototype.processLeReadBufferSize = function(result) {
this._aclMtu = aclMtu;
this._aclMaxInProgress = aclMaxInProgress;
}
}
};

Hci.prototype.processLeMetaEvent = function(eventType, status, data) {
if (eventType === EVT_LE_CONN_COMPLETE) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bleno",
"version": "0.5.0",
"name": "@abandonware/bleno",
"version": "0.5.0-1",
"description": "A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals",
"main": "index.js",
"engines": {
Expand Down