code: function stopScan(stateChange, error) {
              if (node.scanning) {
                  // send status message
                  var msg = {
                      statusUpdate: true,
                      error: error,
                      stateChange: stateChange,
                      state: noble.state
                  };
                  node.send(msg);
                  // stop the scan
                  noble.stopScanning(function() {
                      node.log('BLE scanning stopped.');
                      node.status({fill:"red",shape:"ring",text:"stopped"});
                      node.scanning = false;
                  });
                  if (error) {
                      node.warn('BLE scanning stopped due to change in adapter state.');
                  }
              }
          }
docs: Take care of stopping the scan and sending the status message