Socket
Socket
Sign inDemoInstall

@kduma-autoid/capacitor-usb-scale

Package Overview
Dependencies
2
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @kduma-autoid/capacitor-usb-scale

Capacitor adapter for cheap USB scales like Dymo M10


Version published
Maintainers
1
Created

Readme

Source

@kduma-autoid/capacitor-usb-scale

Capacitor adapter for cheap USB scales like Dymo M10

Install

npm install @kduma-autoid/capacitor-usb-scale
npx cap sync

API

enumerateDevices()

enumerateDevices() => Promise<EnumerateDevicesResponse>

Get a list of all connected compatible USB scale devices

Returns: Promise<EnumerateDevicesResponse>


requestPermission(...)

requestPermission(options?: RequestPermissionOptions | undefined) => Promise<void>

Request permission to access the USB scale device

Throws an error if permission is denied

ParamType
optionsRequestPermissionOptions

hasPermission(...)

hasPermission(options?: HasPermissionOptions | undefined) => Promise<HasPermissionResponse>

Check if app has permission to access the USB scale device

ParamType
optionsHasPermissionOptions

Returns: Promise<HasPermissionResponse>


open(...)

open(options?: OpenOptions | undefined) => Promise<void>

Open the USB scale device for data reading

Throws an error if the device is not connected or permission is denied

ParamType
optionsOpenOptions

close()

close() => Promise<void>

Close the USB scale device


addListener('onRead', ...)

addListener(eventName: 'onRead', listenerFunc: (event: OnReadEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Event emitted when the scale sends data

ParamType
eventName'onRead'
listenerFunc(event: OnReadEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('onScaleConnected', ...)

addListener(eventName: 'onScaleConnected', listenerFunc: (event: OnScaleConnectedEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Event emitted when a compatible USB scale device is connected.

ParamType
eventName'onScaleConnected'
listenerFunc(event: OnScaleConnectedEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('onScaleDisconnected', ...)

addListener(eventName: 'onScaleDisconnected', listenerFunc: (event: OnScaleDisconnectedEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Event emitted when a compatible USB scale device is disconnected.

ParamType
eventName'onScaleDisconnected'
listenerFunc(event: OnScaleDisconnectedEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

Removes all listeners


Interfaces

EnumerateDevicesResponse
PropType
devicesUSBDevice[]
USBDevice
PropType
idstring
vidnumber
pidnumber
serialstring
product{ manufacturer: string; name: string; }
RequestPermissionOptions
PropTypeDescription
device_idstringThe device to request permission for. If not specified, the first device will be used.
HasPermissionResponse
PropTypeDescription
permissionbooleanWhether the app has permission to access the USB scale device
HasPermissionOptions
PropTypeDescription
device_idstringThe device to check permission for. If not specified, the first device will be used.
OpenOptions
PropTypeDescription
device_idstringThe device to open. If not specified, the first device will be used.
PluginListenerHandle
PropType
remove() => Promise<void>
OnReadEvent
PropType
datanumber[]
weightnumber
statusScaleStatus
OnScaleConnectedEvent
PropType
deviceUSBDevice
OnScaleDisconnectedEvent
PropType
deviceUSBDevice

Enums

ScaleStatus
MembersValue
Fault"fault"
Zero"zero"
InMotion"in-motion"
Stable"stable"
UnderZero"under-zero"
OverWeight"over-weight"
NeedCalibration"need-calibration"
NeedZeroing"need-zeroing"
Unknown"unknown"

Events

usb_scale_read
addEventListener(type: "usb_scale_read", listener: (ev: ScaleRead) => any, useCapture?: boolean): void;

Emitted when the scale sends data, and there is no callback set by setIncomingWeightDataCallback.

usb_scale_connected
addEventListener(type: "usb_scale_connected", listener: (ev: { device: USBDevice }) => any, useCapture?: boolean): void;

Emitted when a compatible USB scale device is connected.

usb_scale_disconnected
addEventListener(type: "usb_scale_disconnected", listener: (ev: { device: USBDevice }) => any, useCapture?: boolean): void;

Emitted when a compatible USB scale device is disconnected.

Keywords

FAQs

Last updated on 14 Oct 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc