Socket
Book a DemoInstallSign in
Socket

laird-capacitor-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

laird-capacitor-plugin

A work in progress capacitor plugin that communicates with BLE laird devices.

0.0.2
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Laird Capacitor Plugin

This plugin is still in development and is not live on NPM yet!

A Capacitor plugin that communicates with bluetooth low energy laird devices. Supports older devices with the BluetoothAdapter and newer devices uses the BluetoothLeScanner.

Install

npm install laird-capacitor-plugin
npx cap sync

Example

// Import Laird and Device.
import { Laird, Device } from 'laird-capacitor-plugin';

// Initialize the listener first.
Laird.addListener("deviceFoundEvent", (device) => {
    console.log(device);
});

// Start discovering.
Laird.startDiscovering({ periodically: true });

API

  • startDiscovering(...)
  • cancelDiscovering()
  • connectToDevice(...)
  • disconnectFromDevice()
  • sendDataToDevice(...)
  • addListener(...)
  • addListener(...)
  • addListener(...)
  • addListener(...)
  • Interfaces

startDiscovering(...)

startDiscovering(options?: { periodically: boolean; } | undefined) => any

Start the discovering process for finding bluetooth devices.

ParamType
options{ periodically: boolean; }

Returns: any

cancelDiscovering()

cancelDiscovering() => any

Cancels the discovering process for finding bluetooth devices.

Returns: any

connectToDevice(...)

connectToDevice(options: { address: string; }) => any

Connects to the specified device with the address.

ParamType
options{ address: string; }

Returns: any

disconnectFromDevice()

disconnectFromDevice() => any

Disconnects the current connected device.

Returns: any

sendDataToDevice(...)

sendDataToDevice(options: { data: string; }) => any

Sends data to the connected device.

ParamType
options{ data: string; }

Returns: any

addListener(...)

addListener(eventName: 'discoveryStartEvent', callback: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DiscoveryStartEvent

ParamType
eventName"discoveryStartEvent"
callback() => void

Returns: any

addListener(...)

addListener(eventName: 'discoveryStopEvent', callback: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DiscoveryStopEvent

ParamType
eventName"discoveryStopEvent"
callback() => void

Returns: any

addListener(...)

addListener(eventName: 'deviceFoundEvent', callback: (device: Device) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DeviceFoundListener

ParamTypeDescription
eventName"deviceFoundEvent"DeviceFoundEvent
callback(device: Device) => voidCallback

Returns: any

addListener(...)

addListener(eventName: 'deviceRecvDataEvent', callback: (data: DeviceData) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

DeviceRecvDataListener

ParamTypeDescription
eventName"deviceRecvDataEvent"DeviceRecvDataEvent
callback(data: DeviceData) => voidCallback

Returns: any

Interfaces

PluginListenerHandle

PropType
remove() => any

Device

PropType
namestring
typenumber
addressstring
rssinumber

DeviceData

PropType
datastring

Keywords

capacitor

FAQs

Package last updated on 06 May 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.