pcplayer99
Members-
Content Count
93 -
Joined
-
Last visited
Everything posted by pcplayer99
-
Android, Delphi 10.3.3. community version. TBluetoothLE scan BLE device ok, and then: var AService: TBluetoothGattService; AService := BluetoothLE1.GetService(Self.FMyDevice, Service_ID); if not Assigned(AService) then raise exception.Create('No service found.'); Here, mybe I can got the service, mybe not, on the same device. Maybe I restart APP and can got service.
-
After BluetoothLE1.OnEnddiscoverService triggered, Can always getService success.
-
Thanks Rollo62. I have tested, if I wait a minute and then do GetService, it's works fine.
-
thanks. I will test add some minutes waitting in every step.
-
Thank you Lars. My Program is: 1. Scan device. then list devices. 2. Let user select a device, and user click a "Select" button. 3. in the button onclick event handler, find the device, and set user selected device to FMyDevice, and then call BluetoothLE1.DiscoverServices(Self.FMyDevice); 4. Do someting that need service, call GetService(FMyDevice), and then maybe ok, maybe got nil.
-
unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.Controls.Presentation; type TForm1 = class(TForm) ToolBar1: TToolBar; Button1: TSpeedButton; procedure Button1Click(Sender: TObject); private { Private declarations } FNumb: Integer; public { Public declarations } end; TMyThread = class(TThread) private procedure aaaa; public procedure Execute; override; end; var Form1: TForm1; implementation {$R *.fmx} { TMyThread } procedure TMyThread.aaaa; begin Form1.Button1.Text := 'aaa' + Form1.FNumb.ToString; Form1.Updated; Inc(Form1.FNumb); end; procedure TMyThread.Execute; begin inherited; Self.Synchronize(aaaa); end; procedure TForm1.Button1Click(Sender: TObject); var T: TMyThread; begin T := TMyThread.Create(True); T.Start; end; end. Above code can run OK under Windows, but in Android, it can not run into TMyThread.Execute; if Add a Sleep(500) as code below, it can run OK in Android: procedure TForm1.Button1Click(Sender: TObject); var T: TMyThread; begin T := TMyThread.Create(True); Sleep(500); T.Start; end; So, I guess in Android, var T is a local variable and after exit Button1Click method, it was released by ARC. So I move var T: TMyThread declare to global variable at var Form1: TForm, and then delete Sleep(500) and then tested in Android, it works OK.
-
T := TMyThread.Create(True); T.Start; equal: T := TMyThread.Create; After T := TMyThread.Create this thread run immediately. I write this: T := TMyThread.Create(True); T.Start; just want to place a break point here when thread was created and see what happend. And I have seen something: when there is a break point, and program stopped here, and then I press F8, and F8, it works fine. So I guess that maybe I can stop here for some while and I add a Sleep(500) here and it works fine.
-
Pointers... loops...
pcplayer99 replied to Sonjli's topic in Algorithms, Data Structures and Class Design
PODBALMMSG2 = ^ODBALMMSG2; ODBALMMSG2 = packed record alm_no: LongInt; atype: SmallInt; axis: SmallInt; dummy: SmallInt; msg_len: SmallInt; alm_msg: array [0 .. 63] of AnsiChar; end; In Delphi,if you has code like this: procedure DoSometiing(xxxxx: xx); var MyR: ODBALMMSG2 begin ////do something... end; Here, you got a record MyR, its memory is prepared statically. It is a instance, you can use it directly. And the pointer of this instance is: @MyR. If you has code like this: procedure DoSometing(xxx: xxx); var MyR_P: PODBALMMSG2 begin /// Here, MyR_P is a pointer that type is PODBALMMSG2 but it is a pointer, you can just use a normal pointer type instead PODBALMMSG2. /// Here, MyR_P is just a variable, there is no instance, no memory that store data. If you want use it, you must allocate memory for it. And, you must free the memory when you want to give up it. MyR_P := GetMem(SizeOf(ODBALMMSG2)); try do something... finally FreeMem(MyR_P); end; /// or, you can use this function: New(MyR_P); try Do something.... finally Dispose(MyR_P); end; end; -
Automatic fill & submit web forms using TWebBrowser on Android
pcplayer99 replied to Yaron's topic in Cross-platform
I remember Fmx TWebBrowser can be called javascript by delphi outside the TWebBrowser. -
TWebBrowser + dynamic JS question
pcplayer99 replied to David Schwartz's topic in Network, Cloud and Web
I did some research about this topic. It seems that we should use some "Headless Browser" with Python. But I try to use delphi. So, I have tested using outerHTML, innerHTML etc, and I have tested another way: Copy/Paste. And, I can got the HTML text but with some JS code or HTML tag. I can not get plain text that user can read at all. -
FireMonkey BLE Android BluetoothLE1.GetCharacteristic fail
pcplayer99 posted a topic in Cross-platform
Delphi 10.3.1 My steps: 1. BluetoothLE1.DiscoverDevices(3000); Can find device, trigger BluetoothLE1EndDiscoverDevices event. 2. FDevice.DiscoverServices; can get services. I can got a service by: AService := BluetoothLE1.GetService(FDevice, MyService_ID); 3. and then if I call: ACharacteristic := BluetoothLE1.GetCharacteristic(AService, My_Characteristic_ID); I got nil. ----------- at 3, this method will be ok: for I := 0 to AService.Characteristics.Count -1 do begin if Aservice.Characteristics.UUID = My_Characteristic_ID then begin ACharacteristic := Aservice.Characteristics; Break; end; end; After I do this for loop, ACharacteristic := BluetoothLE1.GetCharacteristic(AService, My_Characteristic_ID); will get the right thing. So, Is it a issue? -
FireMonkey BLE Android BluetoothLE1.GetCharacteristic fail
pcplayer99 replied to pcplayer99's topic in Cross-platform
thanks a lot. -
I update my code from uri := StrToJURI('file://' + AURI); to: LUri := TAndroidHelper.JFileToJURI(TJFile.JavaClass.init(StringToJString(AFileName))); and it works. Thanks Dave.
-
Thank you Dave. I have tested, checked Secure File Sharing, and the exception is still raising.
-
Maybe I know what issue it is. The reason is that server side use some .Net Object that Delphi can not handle. for a example: If I create SOAP server by Delphi, and I will create a client side by delphi, I can output TDataSetProvider from the server and my Delphi client can handle it but C# or Java can not. Here maybe your server write by C# and it useing some Object just by C# ?
-
The exception is clear: SOAP classes must derive from TRemotable If you write SOAP code with using DELPHI, you must know, in SOAP interface methods, if the data type is a object, it must derive from TRemotable. If it is a TComponent, it can not using in SOAP method. Here I mean is that you design a SOAP server. If there is a running SOAP server, you can using "Component/import WSDL" menu in Delphi IDE menu, and Delphi will create some SOAP client code for you.
-
Android 8.0 Permissions errors using Delphi Rio 10.3
pcplayer99 replied to Jose Morango's topic in Cross-platform
I did a test, when the system dialog box show, I select "No", then AOnDisplayRationale show my dialog box. -
Android 8.0 Permissions errors using Delphi Rio 10.3
pcplayer99 replied to Jose Morango's topic in Cross-platform
Maybe this issue in my Android phone, is that the phone system show a policy dialogbox and I have selected OK, so it is the reason the AOnDisplayRationale can not call. -
Android 8.0 Permissions errors using Delphi Rio 10.3
pcplayer99 replied to Jose Morango's topic in Cross-platform
I run test app on Android 9, under debug mode, step by step, press F7 when it stoped on this: PermissionsService.RequestPermissions([FLocationPermission], RequestPermissionsResult, DisplayRationale); But it can not go into the implementation code, it go into some ASM code in function _InstClear(var Dest: TObject): Pointer; in system unit. In the same condition, if I press Ctr + Left click RequestPermissions, it go into: procedure TPermissionsService.RequestPermissions(const APermissions: TArray<string>; const AOnRequestPermissionsResult: TRequestPermissionsResultEvent; AOnDisplayRationale: TDisplayRationaleEvent); So, check this procedure in System.Permissions, there is no code to call AOnDisplayRationale. -
Android 8.0 Permissions errors using Delphi Rio 10.3
pcplayer99 replied to Jose Morango's topic in Cross-platform
On my Android Phone, Android version is 9. I tested BLEScanner demo, the method "TForm6.DisplayRationale" never be called when I call "PermissionsService.RequestPermissions([FLocationPermission], RequestPermissionsResult, DisplayRationale);" -
Android 8.0 Permissions errors using Delphi Rio 10.3
pcplayer99 replied to Jose Morango's topic in Cross-platform
There is a demo named BLEScanner with Delphi. In this demo, you can find some code about permission: procedure TForm6.btnStartScanClick(Sender: TObject); begin PermissionsService.RequestPermissions([FLocationPermission], RequestPermissionsResult, DisplayRationale); end; procedure TForm6.DisplayRationale(Sender: TObject; const APermissions: TArray<string>; const APostRationaleProc: TProc); begin TDialogService.ShowMessage('We need to be given permission to discover BLE devices', procedure(const AResult: TModalResult) begin APostRationaleProc; end) end; procedure TForm6.RequestPermissionsResult(Sender: TObject; const APermissions: TArray<string>; const AGrantResults: TArray<TPermissionStatus>); begin // 1 permissions involved: ACCESS_COARSE_LOCATION if (Length(AGrantResults) = 1) and (AGrantResults[0] = TPermissionStatus.Granted) then StartBLEDiscovery else TDialogService.ShowMessage('Cannot start BLE scan as the permission has not been granted'); end; But because the bug, DisplayRationale never be called. -
Android 8.0 Permissions errors using Delphi Rio 10.3
pcplayer99 replied to Jose Morango's topic in Cross-platform
In Delphi rio 10.3 Comunity edition, permission framework is in System.Permissions.pas. But, there are some bugs ? There are two method that we can request permission to call it. But the parameter "AOnDisplayRationale" has never be used by these two methods. procedure TPermissionsService.RequestPermissions(const APermissions: TArray<string>; const AOnRequestPermissionsResult: TRequestPermissionsResultEvent; AOnDisplayRationale: TDisplayRationaleEvent); var GrantResults: TArray<TPermissionStatus>; I: Integer; begin SetLength(GrantResults, Length(APermissions)); for I := Low(GrantResults) to High(GrantResults) do GrantResults[I] := TPermissionStatus.Granted; AOnRequestPermissionsResult(Self, APermissions, GrantResults) end; procedure TPermissionsService.RequestPermissions(const APermissions: TArray<string>; const AOnRequestPermissionsResult: TRequestPermissionsResultProc; AOnDisplayRationale: TDisplayRationaleProc); var GrantResults: TArray<TPermissionStatus>; I: Integer; begin SetLength(GrantResults, Length(APermissions)); for I := Low(GrantResults) to High(GrantResults) do GrantResults[I] := TPermissionStatus.Granted; AOnRequestPermissionsResult(APermissions, GrantResults) end; -
Dspack is a set of VCL control, so, you can use it to write a mediaplayer you self in VCL mode. And then, you can embed a VCL form into your FMX project. Dspack wrapped DirectShow9 as pascal code and you can use it in Delphi. The MediaPlayer in FMX under Windows is Windows mediaplayer that using DirectShow9 and wrapped by pascal. So, essentially these two is wrapped the same Windows component. By using Dspack, you have more degree of freedom, using TMediaPlayer by FMX, you have extremely few public method and property to use.
-
In Windows,I play video by using Dspack to write my own mediaplayer.
-
FMX.WebBrowser on MacOS raises error "the specified file was not found"
pcplayer99 replied to CarloM's topic in FMX
maybe need another way: free the TWebBrowser and create it again ? Or, you need a html file with JavaScrip to load PDF file, you just load html file into TWebBrowser and let the javascript to load PDF for you. I just guess, no try. I have no Apple mobile phone.