static void start_auto_netmgr_timer() { int ms = AUTO_NETMGR_TIMEOUT; LOG("%s", __func__); if (auto_netmgr == false) return; if (aos_timer_new(&auto_netmgr_timer, auto_netmgr_timer_fn, NULL, ms, 0) != 0) { LOG("Error: aos_timer_new failed in %s", __func__); return; } if (aos_timer_start(&hotspot_timer) != 0) { LOG("Error: aos_timer_start failed in %s", __func__); return; } }
static void awss_hotspot_connected_handler() { int ms; LOG("%s", __func__); if (auto_netmgr == false) return; ms = get_hotspot_timeout(); stop_timer(&auto_netmgr_timer); if (aos_timer_new(&hotspot_timer, hotspot_timer_fn, NULL, ms, 0) != 0) { LOG("Error: aos_timer_new failed"); return; } if (aos_timer_start(&hotspot_timer) != 0) { LOG("Error: aos_timer_start failed"); return; } }
void k_timer_start(k_timer_t *timer, uint32_t timeout) { int ret; ASSERT(timer, "timer is NULL"); BT_DBG("timer %p,timeout %u", timer, timeout); timer->timeout = timeout; timer->start_ms = aos_now_ms(); ret = aos_timer_stop(&timer->timer); if (ret) { BT_DBG("fail to stop timer"); } ret = aos_timer_change(&timer->timer, timeout); if (ret) { BT_DBG("fail to change timeout"); } ret = aos_timer_start(&timer->timer); if (ret) { BT_DBG("fail to start timer"); } }