New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ssb-mobile-bluetooth-manager

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-mobile-bluetooth-manager - npm Package Compare versions

Comparing version 2.0.22 to 2.0.23

108

index.js

@@ -15,4 +15,8 @@ const net = require('net');

const EventEmitter = require('events');
function makeManager (opts) {
const bluetoothScanStateEmitter = new EventEmitter();
if (!opts || !opts.socketFolderPath) {

@@ -26,2 +30,8 @@ throw new Error("ssb-mobile-bluetooth-manager must be configured with a socketFolderPath option.");

const EVENT_STARTED_SCAN = "startedBluetoothScan";
const EVENT_FOUND_BLUETOOTH_DEVICES = "btDevicesFound";
const EVENT_FINISHED_FINDING_BLUETOOTH_DEVICES = "endedBluetoothScan";
const EVENT_CHECKING_DEVICES = "checkingForScuttlebutt";
const EVENT_ENDED_CHECKING = "endedChecking";
const awaitingConnection = Pushable();

@@ -209,2 +219,5 @@ const outgoingConnectionsEstablished = Pushable();

}
bluetoothScanStateEmitter.emit(EVENT_FOUND_BLUETOOTH_DEVICES, nearBy);
bluetoothScanStateEmitter.emit(EVENT_FINISHED_FINDING_BLUETOOTH_DEVICES);

@@ -338,5 +351,4 @@ awaitingDevicesCb(null, nearBy);

count = count + 1;
debug("getValidAddresses count: " + count);
debug("getValidAddresses count: " + count)
if (!err) {

@@ -351,4 +363,13 @@ debug(device.remoteAddress + " is available for scuttlebutt bluetooth connections");

debug("Valid addresses:");
debug(results);
debug(results);
bluetoothScanStateEmitter.emit(EVENT_CHECKING_DEVICES, {
"checked": count,
"total": devices.length,
"discovered": results,
"found": results.length,
"remaining": (devices.length - count),
"lastUpdate": Date.now()
});
cb(null, {

@@ -358,6 +379,15 @@ "discovered": results,

});
} else {
bluetoothScanStateEmitter.emit(EVENT_CHECKING_DEVICES, {
"checked": count,
"total": devices.length,
"discovered": results,
"found": results.length,
"remaining": (devices.length - count),
"lastUpdate": Date.now()
});
}
});
}, num * 2000);
}, num * 1000);
})

@@ -370,6 +400,11 @@ }

pull.asyncMap( (result, cb) => {
debug("Result is? ");
debug("Nearby bluetooth devices.");
debug(result);
getValidAddresses(result.discovered, cb)
}),
pull.map(result => {
bluetoothScanStateEmitter.emit(EVENT_ENDED_CHECKING, result);
return result;
})

@@ -385,2 +420,3 @@ )

setTimeout(() => {
bluetoothScanStateEmitter.emit(EVENT_STARTED_SCAN);
getLatestNearbyDevices(cb)

@@ -481,2 +517,63 @@ }, refreshInterval)

function bluetoothScanState() {
var source = Pushable(function (closed) {
bluetoothScanStateEmitter.removeListener(onScanStarted);
bluetoothScanStateEmitter.removeListener(onBtDevicesFound);
bluetoothScanStateEmitter.removeListener(onFinishedFindingBluetoothDevices);
bluetoothScanStateEmitter.removeListener(onCheckingDevices);
bluetoothScanStateEmitter.removeListener(onFinishedCheckingDevices);
});
function onScanStarted() {
var event = {
"state": EVENT_STARTED_SCAN
}
source.push(event);
};
function onBtDevicesFound (devices) {
var event = {
"state": EVENT_FOUND_BLUETOOTH_DEVICES,
"update": devices
}
source.push(event);
}
function onFinishedFindingBluetoothDevices() {
var event = {
"state": EVENT_FINISHED_FINDING_BLUETOOTH_DEVICES
}
source.push(event);
}
function onCheckingDevices (update) {
var event = {
"state": EVENT_CHECKING_DEVICES,
"update": update
}
source.push(event);
}
function onFinishedCheckingDevices() {
var event = {
"state": EVENT_ENDED_CHECKING
}
source.push(event);
}
bluetoothScanStateEmitter.on(EVENT_STARTED_SCAN, onScanStarted);
bluetoothScanStateEmitter.on(EVENT_FOUND_BLUETOOTH_DEVICES, onBtDevicesFound);
bluetoothScanStateEmitter.on(EVENT_FINISHED_FINDING_BLUETOOTH_DEVICES, onFinishedFindingBluetoothDevices);
bluetoothScanStateEmitter.on(EVENT_CHECKING_DEVICES, onCheckingDevices);
bluetoothScanStateEmitter.on(EVENT_ENDED_CHECKING, onFinishedCheckingDevices);
return source;
}
function getOwnMacAddress(cb) {

@@ -543,2 +640,3 @@ if (awaitingOwnMacAddressResponse) {

nearbyDevices,
bluetoothScanState,
nearbyScuttlebuttDevices,

@@ -545,0 +643,0 @@ makeDeviceDiscoverable,

3

package.json
{
"name": "ssb-mobile-bluetooth-manager",
"version": "2.0.22",
"version": "2.0.23",
"description": "A module for managing bluetooth connections over a react native bridge.",

@@ -18,2 +18,3 @@ "main": "index.js",

"pull-json-doubleline": "^2.0.0",
"pull-pushable": "^2.2.0",
"pull-stream": "^3.6.9",

@@ -20,0 +21,0 @@ "pull-zip": "^2.0.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc