0.1.0 • Published 2 years ago
capacitor-oklok-v2 v0.1.0
capacitor-oklok-v2
A native plugin used for bluetooth low-energy communication with locks from OKLOK
Install
npm install capacitor-oklok-v2
npx cap sync
API
checkPermissions()
checkPermissions() => Promise<PermissionStatus>
Returns: Promise<PermissionStatus>
requestPermissions()
requestPermissions() => Promise<PermissionStatus>
Returns: Promise<PermissionStatus>
request(...)
request(request: Request) => Promise<Return>
Request provided functionalities on the specified lock
Param | Type | Description |
---|---|---|
request | Request | options object for bluetooth requests |
Returns: Promise<Return>
Interfaces
PermissionStatus
Prop | Type |
---|---|
bluetooth | "prompt" | "prompt-with-rationale" | "granted" | "denied" |
location | "prompt" | "prompt-with-rationale" | "granted" | "denied" |
Return
Prop | Type | Description |
---|---|---|
isLocked | boolean | Current status of the lock (Un-/Locked) |
battery | number | Current percentage of the internal battery of the lock |
Request
Prop | Type | Description |
---|---|---|
methods | Method[] | Methods to be executed on the lock |
parameters | Parameters | Parameters to execute the specified methods |
Enums
Method
Members | Value |
---|---|
OPEN | 'open' |
CLOSE | 'close' |
GET_BATTERY | 'get-battery' |
GET_STATUS | 'get-status' |
CHANGE_PASSWORD | 'change-password' |