-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cordova.QRScanner.pas
67 lines (57 loc) · 2.02 KB
/
Cordova.QRScanner.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
unit Cordova.QRScanner;
interface
uses
W3C.HTML5, W3C.DOM4;
type
JQRScannerStatus = class external
authorized: Boolean;
denied: Boolean;
restricted: Boolean;
prepared: Boolean;
scanning: Boolean;
previewing: Boolean;
showing: Boolean;
lightEnabled: Boolean;
canOpenSettings: Boolean;
canEnableLight: Boolean;
canChangeCamera: Boolean;
currentCamera: Integer;
end;
JQRScannerError = class external
const UNEXPECTED_ERROR = 0;
const CAMERA_ACCESS_DENIED = 1;
const CAMERA_ACCESS_RESTRICTED = 2;
const BACK_CAMERA_UNAVAILABLE = 3;
const FRONT_CAMERA_UNAVAILABLE = 4;
const CAMERA_UNAVAILABLE = 5;
const SCAN_CANCELED = 6;
const LIGHT_UNAVAILABLE = 7;
const OPEN_SETTINGS_UNAVAILABLE = 8;
name: String;
code: Integer;
_message: String;
end;
TDoneCallback = procedure(const Error: JQRScannerError; const Status: JQRScannerStatus);
TDisplayContentsCallback = procedure(const Error: JQRScannerError; const Text: String);
TStatusCallback = procedure(const Status: JQRScannerStatus);
JQRScanner = class external 'QRScanner'
public
procedure prepare(onDone: TDoneCallback);
procedure scan(displayContents: TDisplayContentsCallback);
procedure cancelScan(callback: TStatusCallback = nil);
procedure show(callback: TStatusCallback = nil);
procedure hide(callback: TStatusCallback = nil);
procedure enableLight(callback: TDoneCallback = nil);
procedure disableLight(callback: TDoneCallback = nil);
procedure useFrontCamera(callback: TDoneCallback = nil);
procedure useBackCamera(callback: TDoneCallback = nil);
procedure useCamera(front: Boolean; callback: TDoneCallback = nil);
procedure pausePreview(callback: TStatusCallback = nil);
procedure resumePreview(callback: TStatusCallback = nil);
procedure getStatus(callback: TStatusCallback);
procedure openSettings;
procedure destroy(callback: TStatusCallback = nil);
end;
var QRScanner external 'QRScanner': JQRScanner;
implementation
end.