Implement endpoint_diagnose app for recording hardware information
A new app is required to let the user have the endpoint and hardware status.
The naming of the app is endpoint_diagnose.
Goal: Record or log the following information:
- [x] Signal strength
- [x] GPS
- [x] Timestamp
- [ ] Transaction sending failure
I am trying to use the API offered by Legato to get these informations.
To use the API, we must include the corresponding header file and modify the Component.cdef and the .adef file.
When I was trying to get the signal strength, everything went well.
- Include
le_mrc_interface.h - Component.cdef
requires: { api: { modemServices/le_mrc.api } } - .adef
bindings: { test.testComp.le_mrc -> modemService.le_mrc }
However, when I was trying to get the information of GPS, the app just hung there. It did not start to execute at all. I just add the following modification:
- Component.cdef
requires: { api: { modemServices/le_mrc.api positioning/le_gnss.api } } - .adef
bindings: { test.testComp.le_mrc -> modemService.le_mrc test.testComp.le_gnss -> positioning.le_gnss }
I will try to figure out the problem.
The problem has been solved. Just replace positioning with positioningService in .adef file.
However, there are things to be mentioned:
- Somehow the GPS information has latitude and longitude but no horizontal accuracy.
- The minute and second of the time information are correct, and the others are wrong.
After the hardware is connected to the network, the time is synchronized. Check https://docs.legato.io/latest/howToSetUserTimebase.html.
However, the Linux command date is correct but the time APIs give the wrong time without considering the time zone.
For the IPC between endpoint and diagnose app, I reference the Low-level Messaging API and add the corresponding APIs.
It does not work because of the lacking of the binding, which should be added in *.adef and *.cdef.
However, the rule to write the binding is not quite clear in the Legato document.
For communicate with two components in same executable, you can refer to the Extend helloWorld.