Asset_tracker_V2 main module vs event modules and event_handler vs log_event

I testing asset_trcker_v2 and want to add new custom event module. I have few doubts and queries:

1. There is event_handler function in each module as well in main fuction module. Are all the event handlers exucted ? if yes, how and when ? 

2. There is log_event in each module which linked in EVENT_DEFINE .. What functionality should be implemented in log_event ? and what shpuld be implemented in event_handler funcion

3. The event_handler is linked in EVENT_LISTNER  ... when event_handler is executed and when log_event is executed  by the Zephyr OS ?

4. As well there are thread_fn in each module. When these threads are executed and how ?

5. As well there is a structure in each module like 

struct app_msg_data {
union {
struct cloud_module_event cloud;
struct ui_module_event ui;
struct sensor_module_event sensor;
struct data_module_event data;
struct util_module_event util;
struct modem_module_event modem;
struct app_module_event app;
struct bms_module_event bms;
} module;
};

why these have been included repeatitevely in each   ....module.c file ?

6. what is purpose of PROFILER ? 

7. What functionality is performed by module_enqueue_msg() function ?

Parents
  • Hello,

    Most of the functions are described in our documentation and SDK. 
    Please see the Event Manager documentation
    Please see Asset Tracker v2 documentation

    1. There is event_handler function in each module as well in main fuction module. Are all the event handlers exucted ? if yes, how and when ? 

    See Event Manager documentation.

    2. There is log_event in each module which linked in EVENT_DEFINE .. What functionality should be implemented in log_event ? and what shpuld be implemented in event_handler funcion

    See nrf\include\event_manager.h

    3. The event_handler is linked in EVENT_LISTNER  ... when event_handler is executed and when log_event is executed  by the Zephyr OS ?

    See nrf\include\event_manager.h

    4. As well there are thread_fn in each module. When these threads are executed and how ?

    Have a look at the Thread Usage

    why these have been included repeatitevely in each   ....module.c file ?

    https://en.wikipedia.org/wiki/Struct_(C_programming_language),

    6. what is purpose of PROFILER ? 

    Please see the Profiler documentation

    7. What functionality is performed by module_enqueue_msg() function ?

    /** @brief Enqueue message to a module's queue.
     *
     *  @param[in] module Pointer to a structure containing module metadata.
     *  @param[in] msg Pointer to a message that will be enqueued.
     *
     *  @return 0 if successful, otherwise a negative error code.
     */
    int module_enqueue_msg(struct module_data *module, void *msg);

    Kind regards,
    Øyvind

Reply
  • Hello,

    Most of the functions are described in our documentation and SDK. 
    Please see the Event Manager documentation
    Please see Asset Tracker v2 documentation

    1. There is event_handler function in each module as well in main fuction module. Are all the event handlers exucted ? if yes, how and when ? 

    See Event Manager documentation.

    2. There is log_event in each module which linked in EVENT_DEFINE .. What functionality should be implemented in log_event ? and what shpuld be implemented in event_handler funcion

    See nrf\include\event_manager.h

    3. The event_handler is linked in EVENT_LISTNER  ... when event_handler is executed and when log_event is executed  by the Zephyr OS ?

    See nrf\include\event_manager.h

    4. As well there are thread_fn in each module. When these threads are executed and how ?

    Have a look at the Thread Usage

    why these have been included repeatitevely in each   ....module.c file ?

    https://en.wikipedia.org/wiki/Struct_(C_programming_language),

    6. what is purpose of PROFILER ? 

    Please see the Profiler documentation

    7. What functionality is performed by module_enqueue_msg() function ?

    /** @brief Enqueue message to a module's queue.
     *
     *  @param[in] module Pointer to a structure containing module metadata.
     *  @param[in] msg Pointer to a message that will be enqueued.
     *
     *  @return 0 if successful, otherwise a negative error code.
     */
    int module_enqueue_msg(struct module_data *module, void *msg);

    Kind regards,
    Øyvind

Children
No Data
Related