![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Easy to use Node.js Bluez5 D-Bus library.
Required Packages for dbus:
npm install bluez
const Bluez = require('bluez');
const bluetooth = new Bluez();
// Register callback for new devices
bluetooth.on('device', async (address, props) => {
console.log("[NEW] Device:", address, props.Name);
const dev = await bluetooth.getDevice(address);
dev.on("PropertiesChanged", (props) => {
console.log("[CHG] Device:", address, props);
});
});
bluetooth.init().then(async () => {
// listen on first bluetooth adapter
const adapter = await bluetooth.getAdapter();
await adapter.StartDiscovery();
console.log("Discovering");
}).catch(console.error);
Custom Agents and Profiles can be implemented by extending Agent / Profile base classes.
Then use bluez.registerAgent(agent, capability)
and bluez.registerProfile(profile, options)
to activate them.
Make sure the user that is running the node process has the necessary permissions for Bluetooth and System-DBus.
bluetooth
group.Have a look at the examples for more detailed usage information.
Older Bluez version should work, but might miss some functions. However I can not recommend using GATT with Bluez < 5.48.
Buffers
Bluez.registerDummyAgent
was renamed to Bluez.registerStaticKeyAgent
which takes a pin code as argumentBluez.getAllDevicesAddresses
was renamed to Bluez.getAllDevicesProps
which returns all properties not only the address.This package mostly reflects the Bluez-DBus API. You can find its documentation here.
Contains most management functions.
constructor(options?: BluezOptions): Bluez
options:
bus: DBus | undefined
: an existing DBus connection. Default: create new connectionservice: DBus.Service | string | null | undefined
: service where to register default Profiles / Agents. Default: null (connection local service)objectPath: string | undefined
: object path where to register default Profiles / Agents. Default: "/org/node/bluez"init(): Promise<void>
Initializes DBus and interfaces. MUST be called bevor any bluetooth interaction is done. Attach device event listeners first, because calling init() will emit device events for paired devices.
registerProfile(profile: Profile, options: ProfileOptions): Promise<void>
Registers a Profile Bluetooth Service.
For available options see Bluez Docs.
registerAgent(agent: Agent, capabilities: string): Promise<void>
Registers a Agent required for pairing.
For available options see Bluez Docs.
getDevice(address: string): Promise<Device|null>
Returns a Device for a given address.
address can be a adress in format XX:XX:XX:XX:XX:XX
or XX_XX_XX_XX_XX_XX
or /org/bluez/hciX/dev_XX_XX_XX_XX_XX_XX
findDevice(filterCb: (props: DeviceProps) => boolean): Promise<Device|null>
Search for a Device given a custom filter function
getAdapter(name?: string): Promise<Device>
Returns a Adapter either by name or of not supplied the first one available.
findAdapter(filterCb: (props: AdapterProps) => boolean): Promise<Adapter|null>
Search for a Adapter given a custom filter function
on("device", address: string, props: DeviceProperties)
Emitted if a device was discovered.
Note that for paired devices this will be emitted no matter if the devices are in range or not.
An Adapter represents a local Bluetooth adapter.
constructor(interface: DBus.Interface): Adapter
interface is the DBus Interface corresponding the the Adapter.
Should not be called directly. Use Bluez.getAdapter()
.
For available methods and properties see Bluez Docs.
An Agent is required for pairing with devices.
This default implementation accepts every pair request and has the passkey 1234
constructor(bluez: Bluez, DBusObject: DBus.ServiceObject): Agent
DBusObject is the DBus Object under witch the interface should be registerd.
For available methods and properties see Bluez Docs.
A Device represents a remote Bluetooth device.
For available methods and properties see Bluez Docs.
constructor(interface: DBus.Interface): Device
interface is the DBus Interface corresponding the the Device.
Should not be called directly. Use Bluez.getDevice()
.
getService(uuid: string): Promise<Service | null>
Get a GATT Service of the Device.
For available methods and properties see Bluez Docs.
getCharacteristic(uuid: string): Promise<Characteristic | null>
Get a GATT Characteristic of the Service.
For available methods and properties see Bluez Docs.
getDescriptor(uuid: string): Promise<Descriptor | null>
Get a GATT Descriptor of the Characteristic.
For available methods and properties see Bluez Docs.
A Profile is a service provided by this Bluetooth device.
constructor(bluez: Bluez, DBusObject: DBus.ServiceObject): Profile
DBusObject is the DBus Object under witch the interface should be registerd.
For available methods and properties see Bluez Docs.
A Profile implementation for Serial communication.
constructor(bluez: Bluez, DBusObject: DBus.ServiceObject, listener: (device: Device, socket: RawFdSocket)=>void): SerialProfile
listener is a callback that is called for each new connection to the Profile. Its socket parameter is the established channel between the two devices.
FAQs
Bluez5 D-Bus library for easy to use bluetooth access in node
The npm package bluez receives a total of 3 weekly downloads. As such, bluez popularity was classified as not popular.
We found that bluez demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.