eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
850 stars 351 forks source link

Support for the standard DCPS C interface? #171

Open eboasson opened 5 years ago

eboasson commented 5 years ago

Access to discovery information is currently available in Cyclone only through subscriptions to the built-in topics. While that provides all the required functionality, it is quite inconvenient at times.

Various functions are defined in the DDS specification to access this discovery information for a given entity by simply a calling a function, e.g., get_matched_publication_data. These need to be implemented in Cyclone as well.

i-and commented 5 years ago

Hi @eboasson, Do you plan to implement a standard DCPS C-interface of the form 'DDS_DomainParticipant_create_topic(), DDS_Publisher_create_datawriter(), DDS_StringSeq, ..' by means of the current one? This can facilitate the integration of Cyclone into current projects.

k0ekk0ek commented 5 years ago

Hi @i-and. At this point in time, no. The C api offered by Eclipse Cyclone DDS is a modern C implementation of the DCPS api (with some tweaks). Implmentations of the modern C++ and Java apis are in the works (supposedly), but implementations of the classic apis are not planned. Security, X-Types and various other bits and pieces are, I believe, more important to the project at this point.

eboasson commented 5 years ago

Hi @i-and, as you asked whether I plan on doing this, the answer is — as is so often the case with me — ever-so-slightly more subtle than @k0ekk0ek's answer.

The DCPS C interface is rather like a monster from hell. I have used it myself and I also have a fair idea of the problems in its implementation. A truly faithful implementation of the interface is a lot of work and I don't think that that effort would move forward Cyclone in the areas that matter most. So in this, I agree with @k0ekk0ek.

Furthermore, I have no desire to see that interface included in the Cyclone repository as that would immediately put a maintenance burden on the project. An independent "project" is a different story in this regard, and one worth considering as I am definitely interested in seeing existing projects start using Cyclone.

If one were to accept the cutting of some corners, it would become a pretty straightforward affair. The bit that would really require some work is in the read/take interface (Cyclone would need to be changed a bit for that, but that part of Cyclone needs a bit of work anyway). The bulk of the header files and function skeletons can be generated easily enough from the official DCPS IDL. I'd say you could get something demoable in a couple of days of slaving away.

And so, while I do believe my time would generally be better spent elsewhere, I'd be more than happy to pitch in to make it happen if someone else were to take this up. And I could conceivably be convinced to consider hacking together something if I'd know a substantial/cool project that would then take a serious look at switching to Cyclone — that'd simply be a very strong argument.

i-and commented 5 years ago

Security, X-Types and various other bits and pieces are, I believe, more important to the project at this point.

I also think so. Functioning on microcontrollers and X-Types tasks are definitely more priority.

The bulk of the header files and function skeletons can be generated easily enough from the official DCPS IDL.

Is there a utility that can perform the interface generation task automatically?

eboasson commented 5 years ago

Is there a utility that can perform the interface generation task automatically?

In principle, any IDL compiler that implements the IDL-to-C mapping. The parts of the spec used by the DCPS interface are actually pretty limited and so even writing a throwaway IDL compiler for this purpose is a pretty decent option. I once did just that for making the standard C API available in node.js (I mentioned it before: #44, which also contains a link to the preprocessor I used.)

(To me, being able to do that sort of hack is the one thing that is attractive in the original interface ... and part of the reason I am cautiously positive about having it on top of Cyclone.)