#define DEBUG_LOG_MODULE_NAME "POSAPP"
#ifdef DEBUG_POSLIB_LOG_MAX_LEVEL
#define DEBUG_LOG_MAX_LEVEL DEBUG_POSLIB_LOG_MAX_LEVEL
#else
#define DEBUG_LOG_MAX_LEVEL LVL_NOLOG
#endif
#include "posapp_settings.h"
#include "board.h"
#ifdef BUTTON_ENABLED
#endif
#ifdef CONF_USE_LED_NOTIFICATION
#endif
#ifdef MOTION_SUPPORTED
#include "motion.h"
#endif
#ifdef CONF_USE_PERSISTENT_MEMORY
#endif
 
#ifdef BUTTON_ENABLED
#define BUTTON_ID   0
#endif
#ifdef CONF_USE_LED_NOTIFICATION
#define LED_ON true
#define LED_OFF false
 
#define LED_ID 0
#endif
 
 
#ifdef BUTTON_ENABLED
 
static void button_pressed_cb(uint8_t button_id, 
button_event_e button_event)
 
{
    LOG(
LVL_DEBUG, 
"Start oneshot. Button event %u button id %u", button_event, button_id);
 
#ifndef APP_PRINTING
    (void) button_id;
    (void) button_event;
#endif
}
 
static void enable_button(void)
{
 
 
    {
        LOG(
LVL_INFO, 
"Oneshot request active on button id %u", BUTTON_ID);
 
    }
    else
    {
        LOG(
LVL_ERROR, 
"Registration for button id: %u failed.", BUTTON_ID)
 
    }
}
#else
static void enable_button(void) {}
#endif
 
#ifdef CONF_USE_PERSISTENT_MEMORY
static uint32_t App_persistent_data_write(void)
{
 
    PosApp_Settings_store(&settings);
}
#endif
 
#ifdef MOTION_SUPPORTED
{
}
 
{
    {
        posapp_motion_ret_e res_mon;
        posapp_motion_mon_settings_t motion_cfg = {
            .cb = motion_cb
        };
 
        res_mon = PosAppMotion_startMonitoring(&motion_cfg);
 
        if (res_mon != POSAPP_MOTION_RET_OK)
        {
            LOG(
LVL_ERROR, 
"Cannot activate motion monitoring! res: %u", res_mon);
 
            return false;
        }
    }
    else
    {
        PosAppMotion_stopMonitoring();
    }
 
    return true;
}
#endif
 
{
 
    {
 
#ifdef MOTION_SUPPORTED
    update_motion(&settings.
motion);
 
#endif
 
#ifdef CONF_USE_PERSISTENT_MEMORY
 
#endif
    }
}
 
 
{
    (void) msg;
 
#ifdef CONF_USE_LED_NOTIFICATION
 
    {
    }
#endif
}
 
{
    (void) msg;
 
#ifdef CONF_USE_LED_NOTIFICATION
 
    {
    }
#endif
}
 
{
 
    
 
    PosApp_Settings_get(&settings);
 
 
    {
        return res;
    }
 
 
    {
        LOG(
LVL_ERROR, 
"PosLib cannot register event %u failed. res: %d", event, res);
 
        return res;
    }
 
    {
        LOG(
LVL_ERROR, 
"PosLib cannot register event %u failed. res: %d", event, res);
 
        return res;
    }
    {
        LOG(
LVL_ERROR, 
"PosLib cannot register event %u failed. res: %d", event, res);
 
        return res;
    }
 
#ifdef MOTION_SUPPORTED
    update_motion(&settings.
motion);
 
#endif
 
 
    {
        LOG(
LVL_ERROR, 
"PosLib start periodic failed. res: %d", res);
 
    }
 
    return res;
}
 
{
    (void) functions;
 
    PosApp_Settings_configureNode();
 
    enable_button();
 
    
    #ifdef MOTION_SUPPORTED
    PosAppMotion_init();
    #endif
 
    #ifdef CONF_VOLTAGE_REPORT
    
    #endif
 
    
    lib_state->startStack();
 
    
    App_start_positioning();
 
}