Skip to content

Commit

Permalink
chore: cosmetics to build a mr
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Serafin committed Sep 24, 2024
1 parent e0fef9e commit 819a78a
Show file tree
Hide file tree
Showing 4 changed files with 4,145 additions and 13,032 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Sandeep Mistry
Copyright (c) 2024 Marek Serafin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# node-bluetooth-hci-socket

[![GitHub forks](
https://img.shields.io/github/forks/abandonware/node-bluetooth-hci-socket.svg?style=social&label=Fork&maxAge=2592000
https://img.shields.io/github/forks/stoprocent/node-bluetooth-hci-socket.svg?style=social&label=Fork&maxAge=2592000
)](
https://GitHub.com/abandonware/node-bluetooth-hci-socket/network/
https://GitHub.com/stoprocent/node-bluetooth-hci-socket/network/
)
[![license](
https://img.shields.io/badge/license-MIT-0.svg
)](MIT)
[![NPM](
https://img.shields.io/npm/v/@abandonware/bluetooth-hci-socket.svg
https://img.shields.io/npm/v/@stoprocent/bluetooth-hci-socket.svg
)](
https://www.npmjs.com/package/@abandonware/bluetooth-hci-socket
https://www.npmjs.com/package/@stoprocent/bluetooth-hci-socket
)
[![Fediverse](
https://img.shields.io/mastodon/follow/279303?domain=https%3A%2F%2Fmastodon.social&style=social#rzr
Expand All @@ -26,7 +26,7 @@ https://kiwiirc.com/client/irc.libera.chat/#iot

Bluetooth HCI socket binding for Node.js

__NOTE:__ Currently only supports __Linux__, __FreeBSD__ and __Windows__.
__NOTE:__ Currently only supports __Linux__, __FreeBSD__, __Windows__ or any operating systems when using HCI over uart.

## Prerequisites

Expand Down Expand Up @@ -88,13 +88,13 @@ Note:
## Install

```sh
npm install @abandonware/bluetooth-hci-socket
npm install @stoprocent/bluetooth-hci-socket
```

## Usage

```javascript
var BluetoothHciSocket = require('@abandonware/bluetooth-hci-socket');
var BluetoothHciSocket = require('@stoprocent/bluetooth-hci-socket');
```

### Actions
Expand Down Expand Up @@ -200,7 +200,7 @@ bluetoothHciSocket.on('error', function(error) {

## Examples

See [examples folder](https://github.com/abandonware/node-bluetooth-hci-socket/blob/master/examples) for code examples.
See [examples folder](https://github.com/stoprocent/node-bluetooth-hci-socket/blob/master/examples) for code examples.

## Platform Notes

Expand Down
17 changes: 6 additions & 11 deletions lib/uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ class BluetoothHciSocket extends EventEmitter {
_getSerialParams (params) {
let port;
let baudRate = 1000000; // Default baud rate

// Check for UART port in environment variables
if (process.env.BLUETOOTH_HCI_SOCKET_UART_PORT) {
port = process.env.BLUETOOTH_HCI_SOCKET_UART_PORT;
}

// Check for UART baud rate in environment variables
if (process.env.BLUETOOTH_HCI_SOCKET_UART_BAUDRATE) {
var parsedBaudRate = parseInt(process.env.BLUETOOTH_HCI_SOCKET_UART_BAUDRATE, 10);
const parsedBaudRate = parseInt(process.env.BLUETOOTH_HCI_SOCKET_UART_BAUDRATE, 10);
if (!isNaN(parsedBaudRate)) {
baudRate = parsedBaudRate;
}
}

// Override with params if provided
if (params && params.uart) {
if (params.uart.port && typeof params.uart.port === 'string') {
Expand All @@ -109,13 +109,8 @@ class BluetoothHciSocket extends EventEmitter {
baudRate = params.uart.baudRate;
}
}

return {
uart: {
port: port,
baudRate: baudRate,
},
};

return { uart: { port, baudRate } };
}

bindControl () {
Expand Down
Loading

0 comments on commit 819a78a

Please sign in to comment.