smic-weightscale
v0.0.1
Published
Weight scale integrate
Readme
smic-weightscale
Weight scale integrate
Install
To use npm
npm install smic-weightscaleTo use yarn
yarn add smic-weightscaleSync native files
npx cap syncAPI
discover()stopDiscovery()requestPermissions()connect(...)disconnect()zeroAdjustment()addListener('deviceFound', ...)addListener('weightScaleLog', ...)addListener('permissionsStatus', ...)addListener('scaleData', ...)addListener('scaleDisconnected', ...)removeAllListeners()- Interfaces
discover()
discover() => Promise<DiscoveryResult>Returns: Promise<DiscoveryResult>
stopDiscovery()
stopDiscovery() => Promise<StopDiscoveryResult>Returns: Promise<StopDiscoveryResult>
requestPermissions()
requestPermissions() => Promise<PermissionResult>Returns: Promise<PermissionResult>
connect(...)
connect(options: { identifier: string; interface?: string; }) => Promise<ConnectionResult>| Param | Type |
| ------------- | -------------------------------------------------------- |
| options | { identifier: string; interface?: string; } |
Returns: Promise<ConnectionResult>
disconnect()
disconnect() => Promise<ConnectionResult>Returns: Promise<ConnectionResult>
zeroAdjustment()
zeroAdjustment() => Promise<ZeroAdjustmentResult>Returns: Promise<ZeroAdjustmentResult>
addListener('deviceFound', ...)
addListener(eventName: "deviceFound", listenerFunc: (device: ScaleDevice) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ------------------------------------------------------------------------ |
| eventName | 'deviceFound' |
| listenerFunc | (device: ScaleDevice) => void |
Returns: Promise<PluginListenerHandle>
addListener('weightScaleLog', ...)
addListener(eventName: "weightScaleLog", listenerFunc: (event: DebugEvent) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | --------------------------------------------------------------------- |
| eventName | 'weightScaleLog' |
| listenerFunc | (event: DebugEvent) => void |
Returns: Promise<PluginListenerHandle>
addListener('permissionsStatus', ...)
addListener(eventName: "permissionsStatus", listenerFunc: (status: PermissionStatus) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | 'permissionsStatus' |
| listenerFunc | (status: PermissionStatus) => void |
Returns: Promise<PluginListenerHandle>
addListener('scaleData', ...)
addListener(eventName: "scaleData", listenerFunc: (data: ScaleDataEvent) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ---------------------------------------------------------------------------- |
| eventName | 'scaleData' |
| listenerFunc | (data: ScaleDataEvent) => void |
Returns: Promise<PluginListenerHandle>
addListener('scaleDisconnected', ...)
addListener(eventName: "scaleDisconnected", listenerFunc: (event: DisconnectEvent) => void) => Promise<PluginListenerHandle>| Param | Type |
| ------------------ | ------------------------------------------------------------------------------- |
| eventName | 'scaleDisconnected' |
| listenerFunc | (event: DisconnectEvent) => void |
Returns: Promise<PluginListenerHandle>
removeAllListeners()
removeAllListeners() => Promise<void>Interfaces
DiscoveryResult
| Prop | Type |
| -------------- | -------------------- |
| message | string |
| scanning | boolean |
StopDiscoveryResult
| Prop | Type |
| ------------- | -------------------------- |
| devices | ScaleDevice[] |
| count | number |
ScaleDevice
| Prop | Type |
| ---------------- | ------------------- |
| name | string |
| identifier | string |
| interface | string |
| scaleType | string |
PermissionResult
| Prop | Type |
| -------------------- | -------------------- |
| granted | boolean |
| alreadyGranted | boolean |
ConnectionResult
| Prop | Type |
| ------------- | -------------------- |
| success | boolean |
| message | string |
ZeroAdjustmentResult
| Prop | Type |
| ------------- | -------------------- |
| success | boolean |
| message | string |
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
DebugEvent
| Prop | Type |
| ------------- | ------------------- |
| message | string |
PermissionStatus
| Prop | Type |
| ---------------------- | -------------------- |
| granted | boolean |
| bluetoothScan | boolean |
| bluetoothConnect | boolean |
| location | boolean |
ScaleDataEvent
| Prop | Type |
| ------------------- | ------------------- |
| weight | number |
| unit | string |
| status | string |
| dataType | string |
| decimalPlaces | number |
DisconnectEvent
| Prop | Type |
| ------------- | ------------------- |
| message | string |
