Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 01/14/20 in all areas

  1. Sherlock

    In-App Clipboard

    Fellas, please. If Attila thinks he gave enough information, you have two options: Either write an answer based on that, or don't write at all. This should please not escalate.
  2. I can't really comment on the multicast issue, especially on Android. But if you are really doing multicasting, why are you using TIdUDPServer? That is not a multicast-enabled component. Indy has separate TIdIPMCastClient and TIdIPMCastServer components specifically for multicast. For UDP, assuming a plain vanilla network broadcast is in fact, being used, are you setting up the TIdUDPServer.Bindings collection at all prior to activating the server? One problem I do see is your use of TThread.Queue() captures the ABinding object, which is no longer valid once the TIdUDPServer is freed. Delphi anonymous procedures capture variables, not values. You should use TThread.Queue() more like this instead: procedure TForm3.QueueLog(const AMsg: string); begin TThread.Queue(nil, procedure begin Log(AMsg); end ); end; procedure TForm3.QueueTestConnection(const APeerIP: string); begin TThread.Queue(nil, procedure begin TestConnection(APeerIP); end ); end; procedure TForm3.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread; const AData: TIdBytes; ABinding: TIdSocketHandle); var Data: string; begin Data := TEncoding.Default.GetString(AData); QueueLog('Incoming broadcast message from: ' + ABinding.PeerIP); if SameText(Data, 'mytriggerphrase') then begin QueueTestConnection(ABinding.PeerIP); end; end;
  3. Hello, I am using Delphi 10.3.3, Indy 10.6.2.5366 (stock Indy version) I am trying to listen broadcast UDP messages on Android (exact version I am testing is 4.4.2, I need to support latest versions, too) connected to a local WiFi. Broadcast messages will be sent in same network. I have found this page https://stackoverflow.com/questions/19040674/delphi-xe5-tidudpserver-does-not-receive-anything-on-android and tried to do it as to my understanding. Project has CHANGE_WIFI_MULTICAST_STATE permission set. UDP server parameters are as following at design time and everything else is left as default: TIdUDPServer.Active = False TIdUDPServer.BroadcastEnable = True TIdUDPServer.DefaultPort = 8080 I have following code where timer is activated as last line in OnFormCreate() event and has 0.5 seconds delay: procedure TForm3.tmrCheckPhoneServiceTimer(Sender: TObject); var WifiManagerObj: JObject; begin // Run just once tmrCheckPhoneService.Enabled := False; // Get necessary OS settings to receive broadcast messages Log('Getting multicast lock...'); WifiManagerObj := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.WIFI_SERVICE); FWifiManager := TJWifiManager.Wrap((WifiManagerObj as ILocalObject).GetObjectID); FMulticastLock := FWifiManager.createMulticastLock(StringToJString('LightFactory Remote')); FMulticastLock.setReferenceCounted(True); FMulticastLock.acquire(); // Try to open a port on Android by sending a broadcast message Log('Sending a broadcast message...'); IdUDPServer1.Broadcast('test', IdUDPServer1.DefaultPort); // Now we can start to listen Log('Activating UDP listener...'); IdUDPServer1.Active := True; if FPhoneDialerService = nil then begin TDialogService.ShowMessage('PhoneDialer service not supported'); Exit(); end; PermissionsService.RequestPermissions([FCallPhonePermission], MakePhoneCallPermissionRequestResult, DisplayRationale); end; I have following code in my OnDestroy() event: procedure TForm3.FormDestroy(Sender: TObject); begin // Stop listenning. IdUDPServer1.Active := False; // Release multicast lock FMulticastLock.release(); end; My broadcast listening code is as following: procedure TForm3.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread; const AData: TIdBytes; ABinding: TIdSocketHandle); var Data: string; begin Data := TEncoding.Default.GetString(AData); TThread.Queue(nil, procedure begin Log('Incoming broadcast message from: ' + ABinding.PeerIP) end); if SameText(Data, 'mytriggerphrase') then begin TThread.Queue(nil, procedure begin TestConnection(ABinding.PeerIP) end); end; end; After I run the app, I have following in my log: 2020-01-14 00:59:33.697 Getting multicast lock... 2020-01-14 00:59:33.736 Sending a broadcast message... 2020-01-14 00:59:33.740 Activating UDP listener... 2020-01-14 00:59:33.804 Incoming broadcast message from: 192.168.1.186 That IP number in above log belongs to Android device itself. I have following problems that I could not figure a solution: 1- I do not get any other broadcast message from my PC application which is sending one broadcast message each second. Is there anything I am doing wrong for that to happen? 2- I get segmentation fault (11) when closing my app. Detailed call stack and exact line is in attached picture. This happens each and every close. I did not understand why. Lastly, I am not sure if my code is doing it correct to keep multicast lock thru all run-time. I read a suggestion to release a multicast lock once finished with it in order to save battery life. So, I wonder if I can release multicast lock right after enabling my TIdUDPServer? Any help is appreciated. Thanks & regards, Ertan
  4. Fr0sT.Brutal

    Thinfinity VirtualUI - cloud-based conversion

    Probably you could look at UniGui as well
  5. Ian Branch

    Thinfinity VirtualUI - cloud-based conversion

    I have used TF for several years and it has been taken up by a couple of my Customers. All with good success. As indicated, in your source there is only the need to add one line of code. The rest of the magic is in the installation & setup of TF. Using D10.x.x, I have experienced issues with themeing via TF so I have disabled it for TF based Apps. Not a big issue as far as I am concerned. HTH. Ian
  6. I was not talking about making classes for UI controls but exposing your dataobjects in a way that you can bind them in some way to the UI. Personally I don't like LiveBindings that much - and I gave up on some MVVM-ish approach for Delphi. What works kinda well is going the DB aware approach with datasets (can use things like the TObjectDataSet from Spring4D or other similar ones - DevArt for example has also one) that just are adapters to non dataset/database data such as lists of objects. There are other approaches such as my TTreeViewPresenter that connects an IObjectList from Spring4D to a TVirtualStringTree to display and even edit data.
  7. Larry Hengen

    Thinfinity VirtualUI - cloud-based conversion

    I downloaded and tried a development version and it was as advertised. I think I had to change 1 line of code and voila....a browser based version. That said, if you do some things like host an ActiveX, or WPF control in your app then it's not quite so straightforward. For a smaller application it is certainly a solution that beats redevelopment as a web app. I don't think hosting a large app is a good long term solution due to the server resources required, but it's certainly worth some investigation.
  8. Anders Melander

    In-App Clipboard

    I don't think anyone has a clue what you are talking about.
  9. Fr0sT.Brutal

    In-App Clipboard

    My crystal ball is too tired to guess what OP wants 🙂
  10. Remy Lebeau

    Memory leak in UnicodeString to string conversion

    Then you are going to have to ask the library author to change it, because this implementation is broken. IRecognitionResult is derived from IDispatch, which is an OLE interface. Pascal strings simply are not compatible with OLE - period. The Pascal wrapper for the interface MUST use WideString instead, which uses the OLE BSTR string type.
  11. pyscripter

    TButtonedEdit Styles and transparency

    https://quality.embarcadero.com/browse/RSP-26633 The report contains a solution.
  12. Attila Kovacs

    In-App Clipboard

    Hm, thanks Lars, this will be a good start. Hope I can isolate, not just watch. Lets see!
  13. Lars Fosdal

    In-App Clipboard

    A bit of Googling dug up http://delphidabbler.com/articles?article=9 with src https://bitbucket.org/delphidabbler/article-9-demo/src/master/ which demos the basics - but you'd still need to do the checks to figure out what is relevant to your own app.
  14. Attila Kovacs

    In-App Clipboard

    Thanks @Ugochukwu Mmaduekwe, no problem, I just wanted to inform if there is already something for that. I'll check hooking up some windows messages.
  15. Lars Fosdal

    In-App Clipboard

    I haven't seen one, but I haven't really been looking for one. I guess you have these links already... https://docs.microsoft.com/en-gb/windows/win32/dataxchg/clipboard https://docs.microsoft.com/en-gb/windows/win32/api/winuser/nf-winuser-setclipboardviewer
  16. Remy Lebeau

    Memory leak in UnicodeString to string conversion

    That type-cast is not necessary. Assigning a String (or a WideString) to a String is handled automatically by the compiler. This is not the source of your leaking. Did you change the recognition_text property to return a WideString instead of a String, like I suggested 8 months ago? What does the implementation of Get_text() actually look like?
  17. Alexander Sviridenkov

    Dynamic creation of SQL queries

    SQL Framework (part of HTML Library bundle) is designed for creating, parsing and modifying SQL queries based on database schema. You can easily add new field from existing or new table, change order/group parts, convert where conditions to joins, add/remove where conditions and much more. Please check https://delphihtmlcomponents.com/SQLLibrary.pdf
  18. FredS

    What's the best common folder for...

    Stefan covered that under 'for the program itself ', don't clutter up Documents with stuff that isn't for the user's end use.. annoying 🙂
  19. Indeed, it is! The references are resolved in TReader.FixupReferences and are based on component names. To wire the datasource on the datamodule to the controls on the form, the datamodule has to be created before the form loads. As all forms and datamodules register themselves in the Screen.Forms and Screen.Datamodules lists, they are found by simply iterating over these lists in the Vcl.Forms.FindGlobalComponent procedure, which is registered via RegisterFindGlobalComponentProc. You can register your own FindGlobalComponentProc this way, which takes precedence over the internal one (System.Classes.FindGlobalComponents uses a reverse loop). The implementation might be a bit tricky, though.
  20. limelect

    Dicom VCL Library

    I have a few Dicom Sources.
  21. David Heffernan

    JSON string value

    Python documentation is excellent. Likewise C# documentation. And so on. Delphi is an outlier here.
  22. Angus - I emailed the files to you. Don't forget the instructions too: The installation instructions need this to be added in the readme: The Embarcadero installation adds this to the system path: C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl This however does not allow Win32 packages to be installed, to do that you need to add this path to the system path (win10=Start, Edit the system environment variables, Environment variables, System variables, Path, Edit, New:) C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl\Win32 NEW projects that need to use ICS: include path: add {THE DIR YOU EXTRACTED ICS To}\source\include\103\win32 library path add C:\Users\Public\Documents\Embarcadero\Studio\20.0\BPL\Win32
  23. I still use C++ Builder 6 for some things (with ICS 5), but I missed a lot of upgrades/versions since a couple of years ago. Some of the components have issues in 10.3 as well, I think the THttpServer has errors if I add it to a form and try to compile. Let's begin with the fixes I mention above and I'll see what else I can figure out.
  24. Angus, I appreciate the work everyone does on this. My instructions above should be plenty for you to make the corrections, but if you would like me to make them and submit to you a zip with only the files changed, I can do that. The step above about replacing false with 0 might apply to other cbproj files besides 10.3 as well, so I can do a search to identify them and fix them as well. PM me your email address. Thanks, Alan
  25. Because ICS is entirely supported by volunteers, and none of us understand C++. It would be far easier to cease support for C++. I've asked for assistance in producing C++ packages in the past, and one user kindly supplied some mostly working stuff, for 10.2 which I modified for 10.3, so renaming errors are mine. But when I can not build the packages and no-one else helps, errors are inevitable. So will some-one please email me a complete working set of 10.3 C++ package files, with whatevery changes are needed for the readme, and they will be placed in the distribution. I'm not going to work from a list of instructions I can not test. Angus
×