
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
@kduma-autoid/capacitor-usb-scale
Advanced tools
Capacitor adapter for cheap USB scales like Dymo M10
Capacitor adapter for cheap USB scales like Dymo M10
npm install @kduma-autoid/capacitor-usb-scale
npx cap sync
enumerateDevices()
requestPermission(...)
hasPermission(...)
open(...)
close()
addListener('onRead', ...)
addListener('onScaleConnected', ...)
addListener('onScaleDisconnected', ...)
removeAllListeners()
enumerateDevices() => Promise<EnumerateDevicesResponse>
Get a list of all connected compatible USB scale devices
Returns: Promise<EnumerateDevicesResponse>
requestPermission(options?: RequestPermissionOptions | undefined) => Promise<void>
Request permission to access the USB scale device
Throws an error if permission is denied
Param | Type |
---|---|
options | RequestPermissionOptions |
hasPermission(options?: HasPermissionOptions | undefined) => Promise<HasPermissionResponse>
Check if app has permission to access the USB scale device
Param | Type |
---|---|
options | HasPermissionOptions |
Returns: Promise<HasPermissionResponse>
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
Param | Type |
---|---|
options | OpenOptions |
close() => Promise<void>
Close the USB scale device
addListener(eventName: 'onRead', listenerFunc: (event: OnReadEvent) => void) => Promise<PluginListenerHandle>
Event emitted when the scale sends data
Param | Type |
---|---|
eventName | 'onRead' |
listenerFunc | (event: OnReadEvent) => void |
Returns: Promise<PluginListenerHandle>
addListener(eventName: 'onScaleConnected', listenerFunc: (event: OnScaleConnectedEvent) => void) => Promise<PluginListenerHandle>
Event emitted when a compatible USB scale device is connected.
Param | Type |
---|---|
eventName | 'onScaleConnected' |
listenerFunc | (event: OnScaleConnectedEvent) => void |
Returns: Promise<PluginListenerHandle>
addListener(eventName: 'onScaleDisconnected', listenerFunc: (event: OnScaleDisconnectedEvent) => void) => Promise<PluginListenerHandle>
Event emitted when a compatible USB scale device is disconnected.
Param | Type |
---|---|
eventName | 'onScaleDisconnected' |
listenerFunc | (event: OnScaleDisconnectedEvent) => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners() => Promise<void>
Removes all listeners
Prop | Type |
---|---|
devices | USBDevice[] |
Prop | Type |
---|---|
id | string |
vid | number |
pid | number |
serial | string |
product | { manufacturer: string; name: string; } |
Prop | Type | Description |
---|---|---|
device_id | string | The device to request permission for. If not specified, the first device will be used. |
Prop | Type | Description |
---|---|---|
permission | boolean | Whether the app has permission to access the USB scale device |
Prop | Type | Description |
---|---|---|
device_id | string | The device to check permission for. If not specified, the first device will be used. |
Prop | Type | Description |
---|---|---|
device_id | string | The device to open. If not specified, the first device will be used. |
Prop | Type |
---|---|
remove | () => Promise<void> |
Prop | Type |
---|---|
data | number[] |
weight | number |
status | ScaleStatus |
Prop | Type |
---|---|
device | USBDevice |
Prop | Type |
---|---|
device | USBDevice |
Members | Value |
---|---|
Fault | "fault" |
Zero | "zero" |
InMotion | "in-motion" |
Stable | "stable" |
UnderZero | "under-zero" |
OverWeight | "over-weight" |
NeedCalibration | "need-calibration" |
NeedZeroing | "need-zeroing" |
Unknown | "unknown" |
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
.
addEventListener(type: "usb_scale_connected", listener: (ev: { device: USBDevice }) => any, useCapture?: boolean): void;
Emitted when a compatible USB scale device is connected.
addEventListener(type: "usb_scale_disconnected", listener: (ev: { device: USBDevice }) => any, useCapture?: boolean): void;
Emitted when a compatible USB scale device is disconnected.
FAQs
Capacitor adapter for cheap USB scales like Dymo M10
We found that @kduma-autoid/capacitor-usb-scale demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.