 +BlenoBindings.prototype.onServiceStarted = function(status) {
 +  log.debug('onServiceStarted', status);
 +
-+  assert(this.pendingSetServices);
++  if (!this.pendingSetServices) {
++    log.warn('Adapter reset while starting service');
++    return;
++  }
++
 +  assert(this.serviceHandle !== null);
++  assert(!this.pendingAttributes);
 +
 +  this.pendingSetServices = null;
-+  this.pendingAttributes = null;
 +
 +  if (status) {
 +    const error = new Error('Failed to start service, status ' + status);

From de8e87c162ad8bdce428421ff000aafe72d7484f Mon Sep 17 00:00:00 2001
From: Ben Turner <bent@silklabs.com>
Date: Thu, 16 Jun 2016 14:29:54 -0700
Subject: [PATCH] Android Bluedroid bindings

---
 Android.mk                        |   7 +
 lib/android/bindings.js           | 837 ++++++++++++++++++++++++++++++++++++++
 lib/android/ccc-descriptor.js     | 196 +++++++++
 lib/android/descriptor-wrapper.js |  92 +++++
 lib/bleno.js                      |  20 +-
 lib/characteristic.js             |   2 +
 package.json                      |   6 +-
 7 files changed, 1149 insertions(+), 11 deletions(-)
 create mode 100644 Android.mk
 create mode 100644 lib/android/bindings.js
 create mode 100644 lib/android/ccc-descriptor.js

+include $(BUILD_NODE_MODULE)
diff --git a/lib/android/bindings.js b/lib/android/bindings.js
new file mode 100644
index 0000000..b32a80c
--- /dev/null
+++ b/lib/android/bindings.js
@@ -0,0 +1,851 @@
+'use strict';
+
+const assert = require('assert');
