![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@particle/device-control-ble
Advanced tools
A library for controlling Particle devices over BLE.
npm install @particle/device-control-ble @particle/device-constants --save
NOTE: @particle/device-control-ble
declares @particle/device-constants
as a peerDependency
- this ensures your app only ever has one copy of that dependency
A class implementing the Device OS control request protocol for BLE.
Kind: global class
String
Promise
Constructor.
Param | Type | Default | Description |
---|---|---|---|
options | Object | Options. | |
options.stream | Object | Transport stream. The stream object is expected to behave similarly to a Node's stream.Duplex in flowing mode. The only method of the stream.Duplex interface that has to be implemented by the stream is write() . The method's callback argument and return value are not used. All writes must be buffered by the stream. The channel will add listeners for the following stream events: data , end , finish , close , error . Half-closed streams are not supported, meaning that an end or a finish event emitted by the stream will result in the channel being closed immediately. | |
options.secret | String | Uint8Array | Device secret. | |
[options.concurrentRequests] | Number | 1 | Maximum number of requests that can be sent to the device concurrently. Requests attempted to be sent above this limit will be queued. |
[options.requestTimeout] | Number | 60000 | Default request timeout in milliseconds. |
[options.handshakeTimeout] | Number | 10000 | Handshake timeout in milliseconds. |
[options.env] | Env | defaultEnv() | Environment-specific functions. |
String
Channel state.
Possible values are new
, opening
, open
and closed
.
Kind: instance property of BleControlRequestChannel
Promise
Open the channel and initiate a handshake with the device.
An open
event will be emitted when the channel is open. Requests can still be enqueued for
sending via sendRequest()
while the channel is being opened.
The transport stream and the underlying BLE characteristics must be in a readable and writable state by the time this method is called.
A closed channel cannot be reopened.
Kind: instance method of BleControlRequestChannel
Close the channel.
A closed
event will be emitted when the channel is closed. All pending requests will be
rejected with an error.
Kind: instance method of BleControlRequestChannel
A base class for a BLE characteristic.
Kind: global class
Emits: data
, error
String
Promise.<Uint8Array>
Promise
Promise
Promise
String
Characteristic UUID.
Kind: instance property of BleCharacteristic
Promise.<Uint8Array>
Read the current value of the characteristic.
Kind: instance method of BleCharacteristic
Promise
Write to the characteristic.
Kind: instance method of BleCharacteristic
Param | Type | Default | Description |
---|---|---|---|
data | Uint8Array | Data to write. | |
[options] | Object | Options. | |
[options.withoutResponse] | Boolean | false | Whether to write with or without a response. |
Promise
Enable notifications for this characteristic.
Kind: instance method of BleCharacteristic
Promise
Disable notifications for this characteristic.
Kind: instance method of BleCharacteristic
An event emitted when the peripheral indicates that the characteristic has changed.
In order to start receiving these events, notifications for the characteristic need to be enabled via enableNotifications.
Kind: event emitted by BleCharacteristic
An event emitted when an error occurs.
Kind: event emitted by BleCharacteristic
A base class for a BLE service.
Kind: global class
String
Promise.<Array.<BleCharacteristic>>
String
Service UUID.
Kind: instance property of BleService
Promise.<Array.<BleCharacteristic>>
Get the characteristics of this service.
Kind: instance method of BleService
A base class for a BLE peripheral device.
Kind: global class
Emits: connect
, disconnect
, error
String
Uint8Array
Number
Promise
Promise
Promise.<Array.<BleService>>
String
Peripheral name.
Kind: instance property of BlePeripheral
Uint8Array
Advertised manufacturer data.
If present, the manufacturer data is expected to start with a 2-byte company ID.
Kind: instance property of BlePeripheral
Number
ATT MTU of the current established connection.
If defined, the value must be greater than or equal to 23, which is the minimum supported ATT MTU.
Kind: instance property of BlePeripheral
Promise
Connect to the peripheral.
Kind: instance method of BlePeripheral
Promise
Disconnect from the peripheral.
Kind: instance method of BlePeripheral
Promise.<Array.<BleService>>
Get the services of this peripheral.
Kind: instance method of BlePeripheral
An event emitted when the host has connected to the peripheral.
Kind: event emitted by BlePeripheral
An event emitted when the host has disconnected from the peripheral.
Kind: event emitted by BlePeripheral
An event emitted when an error occurs.
Kind: event emitted by BlePeripheral
A base class for a BLE manager.
Kind: global class
Promise.<Array.<BlePeripheral>>
Promise
Constructor.
Promise.<Array.<BlePeripheral>>
Scan for available peripherals.
If filtering options, such as names
or services
, are provided, a discovered peripheral will
only be reported by this method if it satisfies all of the filtering options.
Only one scan can be active at a time.
Kind: instance method of BleManager
Returns: Promise.<Array.<BlePeripheral>>
- Discovered peripherals.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | Options. | |
[options.names] | Array.<(String|RegExp)> | Peripheral names. | |
[options.services] | Array.<String> | Service UUIDs. | |
[options.count] | Number | Maximum number of peripherals to scan for. | |
[options.timeout] | Number | 5000 | Maximum duration of the scan in milliseconds. |
Promise
Shut down the BLE manager.
Calling this method will interrupt the ongoing scan process and close all connections with peripherals with an error.
Kind: instance method of BleManager
A base class for an AES-128 cipher operating in ECB mode.
Kind: global class
Promise.<Uint8Array>
Encrypt a single block of data.
Kind: instance method of Aes128Cipher
Returns: Promise.<Uint8Array>
- Ciphertext block.
Param | Type | Description |
---|---|---|
block | Uint8Array | Plaintext block. The block must be 16 bytes long. |
A base class defining environment-specific functions used by the library.
Kind: global class
Aes128Cipher
Promise.<Uint8Array>
Aes128Cipher
Create an AES-128 cipher operating in ECB mode.
Kind: instance method of Env
Returns: Aes128Cipher
- Cipher object.
Param | Type | Description |
---|---|---|
key | Uint8Array | Encryption key. The key must be 16 bytes long. |
Promise.<Uint8Array>
Generate cryptographically strong random data.
Kind: instance method of Env
Returns: Promise.<Uint8Array>
- Random data.
Param | Type | Description |
---|---|---|
size | Number | Number of bytes to generate. |
Default timeout of a BLE scan.
Kind: global constant
Env
Get the default environment-specific functions.
Kind: global function
Promise.<Response>
Send a request to the device.
Kind: global typedef
Param | Type | Description |
---|---|---|
type | Number | Request type. See system_control.h in Device OS for the list of defined request types. |
[data] | Uint8Array | Request payload data. |
[options] | Object | Options. |
[options.timeout] | Number | Request timeout in milliseconds. If not specified, the default timeout configured at construction time will be used. |
Properties
Name | Type | Description |
---|---|---|
result | Number | Result code. See system_error.h in Device OS for the list of defined result codes. |
data | Uint8Array | Response payload data. |
NOTE: Unfortunately, docs have a nasty habit of falling out of date. When in doubt, check usage in tests
FAQs
A library for controlling Particle devices over BLE
The npm package @particle/device-control-ble receives a total of 2 weekly downloads. As such, @particle/device-control-ble popularity was classified as not popular.
We found that @particle/device-control-ble demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 29 open source maintainers 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
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.