|
| 1 | +// Type definitions for cordova-plugin-ibeacon v3.3.0 |
| 2 | +// Project: https://github.com/petermetz/cordova-plugin-ibeacon |
| 3 | +// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/> |
| 4 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped |
| 5 | + |
| 6 | +/// <reference path="../q/Q.d.ts" /> |
| 7 | + |
| 8 | +interface CordovaPlugins { |
| 9 | + locationManager: BeaconPlugin.LocationManager; |
| 10 | +} |
| 11 | + |
| 12 | +declare module BeaconPlugin { |
| 13 | + /** |
| 14 | + * Beacon Plugin. |
| 15 | + */ |
| 16 | + export interface LocationManager { |
| 17 | + delegate: Delegate; |
| 18 | + BeaconRegion: BeaconRegion; |
| 19 | + onDomDelegateReady(): void; |
| 20 | + startMonitoringForRegion(region: Region): Q.Promise<void>; |
| 21 | + stopMonitoringForRegion(region: Region): Q.Promise<void>; |
| 22 | + requestStateForRegion(region: Region): Q.Promise<void>; |
| 23 | + startRangingBeaconsInRegion(region: Region): Q.Promise<void>; |
| 24 | + stopRangingBeaconsInRegion(region: Region): Q.Promise<void>; |
| 25 | + getAuthorizationStatus(): Q.Promise<PluginResult>; |
| 26 | + requestWhenInUseAuthorization(): Q.Promise<void>; |
| 27 | + requestAlwaysAuthorization(): Q.Promise<void>; |
| 28 | + getMonitoredRegions(): Q.Promise<Region[]>; |
| 29 | + getRangedRegions(): Q.Promise<Region[]>; |
| 30 | + isRangingAvailable(): Q.Promise<boolean>; |
| 31 | + isMonitoringAvailableForClass(region: Region): Q.Promise<boolean>; |
| 32 | + startAdvertising(region: Region, measuredPower: boolean): Q.Promise<void>; |
| 33 | + stopAdvertising(): Q.Promise<void>; |
| 34 | + isAdvertisingAvailable(): Q.Promise<boolean>; |
| 35 | + isAdvertising(): Q.Promise<boolean>; |
| 36 | + disableDebugLogs(): Q.Promise<void>; |
| 37 | + enableDebugNotifications(): Q.Promise<void>; |
| 38 | + disableDebugNotifications(): Q.Promise<void>; |
| 39 | + enableDebugLogs(): Q.Promise<void>; |
| 40 | + isBluetoothEnabled(): Q.Promise<boolean>; |
| 41 | + enableBluetooth(): Q.Promise<void>; |
| 42 | + disableBluetooth(): Q.Promise<void>; |
| 43 | + appendToDeviceLog(message: string): Q.Promise<string>; |
| 44 | + } |
| 45 | + |
| 46 | + export interface PluginResult { |
| 47 | + eventType: string; |
| 48 | + region: Region; |
| 49 | + beacons: Beacon[]; |
| 50 | + authorizationStatus: string; |
| 51 | + state: string; |
| 52 | + } |
| 53 | + |
| 54 | + export interface Delegate { |
| 55 | + didDetermineStateForRegion(pluginResult: PluginResult): void; |
| 56 | + didStartMonitoringForRegion(pluginResult: PluginResult): void; |
| 57 | + didExitRegion(pluginResult: PluginResult): void; |
| 58 | + didEnterRegion(pluginResult: PluginResult): void; |
| 59 | + didRangeBeaconsInRegion(pluginResult: PluginResult): void; |
| 60 | + peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void; |
| 61 | + peripheralManagerDidUpdateState(pluginResult: PluginResult): void; |
| 62 | + didChangeAuthorizationStatus(authorizationStatus: string): void; |
| 63 | + monitoringDidFailForRegionWithError(pluginResult: PluginResult): void; |
| 64 | + } |
| 65 | + |
| 66 | + export interface Region { |
| 67 | + identifier: string; |
| 68 | + new (identifier: string): Region; |
| 69 | + } |
| 70 | + |
| 71 | + export interface BeaconRegion extends Region { |
| 72 | + uuid: string; |
| 73 | + major: string; |
| 74 | + minor: string; |
| 75 | + notifyEntryStateOnDisplay: boolean; |
| 76 | + new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion; |
| 77 | + } |
| 78 | + |
| 79 | + export interface CircularRegion extends Region { |
| 80 | + latitude: number; |
| 81 | + longitude: number; |
| 82 | + radius: number; |
| 83 | + new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion; |
| 84 | + } |
| 85 | + |
| 86 | + export interface Beacon { |
| 87 | + uuid: string; |
| 88 | + major: string; |
| 89 | + minor: string; |
| 90 | + proximity: string; |
| 91 | + tx: number; |
| 92 | + rssi: number; |
| 93 | + accuracy: number; |
| 94 | + } |
| 95 | +} |
0 commit comments