1 {
2  *****************************************************************************
3  *                             WSLazDeviceAPIS.pas                           *
4  *                                ----------                                 *
5  *                                                                           *
6  *                                                                           *
7  *****************************************************************************
8 
9  *****************************************************************************
10   This file is part of the Lazarus Component Library (LCL)
11 
12   See the file COPYING.modifiedLGPL.txt, included in this distribution,
13   for details about the license.
14  *****************************************************************************
15 }
16 unit WSLazDeviceAPIS;
17 
18 {$mode objfpc}{$H+}
19 {$I lcl_defines.inc}
20 
21 interface
22 ////////////////////////////////////////////////////
23 // I M P O R T A N T
24 ////////////////////////////////////////////////////
25 // 1) Only class methods allowed
26 // 2) Class methods have to be published and virtual
27 // 3) To get as little as posible circles, the uses
28 //    clause should contain only those LCL units
29 //    needed for registration. WSxxx units are OK
30 // 4) To improve speed, register only classes in the
31 //    initialization section which actually
32 //    implement something
33 // 5) To enable your XXX widgetset units, look at
34 //    the uses clause of the XXXintf.pp
35 ////////////////////////////////////////////////////
36 uses
37 ////////////////////////////////////////////////////
38 // To get as little as posible circles,
39 // uncomment only when needed for registration
40 ////////////////////////////////////////////////////
41   Types, Math, LazDeviceAPIs,
42 ////////////////////////////////////////////////////
43   WSLCLClasses, WSControls, WSFactory;
44 
45 type
46   { TWSLazDeviceAPIS }
47 
48   TWSLazDeviceAPIsClass = class of TWSLazDeviceAPIs;
49   TWSLazDeviceAPIs = class(TWSObject)
50   public
51     class procedure RequestPositionInfo(AMethod: TLazPositionMethod); virtual;
52     //
53     class procedure SendMessage(AMsg: TLazDeviceMessage); virtual;
54     //
55     class procedure StartReadingAccelerometerData(); virtual;
56     class procedure StopReadingAccelerometerData(); virtual;
57     // TLazDevice
GetDeviceManufacturernull58     class function GetDeviceManufacturer: string; virtual;
GetDeviceModelnull59     class function GetDeviceModel: string; virtual;
GetScreenRotationnull60     class function GetScreenRotation(AScreenIndex: Integer): TScreenRotation; virtual;
61     class procedure Vibrate(ADurationMS: Cardinal); virtual;
62   end;
63 
64 { WidgetSetRegistration }
65 procedure RegisterLazDeviceAPIs;
66 
67 implementation
68 
69 { WidgetSetRegistration }
70 
71 procedure RegisterLazDeviceAPIs;
72 const
73   Done: Boolean = False;
74 begin
75   if Done then exit;
76   if not WSRegisterLazDeviceAPIs() then
77     RegisterWSLazDeviceAPIs(TWSLazDeviceAPIs);
78   Done := True;
79 end;
80 
81 { TWSLazDeviceAPIs }
82 
83 class procedure TWSLazDeviceAPIs.RequestPositionInfo(AMethod: TLazPositionMethod);
84 begin
85 
86 end;
87 
88 class procedure TWSLazDeviceAPIs.SendMessage(AMsg: TLazDeviceMessage);
89 begin
90 
91 end;
92 
93 class procedure TWSLazDeviceAPIs.StartReadingAccelerometerData;
94 begin
95 
96 end;
97 
98 class procedure TWSLazDeviceAPIs.StopReadingAccelerometerData;
99 begin
100 
101 end;
102 
TWSLazDeviceAPIs.GetDeviceManufacturernull103 class function TWSLazDeviceAPIs.GetDeviceManufacturer: string;
104 begin
105   Result := '';
106 end;
107 
TWSLazDeviceAPIs.GetDeviceModelnull108 class function TWSLazDeviceAPIs.GetDeviceModel: string;
109 begin
110   Result := '';
111 end;
112 
TWSLazDeviceAPIs.GetScreenRotationnull113 class function TWSLazDeviceAPIs.GetScreenRotation(AScreenIndex: Integer
114   ): TScreenRotation;
115 begin
116   Result := srRotation_0;
117 end;
118 
119 class procedure TWSLazDeviceAPIs.Vibrate(ADurationMS: Cardinal);
120 begin
121 
122 end;
123 
124 end.
125