Dear Community User! We are updating our platform to a new system.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 

ctrlx SDK Realtime C

ctrlx SDK Realtime C

DavidePalombo
New Member

Hello everybody,

Our customer is planning to migrate their real-time code from an industrial PC to the ctrlX platform. The code is written in C and consists of a series of services managed by a task manager.

In the Real-Time SDK, I only find examples related to C++. Is it possible to use C, particularly to interface with the ctrlX scheduler?

Thank you in advance!

3 REPLIES 3

Sgilk
Frequent Contributor

Hi @DavidePalombo ,

The realtime system of ctrlX OS utilizes the Apache Celix framework. You can absolutely run services written in C, but there will be some C++ required to build as a Celix bundle. There is an example in the realtime SDK (samples-cpp/plc-c-interface) which creates a Celix bundle containing services written in both C and C++.

To access the realtime SDK, a training is generally required. See this article.

Hi Sgilk, 

thank you for your reply. I'll be a bit more specific:

I already have access to the realtime SDK. I read the documentation so I know the realtime system of the ctrlX utilizes Apache Celix. In particular the Celix framework support building bundles written in C (e.g. celix/examples/celix-examples/hello_world_c at master · apache/celix).

My first idea was to build a Celix bundle directly written in C, but looking at the examples provided in the rt-SDK, they use external C++ files, in particular:

  • "common/scheduler/i_scheduler3.h" for register the callable in the scheduler
  • "comm/datalayer/datalayer.h" for interacting with the datalayer-rt

While with the non-realtime SDK there are C interfaces for accessing the datalayer, in this case I was not able to find any C interfaces related to these two header files.
It means that, if a build a C Celix bundle, it will not be able to interact with the scheduler and the datalayer-rt.
Is it correct, or am I missing something?

I understand that I could put my C code wrapped inside the C++ bundles, but that would mean a heavy refactoring of the code, since it is composed by tens of services and millions of lines of code.
 
Thanks!

 

Sgilk
Frequent Contributor

@DavidePalombo ,

I don't believe we support C Celix bundles at this time. @nickH , please correct me if I'm wrong here.

Why would there need to be a heavy refactoring of the C services to wrap them in C++ bundles? I would think you could use them as is.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist