-
Notifications
You must be signed in to change notification settings - Fork 9
/
GS.System.Infos.Extended.ZDeviceInfo.pas
121 lines (93 loc) · 3.28 KB
/
GS.System.Infos.Extended.ZDeviceInfo.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
unit GS.System.Infos.Extended.ZDeviceInfo;
///
/// https://github.com/rzaripov1990/FMX.DeviceInfo.git
interface
uses classes,
sysutils,
GS.System.Infos.Extended,
FMX.ZDeviceInfo;
Type
TgsSysInfoZDevice = class(TgsSysInfoBase)
private
FImpl : TZDeviceInfo;
public
Constructor Create; Override;
Destructor Destroy; override;
function getPlatform: String; override;
function getPlatformVer: String; override;
function getArchitecture: String; override;
function getDevice: String; override;
end;
TgsSysInfoFactoryZDevice = Class(TGSInfoFactory)
function GetImplementation : IGSSysInfo; Override;
End;
implementation
{ TgsSysInfoFactoryZDevice }
function TgsSysInfoFactoryZDevice.GetImplementation: IGSSysInfo;
begin
Result := TgsSysInfoZDevice.Create;
end;
{ TgsSysInfoZDevice }
constructor TgsSysInfoZDevice.Create;
begin
Inherited Create;
FImpl := TZDeviceInfo.Create;
FValues.Add('deviceid='+FImpl.DeviceID);
FValues.Add('architecture='+FImpl.Architecture);
FValues.Add('architecture2='+FImpl.Architecture2);
FValues.Add('macaddress='+FImpl.MacAddress);
FValues.Add('ipaddress='+FImpl.IPAddress);
FValues.Add('deviceid='+FImpl.LangID);
FValues.Add('screenphys='+FImpl.ScreenPhis);
FValues.Add('screenlogic='+FImpl.ScreenLogic);
FValues.Add('screenwidth='+FImpl.ScreenWidth.ToString);
FValues.Add('screenheight='+FImpl.ScreenHeight.ToString);
FValues.Add('scale='+FImpl.Scale.ToString);
FValues.Add('mobileoperator='+FImpl.MobileOperator);
case FImpl.networkconnectiontype of
TZNetworkConnectionType.None : FValues.Add('networkconnectiontype=none');
TZNetworkConnectionType.Unknown : FValues.Add('networkconnectiontype=unknown');
TZNetworkConnectionType.WIFI : FValues.Add('networkconnectiontype=wifi');
TZNetworkConnectionType.Mobile : FValues.Add('networkconnectiontype=mobile');
TZNetworkConnectionType.Ethernet : FValues.Add('networkconnectiontype=ethernet');
end;
case FImpl.MobileDataType of
TZMobileDataType.None : FValues.Add('mobiledatatype=none');
TZMobileDataType.Unknown : FValues.Add('mobiledatatype=unknown');
TZMobileDataType.n2G : FValues.Add('mobiledatatype=2G');
TZMobileDataType.n3G : FValues.Add('mobiledatatype=3G');
TZMobileDataType.n4G : FValues.Add('mobiledatatype=4G/LTE');
TZMobileDataType.n5G : FValues.Add('mobiledatatype=5G');
TZMobileDataType.n6G : FValues.Add('mobiledatatype=6G');
end;
FValues.Add('timezone='+FImpl.TimeZone.ToString);
FValues.Add('isintel='+intTostr(byte(FImpl.IsIntel)));
FValues.Add('isnetconnected='+intTostr(byte(FImpl.IsNetConnected)));
FValues.Add('isportraitorientation='+intTostr(byte(FImpl.IsPortraitOrientation)));
FValues.Add('isgpsactive='+intTostr(byte(FImpl.IsGPSActive)));
end;
destructor TgsSysInfoZDevice.Destroy;
begin
FreeAndNil(FImpl);
inherited;
end;
function TgsSysInfoZDevice.getArchitecture: String;
begin
result := FImpl.Architecture;
end;
function TgsSysInfoZDevice.getDevice: String;
begin
result := FImpl.Device;
end;
function TgsSysInfoZDevice.getPlatform: String;
begin
result := FImpl.Platform;
end;
function TgsSysInfoZDevice.getPlatformVer: String;
begin
Result := FImpl.PlatformVer;
end;
Initialization
TgsSysInfoImplManager.registerSysInfo('zDeviceInfo',TgsSysInfoFactoryZDevice.Create);
finalization
end.