Component vs App

Hello,

I’m getting started with legato framework, just completed the helloWorld demo and then started developing my own code. I was wondering about the following:

I want to separate the connection-related functionality from the “Application” code I’m writing before installing my App onto the device, so what I have opted to do is have 2 Apps installed: one running my “Application” code and the other running legato connection-related checkups periodically which would check if I have lost my connection and if so restart it. Now the question here is Should the App monitoring the connection be a component of an App within my original App?

Thanks,
MG

1 Like

What’s the relationship between your original Application code and Connection-Monitoring Code?
From your description, it seems two independent application, one is your original App and another one is Connection-Monitor App.

@JordanZhao Theoretically speaking there should not be any relationship between the 2 Apps; One should be monitoring connection status & the other would be collecting data to be sent over the network when needed.

Another question here if possible: If I find that my connection is down, is there a modem reset mechanism/API functions I can use to reset modem in case i find out that my connection is down? I think I found that I can reset my SIM if needed but if I can do that to modem instead it would be better.

For the first question, If there is no relationship between the 2 apps, then the App monitoring the connection no need to be a component of an App within your original App.
For the second question, you can use a Connection hander called le_data_AddConnectionStateHandler() to monitor the connection state and re-start the network connection if needed.
please refer to le_data Interface - Legato Docs for API usage.

For reboot, please try below Macro in adef.
faultAction: reboot

1 Like