Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

delphi starter edition

Mark Erbaugh
Mark Erbaugh Member ✭✭
edited February 2020 in SmartSDR API
I just noticed that Embarcadero has a Delphi Code Camp and free Delphi Starter Edition available through September 9. I used to program in older versions of Delphi and found it very easy to use. Is it possible to call the FlexLib API from Delphi?

Answers

  • Neal_K3NC
    Neal_K3NC Member ✭✭
    edited February 2020
    It is possible to call a dot net library from Delphi but you will find it much easier to bypass it and talk directly to the radio (I am really sure!).
  • Mark Erbaugh
    Mark Erbaugh Member ✭✭
    edited September 2016
    Neal,

    Thanks for the reply and the encouragement to talk directly to the radio. I would think it would be possible to encapsulate the radio interface into a Delphi component that would make it easy to develop custom applications. Years ago, I developed a Delphi component that encapsulated the interface to the TenTec Pegasus and wrote an article about it that was published in QEX. Ironically, it was the same issue (September/October 2002) with Gerald's Software-Defined Radio for the Masses (part 2) that got me interested in SDR.
  • Neal_K3NC
    Neal_K3NC Member ✭✭
    edited September 2016
    Thats amazing! If I had more time I would do the same thing. I have never done component development but just having a libarary would be a big step up. My main programming language is Delphi and the new version is killer. It can do Android/IoS/Mac/PC development with its great development environment. Its expensive but I have felt it worthwhile.
  • Mark Erbaugh
    Mark Erbaugh Member ✭✭
    edited September 2016
    Yes, Delphi has gotten pricey. I'm no longer doing professional software development, so I stopped upgrading Delphi back at Delphi 8. The Starter edition only does Windows 32 development, but should work for my playing around.
  • James Whiteway
    edited September 2016
    You can use the ethernet api to talk to the radio. It's more work, but doable. That's what William did when he created his Android app. I don't know if Delphi can use dll's created by other languages. James WD5GWY
  • James Whiteway
    edited September 2016
    Did a quick Google search.on using dll's created with C# from Delphi. Got a ton of hits. Looks like it can be done. Some data types might require some work arounds. But, on the surface, I'd say.it can be done. Good luck! James WD5GWY
  • John G3WGV
    John G3WGV Member ✭✭
    edited February 2020
    I've written a Delphi-based API that talks directly to the radio. It's written with Delphi XE7 but I don't think there's anything in the code that requires more than D6 apart from my use of ansichar and so on as a result of the later versions of Delphi supporting unicode. Easily changed.

    I didn't write it as a component, although it could be converted fairly easily I think. It's just a set of units with an interface unit that contains all the external interfaces. It's still in early development but it handles everything that the radio sends, both TCP and UDP, turning each transaction into an event that can be hooked by the application. It doesn't have full support yet for sending commands TO the radio but that's the easy bit.

    I'm only an amateur software developer, so my code is quite simple... but it does work! If anyone's interested in it I'm happy to make the source available.
  • Mark Erbaugh
    Mark Erbaugh Member ✭✭
    edited September 2016
    John,

    I am  interested in the API.

    73,
    Mark
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    OK, you can get the current API here. Some notes:

    The code isn't complete. I wrote it originally to allow my home brew logging program to read/control frequency/mode. It grew to include all the other message events but does not have much in the way of code to send commands TO the radio. I will be adding more code before long, as this is likely to be my Mk2 controller interface.

    Obviously the code is supplied on an as-is basis, with no warranties of any sort. All I will say is that it works for me!

    The API code comprises four Delphi units:
    FlexAPI.pas exposes all events and procedures to the application
    FlexTCP.pas contains all the TCP/IP code
    FlexUDP.pas contains all the UDP code including discovery
    FlexData.pas contains all the variables

    FlexAPITemplate.pas is an initial attempt to provide an application template. It should give some ideas how to use the interface.

    FlexAPITest is a simple form application that lets you do things with the API and see what happens. Apart from giving a really useful insight into the API's inner workings, it also gives some ideas on application implementation.

    Have fun and let me know how you get on.

    73, John, G3WGV
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    My apologies: you will also need DelphiTTT.pas

    This is just a bunch of string handling functions that I wrote many moons ago. I tend to use them as if they were standard Delphi without thinking.
  • Neal_K3NC
    Neal_K3NC Member ✭✭
    edited September 2016
    John I would love to see it!
    73
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    You're welcome to, Neal, as is anyone else. Please see above for the two links.
  • Jean Louis
    Jean Louis Member
    edited September 2016
    Thank you for Delphi code that allows me have to find out 
    why the discovery does not support Delphi xe2 pro. As against to avoid the error if SmartSdr not start ,
    replace the StrToInt by StrToIntDef ,
    and also by StrToFloat StrToFloatDef . 73 . (sorry for my english, thank you to google translate :) )
  • Neal_K3NC
    Neal_K3NC Member ✭✭
    edited December 2016
    John, do you have any update on your library or is the link above current?

    73 es thanks so much for this and the API document
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    Hi Neal,

    The library has moved on considerably! I'll make up an new distro and put the link here shortly.

    73, John, G3WGV
  • Neal_K3NC
    Neal_K3NC Member ✭✭
    edited December 2016
    I would love to see a Donate Here button to help contribute to the cost of this!

  • John G3WGV
    John G3WGV Member ✭✭
    edited January 2017
    I have uploaded the latest version of the G3WGV Delphi Flex API library to my Dropbox.

    This code is still under quite extensive development and changes most days as I find new features that I want to play with. I also keep on finding bugs, though fewer of those these days I am pleased to say. It is the basis of my Mk II FlexRadio Controller Project and it works a treat in that.

    I don't want and will not accept donations for this software. It is my pleasure to donate it to the Flex community in the spirit of amateur radio. If so inclined you can send me the occasional attaboy in the form of a like should you find the code interesting or useful.

    Enjoy :-)

    73, John, G3WGV
  • John G3WGV
    John G3WGV Member ✭✭
    edited January 2017
    As an example of how to use the Delphi Flex API library, I have uploaded the project source for the Flex API Test Harness that I have described elsewhere. This is a really useful tool for discovering how the API works and it uses a good number of the library functions.
  • Mark WS7M
    Mark WS7M Member ✭✭
    edited November 2018
    Hi All,

    I was a Delphi programmer for 23 years starting back with Turbo Pascal 1.0 and ending with XE7.

    Delphi is a cool language and the fact that it mostly compiles to a single EXE has always been attractive.

    My current job has me working in C# which is also a nice language and quite frankly if you stay with WinForms it is very Delphi like in how you do things.

    I'm not selling anyone anything but the very fact that VS community edition is completely free makes purchasing Delphi a tough choice.  I do own XE7 but it cost a lot and I felt support was almost non-existent on critical path issues.

    Using the Ethernet API is really quite easy.

    Mark WS7M
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    I think that if I didn't have a similar Pascal/Delphi lineage to yours, Mark, I would probably have adopted C long ago. I only programmed professionally for a few years back in the early 70s and that was mainly in assembler and Algol-like languages, so Turbo Pascal was the obvious language for me. As an amateur coder, I've stuck with it right the way through to XE7 and it still does what I want. At the moment I have no plans to upgrade beyond XE7.

    I do also use VS with C, for programming on the Arduino. I'm happy enough programming in C but after so many years I feel more at home with Delphi. I like the extensive debugging facilities and the considerably faster compilation speeds as well. And, of course, there is no commercial imperative to make me change!

    You're right though, Delphi is expensive.

    73, John, G3WGV

  • Neal_K3NC
    Neal_K3NC Member ✭✭
    edited December 2016
    I have been a long-time subscriber but the purchase of Embarcadero by Idera was the last step for me. I bought the Remobjects Oxygene package which offers a very modern Object Pascal implementation for the dot net framework and it is fantastic. I hope that Delphi incorporates the langage enhancements as they really speed up development!

    Meanwhile I am very appreciative of the hard work John has done for a Delphi library!
  • Mark WS7M
    Mark WS7M Member ✭✭
    edited December 2016
    Hi John,  Well I worked for a custom system integrator for most of those 23 years.  The owner of that company was a Delphi fan.  We did C, C++ for many projects and I am comfortable with that language and well pretty much every language.

    I long ago came to the point in my development career where I no longer care much about the language itself but rather does it and the IDE help me get the job done.  This is my current grip with C++ which I like quite a lot but I still need to define objects in 2 files.  To me this is extra work. 

    If I was working for a defense contractor and needed to publish interfaces that would allow others to use my code but not modify it then sure it is fine.  C# has solved this with the interfaces which yes, can require a separate file but you don't really need to use them which for many of my tasks is a good thing.

    My fond story about Turbo Pascal 1.0 is this.  My boss at the time had written a meeting management program in Pascal using DRC Pascal MT+.   This product was so full of bugs it was not funny.  We at one point got one of the developers at DRC to send us their current issues list.  It was close to 100 double sided pages of things like:

      function Trunc( v:real ) : real;

    Truncates the decimal part of a real number returning the whole number part.  Bug: this function is not currently working.  Work around:  Do not use this function

    I mean virtually everything in the library ended up with "Do not use this function" so my boss in his meeting manager had written his own versions of many things.

    In the back of Byte magazine we saw an add for Turbo Pascal for $24.95.  Pascal MT+ was close to $350.  On a whim he ordered it.   A few days later it came.  As you might remember it was a built in editor as well.

    My boss loaded up his meeting manager, it took a little searching to reference the other pascal files.  Then we looked for the compile button.  It was something like F9 or something.  I can't remember.    Anyway we were huddling around the screen, my boss it F9 and the screen blinked and came back to the editor. 

    Our first thought was ok it crash, it didn't compile, or something.   We hit the compile button again.  Another blink and back to the editor.  We both figured it was a joke and didn't work.

    We exited to DOS and noticed there was a meetmgr.com file sitting in the directory.  It was like 25k in size.   Curious we ran it and up came my boss's meeting manager.  He keyboarded through the various functions and everything was there and just working.

    We loaded up MT+ and compiled the meeting manager and it took something like 3 minutes with the final linking phase.  The compile under TP was less than 2 seconds and it was so fast that the IDE didn't put up any progress indicators or give us a complete message!

    Later as we used TP with bigger projects it would give us progress indicators but in my experience nothing compiled that fast.  Plus just about every single function in the library worked.

    It was the selling point for us in moving down the "Turbo" line of products.  When Delphi 1.0 came out we had a big project that the client company wanted in C.  We sold them on letting us build it in Delphi.   There was much discussion about C versus Pascal, etc.  In the end we were told when the product was done that it was the first piece of software they'd ever had that didn't crash.  It controlled a stage and a camera on a microscope.  It caused their department to switch to C++ builder.

    Anyway there is much about Delphi I like.  There is also a lot about C# I like.  But again I don't really care and will develop in whatever makes the most sense for the project at hand.
  • John G3WGV
    John G3WGV Member ✭✭
    edited December 2016
    Hi Mark,

    Love the story about TP1 and compile speeds. Yes, it was blisteringly fast and produced very tight code. XE7 is still pretty quick but, like everything else these days one can hardly call the code it produces compact!

    I developed my Mk 1 controller entirely in C for the Arduino. The standard Arduino DevEnv is a very basic IDE and it is as slow as a slow thing in a slow place on a slow Monday. Something like 45 seconds to compile the controller code. I moved the DevEnv across to Visual Micro under VS and that speeded things up a bit but it still takes around 25 seconds. Then, of course, it has to be uploaded to the Arduino target.

    Meanwhile, my Mk II controller, which is written in XE7 and which has much more code compiles, links and runs on the same machine in two seconds or less!

    I spent the few years I was programming professionally working on mission critical air traffic control systems, doing real time stuff like radar data processing. On the machines of the era we could ill afford sloppy code, from both a memory and real time performance point of view. Much was written in IBM assembler as a result but where we did use high level code it was in a strange Algol-derived language called JOVIAL. Looking back on it, it was a pretty horrid language but it produced tight code and for most part it didn't give us too many nasty surprises.

    Anyway, apropos of my controller project, it is what it is. I wrote the code for my own use and it does that just fine. If anyone else can use it or glean useful insight from it in other ways then that is icing on the cake!

    73, John, G3WGV

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.