static void button_1_press_handle(GPIO_IO_Type pin_level)
{
    if (pin_level == GPIO_IO_LOW) {
        LOG_INFO("button pressed\r\n");

        if (os_timer_is_running(&g_reset_prov_timer)) {
            if (WM_SUCCESS != os_timer_deactivate(&g_reset_prov_timer)) {
                LOG_ERROR("deactivating reset provision timer failed\r\n");
            }
        }
		
        if(WM_SUCCESS != os_timer_activate(&g_reset_prov_timer)) {
			LOG_ERROR("activating reset provision timer failed\r\n");
		}

    } else {
        LOG_INFO("button released\r\n");
        os_semaphore_put(&btn_pressed_sem);

        if (os_timer_is_running(&g_reset_prov_timer)) {
            if (WM_SUCCESS != os_timer_deactivate(&g_reset_prov_timer)) {
                LOG_ERROR("deactivating reset provision timer failed\r\n");
            }
        }
    }
}
static void gw_actv_timer_cb(os_timer_arg_t arg)
{
    GW_WIFI_STAT_E wf_stat;
    wf_stat = get_wf_gw_status();
    if(wf_stat != STAT_STA_CONN) {
        // PR_DEBUG("we can not active gw,because the wifi state is :%d",wf_stat);
        return;
    }
    else {
        PR_DEBUG("now,we'll go to active gateway");
    }

    OPERATE_RET op_ret;
    #if NO_DEF_GW_DEV_ACTV_IF
    op_ret = httpc_gw_active();
    if(OPRT_OK != op_ret) {
        PR_ERR("op_ret:%d",op_ret);
        return;
    }
    #else
    op_ret = httpc_gw_dev_active(&(gw_cntl.dev->dev_if));
    if(OPRT_OK != op_ret) {
        PR_ERR("httpc_gw_dev_active error:%d",op_ret);
        return;
    }

    os_mutex_get(&gw_mutex, OS_WAIT_FOREVER);
    gw_cntl.dev->dev_if.bind = TRUE;
    gw_cntl.dev->dev_if.sync = FALSE;
    os_mutex_put(&gw_mutex);
    
    op_ret = ws_db_set_dev_if(&gw_cntl.dev->dev_if);
    if(OPRT_OK != op_ret) {
        PR_ERR("ws_db_set_dev_if error,op_ret:%d",op_ret);
    }
    #endif
    check_all_dev_if_update();

    os_timer_deactivate(&gw_actv_timer);
}
static void dev_ul_timer_cb(os_timer_arg_t arg)
{
    if(get_gw_status() <= ACTIVE_RD) {
        os_timer_deactivate(&dev_ul_timer);
    }

    GW_WIFI_STAT_E wf_stat;
    wf_stat = get_wf_gw_status();
    if(wf_stat != STAT_STA_CONN) {
        // PR_DEBUG("we can not update info,because the wifi state is :%d",wf_stat);
        return;
    }
    else {
        PR_DEBUG("now,we'll go to update device info");
    }

    // TODO 1 http device bind 
    //      2 device info update
    GW_CNTL_S *gw_cntl = get_gw_cntl();
    DEV_CNTL_N_S *dev_cntl = NULL;
    BOOL close_timer = TRUE;
    OPERATE_RET op_ret = OPRT_OK;

    for(dev_cntl = gw_cntl->dev;dev_cntl;dev_cntl = dev_cntl->next) {        
        // device bind
        if(FALSE == dev_cntl->dev_if.bind) {
            PR_DEBUG("bind");
            op_ret = httpc_dev_bind(&dev_cntl->dev_if);
            if(OPRT_OK != op_ret) {
                close_timer = FALSE;
                continue;
            }

            os_mutex_get(&gw_mutex, OS_WAIT_FOREVER);
            dev_cntl->dev_if.bind = TRUE;
            dev_cntl->dev_if.sync = FALSE;
            os_mutex_put(&gw_mutex);

            op_ret = ws_db_set_dev_if(&dev_cntl->dev_if);
            if(OPRT_OK != op_ret) {
                PR_ERR("ws_db_set_dev_if error,op_ret:%d",op_ret);
            }
        }

        // device info update
        if(TRUE == dev_cntl->dev_if.sync && \
           TRUE == dev_cntl->dev_if.bind) {
            PR_DEBUG("update");
            op_ret = httpc_dev_update(&dev_cntl->dev_if);
            if(OPRT_OK != op_ret) {
                close_timer = FALSE;
                continue;
            }

            os_mutex_get(&gw_mutex, OS_WAIT_FOREVER);
            dev_cntl->dev_if.sync = FALSE;
            os_mutex_put(&gw_mutex);

            op_ret = ws_db_set_dev_if(&dev_cntl->dev_if);
            if(OPRT_OK != op_ret) {
                PR_ERR("ws_db_set_dev_if error,op_ret:%d",op_ret);
            }
        }
    }

    if(TRUE == close_timer) {
        int ret = os_timer_deactivate(&dev_ul_timer);;
        PR_DEBUG("close timer ret:%d",ret);
    }
}