src/luos.c
static void Luos_AutoUpdateManager(void)
{
    // check all services timed_update_t contexts
    for (uint16_t i = 0; i < service_number; i++)
    {
        // check if services have an actual ID. If not, we are in detection mode and should reset the auto refresh
        if (service_table[i].ll_service->id == DEFAULTID)
        {
            // this service have not been detected or is in detection mode. remove auto_refresh parameters
            service_table[i].auto_refresh.target      = 0;
            service_table[i].auto_refresh.time_ms     = 0;
            service_table[i].auto_refresh.last_update = 0;
        }
        else
        {
            // check if there is a timed update setted and if it's time to update it.
            if (service_table[i].auto_refresh.time_ms)
            {
                if ((LuosHAL_GetSystick() - service_table[i].auto_refresh.last_update) >= service_table[i].auto_refresh.time_ms)
                {
                    // This service need to send an update
                    // Create a fake message for it from the service asking for update
                    msg_t updt_msg;
                    updt_msg.header.target      = service_table[i].ll_service->id;
                    updt_msg.header.source      = service_table[i].auto_refresh.target;
                    updt_msg.header.target_mode = IDACK;
                    updt_msg.header.cmd         = GET_CMD;
                    updt_msg.header.size        = 0;
                    if ((service_table[i].service_cb != 0))
                    {
                        service_table[i].service_cb(&service_table[i], &updt_msg);
                    }
                    else
                    {
                        //store service and msg pointer
                        // todo this can't work for now because this message is not permanent.
                        //mngr_set(&service_table[i], &updt_msg);
                    }
                    service_table[i].auto_refresh.last_update = LuosHAL_GetSystick();
                }
            }
        }
    }
}
/******************************************************************************
 * @brief auto update publication for service
 * @param none
 * @return none
 ******************************************************************************/
@brief auto update publication for service
@param none
@return none
@brief auto update publication for service @param none @return none
static void Luos_AutoUpdateManager(void)
{
    for (uint16_t i = 0; i < service_number; i++)
    {
        if (service_table[i].ll_service->id == DEFAULTID)
        {
            service_table[i].auto_refresh.target      = 0;
            service_table[i].auto_refresh.time_ms     = 0;
            service_table[i].auto_refresh.last_update = 0;
        }
        else
        {
            if (service_table[i].auto_refresh.time_ms)
            {
                if ((LuosHAL_GetSystick() - service_table[i].auto_refresh.last_update) >= service_table[i].auto_refresh.time_ms)
                {
                    msg_t updt_msg;
                    updt_msg.header.target      = service_table[i].ll_service->id;
                    updt_msg.header.source      = service_table[i].auto_refresh.target;
                    updt_msg.header.target_mode = IDACK;
                    updt_msg.header.cmd         = GET_CMD;
                    updt_msg.header.size        = 0;
                    if ((service_table[i].service_cb != 0))
                    {
                        service_table[i].service_cb(&service_table[i], &updt_msg);
                    }
                    else
                    {
                    }
                    service_table[i].auto_refresh.last_update = LuosHAL_GetSystick();
                }
            }
        }
    }
}
static void Luos_AutoUpdateManager ( void ) { for ( uint16_t i = 0 ; i < service_number ; i ++ ) { if ( service_table [ i ] . ll_service -> id == DEFAULTID ) { service_table [ i ] . auto_refresh . target = 0 ; service_table [ i ] . auto_refresh . time_ms = 0 ; service_table [ i ] . auto_refresh . last_update = 0 ; } else { if ( service_table [ i ] . auto_refresh . time_ms ) { if ( ( LuosHAL_GetSystick ( ) - service_table [ i ] . auto_refresh . last_update ) >= service_table [ i ] . auto_refresh . time_ms ) { msg_t updt_msg ; updt_msg . header . target = service_table [ i ] . ll_service -> id ; updt_msg . header . source = service_table [ i ] . auto_refresh . target ; updt_msg . header . target_mode = IDACK ; updt_msg . header . cmd = GET_CMD ; updt_msg . header . size = 0 ; if ( ( service_table [ i ] . service_cb != 0 ) ) { service_table [ i ] . service_cb ( & service_table [ i ] , & updt_msg ) ; } else { } service_table [ i ] . auto_refresh . last_update = LuosHAL_GetSystick ( ) ; } } } } }
@brief auto update publication for service
 @param none
 @return none
@brief auto update publication for service @param none @return none
// check all services timed_update_t contexts // check if services have an actual ID. If not, we are in detection mode and should reset the auto refresh // this service have not been detected or is in detection mode. remove auto_refresh parameters // check if there is a timed update setted and if it's time to update it. // This service need to send an update // Create a fake message for it from the service asking for update //store service and msg pointer // todo this can't work for now because this message is not permanent. //mngr_set(&service_table[i], &updt_msg);