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: 
SOLVED

Create your own App it has to be always with datalayer.register.node?

Create your own App it has to be always with datalayer.register.node?

Josaphat_Aviles
Established Member

Hello,

I would like to know if it has to be always with datalayer.register.node when I create my own App? Can i try with hello world App?

7 REPLIES 7

Sgilk
Frequent Contributor

Hi @Josaphat_Aviles ,

I'm not following your question. What do you mean, does it always have to be with datalayer.register.node?

What are you trying to accomplish with your custom application? Apps can be installed in ctrlX OS with no datalayer integration at all.

There are tons of examples in the SDK Github.

In the video ( LINK), you create your own app, using the example creating pythagoras App. And the templaste that you use is datalayer.register.node.
My question is.. What is your recommendation.. Do i have to to the same?? or it doesnt matter if I what sample i use?

Sgilk
Frequent Contributor

@Josaphat_Aviles ,

It is entirely up to you. First of all, what language would you prefer? You can look through the Github examples I linked above.

I prefer c++, so here is the example I'd start with for providing nodes to the datalayer.

Thank you @Sgilk for your promt reply,
Yes is exactly what I mean, great example that you mention.
I am using C++ too. However the configurations of snapcraft.yaml and CmakLists.txt there are not the same like Hello.World proyect. for obvously reason.
However... what happend when I tried to use another libraries like: curl, cpprest, nlohman, etc.
When I tried to build the snap to arm64, collapse and I dont know why, even the output the terminal show something like *EXPERIMENTAL* --target-arch for core20 enabled.

I already try to force to build in arm, but it doesnt work.
And perhaps your question is... What do you whant to do???
Well.. basically I just whant that when Ctrlx 3 and Ctrlx 7 turn on.... detect the memory SD (with rest api) and then dectect the free capacity...
If free capacity is lower than 90% of Total capacity then:
Start to recording Data (millions of data) during aprox 1 minute, then Save data in csv in that specific SD memory. After finish to save the data... return to start again the cycle... and detect the free capacity...

When the free capacity is lower than 10% of Total capacity then: stop to save data.

All of this has to be plug and play with memory SD.. I mean the C++ code has to recognize the name of SD memory in order save it in a specific path.
The final user.. just plug and play the memory SD after each month and thats all.. The final user... just plug and play the SD memory in his laptop and start to play with data. Not more..
So with this information... what do you recommend? With all your expertise.. what do you think that will be the more efective way to do that?
Currently I am using Ctrlx Works to open a SSH.. then open it with Visual studio code and then select the app hello.world .. erase all in the main.cpp and start to code in that file.. then after many libraries like curl... and so on.. start to fail when I build snap with buil snap arm64. So I can not download to upload in the Ctrlx Core 3 and install it.

Sgilk
Frequent Contributor

@Josaphat_Aviles ,

There is a lot to unpack here. Unfortunately, I can't write the app for you.

I'd suggest learning more about cmake and snapcraft. Some of the other cpp examples have more complex cmake and snapcraft files. For instance, the simple datalayer client example. Also, when building for arm64 architecture on an amd system, it is important to understand cross compiling and snapcraft package staging.

Here are a couple code snippets that might help in building your app. I just integrated libcurl into a c++ application and built on amd for arm.

In CMakeLists.txt, it is necessary to locate and link your additional libraries. You can install libraries on Ubuntu amd for arm, but it is a bit complicated and will likely require some troubleshooting.

# Locate libcurl based on architecture
IF( ${CMAKE_BUILD_KIT} MATCHES "aarch64")
  find_library(CURL NAMES curl PATHS /usr/lib/aarch64-linux-gnu NO_DEFAULT_PATH)
ELSE()
  find_library(CURL NAMES curl)
ENDIF()

#
# Set target link libraries
#
target_link_libraries(${TARGET_PROJECT_NAME} -Wl,--no-undefined)
target_link_libraries(${TARGET_PROJECT_NAME}
  libcomm_datalayer.so
  pthread
  systemd
  zmq
  ssl
  crypto
  ${CURL}
)

In your snapcraft.yaml, it is necessary to stage the additional packages so they can be utilized by the snap at runtime.

parts:
  datalayerclient:
    plugin: dump
    source: ./generated/build
    stage-packages:
      - libzmq5
      - ctrlx-datalayer
      - libcurl4

If you can provide some more specific questions, I can give you some better answers.

@Sgilk,
Thank you for your reply,
I will try with this information.
Another question that came to my mind with your comment is...
How do you do when you program for a Ctrlx3(arm) and a Ctrlx7(amd)?
You avoid the use of Ctrlx works to generate the SSH and use virtual box, you have two virtual machines, one for arm and one for amd?

Sgilk
Frequent Contributor

@Josaphat_Aviles ,

You can do this however you prefer. Ideally you have a hardware device for each architecture you intend to develop on. That just makes things easier.

In my case, I only use an amd machine and I'm using the app build environment generated from ctrlX Works. I try my best to use cross architecture building techniques to build for arm (ie. snapcraft remote build), but it is definitely more complicated.

If you look at the samples I provided, there is configuration and scripts that are architecture specific. For example, build_snap_amd64.sh vs build_snap_arm64.sh

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