コード例 #1
0
void WD_SYSTEM perform_sync2(void)
{
    if(perform_count == 0)
    {
        performtest_printf(&g_performtest);
        os_timer_disarm(&test_timer2);
    }
    else
    {
        os_delay_us(1000 * g_performtest.d_tm_trysync_delay);

        wilddog_increaseTime(g_performtest.d_tm_trysync_delay);
        wilddog_trySync();

        os_timer_setfn(&test_timer2, (os_timer_func_t *)perform_sync2, NULL);
        os_timer_arm(&test_timer2, 1000, 0); 
    }


}
コード例 #2
0
void WD_SYSTEM performtest_handle
	(
	u32 delay_tm,
	const u8 *p_url,
	u32 tree_num, 
	u8 request_num
	)
{
    u8 m = 0;
    Wilddog_T wilddog = 0;
        
    performtest_init(delay_tm,tree_num,request_num);
    performtest_setSysState(SYS_HSK);

    wilddog = wilddog_initWithUrl((Wilddog_Str_T*)p_url);
    if(0 == wilddog)
    {
        return;
    }
    perform_count = 0;
    performtest_setSysState(SYS_AUTHRECV);
    performtest_timeReset();
    while(1)
    {
        wilddog_trySync();
        if(SYS_ISIN(SYS_APPLICATIONSENDING))
            break;
    }
    performtest_timeReset();
    for(m=0; m < request_num; m++)
    {
        performtest_timeReset();
        /*printf("g_performtest.d_tm_star = %ul\n", g_performtest.d_tm_star);*/
        int res = wilddog_getValue(wilddog, test_onQueryFunc, NULL);
        performtest_getSendTime();
        /*printf("g_performtest.d_tm_send = %ul\n", g_performtest.d_tm_send);*/
        if(0 == res)
            perform_count++;
        else
            g_performtest.d_send_fault++;
        /*printf("send =%d;res =%d \n",perform_count,res);*/
    }
    performtest_timeReset();
    performtest_setSysState(SYS_APPLICATIONRECV);
    while(1)
    {
        if(perform_count == 0)
        {
            //printf("break\n");
            performtest_printf(&g_performtest);
            break;
        }
#ifdef WILDDOG_PORT_TYPE_WICED
        wiced_rtos_delay_milliseconds(g_performtest.d_tm_trysync_delay);
#else
#if defined WILDDOG_PORT_TYPE_ESP
        os_delay_us(1000 * g_performtest.d_tm_trysync_delay);
#else
        usleep(g_performtest.d_tm_trysync_delay);
#endif
#endif
        wilddog_increaseTime(g_performtest.d_tm_trysync_delay);
        wilddog_trySync();
    }
    wilddog_destroy(&wilddog);
    return;
}
コード例 #3
0
void performtest_handle( u32 delay_tm,u8 tree_num, u8 request_num)
{
	u8 m = 0;
	Wilddog_T wilddog = 0;
    u8 url[64]={0};
	
    sprintf((char*)url, "coaps://c_test.wilddogio.com/performtest/tree_%d", tree2len[tree_num]);
	
	performtest_init(delay_tm,tree_num,request_num);
	performtest_setSysState(SYS_HSK);

	wilddog = wilddog_initWithUrl(url);
		  
	if(0 == wilddog)
	{
		return;
	}
	perform_count = 0;
	performtest_setSysState(SYS_AUTHRECV);
	performtest_star_tm();
	while(1)
	{
		wilddog_trySync();
		if(SYS_ISIN(SYS_APPLICATIONSENDING))
			break;
	}
	performtest_star_tm();
	for(m=0; m < request_num; m++)
	{
		performtest_star_tm();
		/*printf("g_performtest.d_tm_star = %ul\n", g_performtest.d_tm_star);*/
		int res = wilddog_getValue(wilddog, test_onQueryFunc, NULL);
		performtest_tm_getSend();
		/*printf("g_performtest.d_tm_send = %ul\n", g_performtest.d_tm_send);*/
				if(0 == res)
			perform_count++;
		else
			g_performtest.d_send_fault++;
		/*printf("send =%d;res =%d \n",perform_count,res);*/
	}
	performtest_star_tm();
	performtest_setSysState(SYS_APPLICATIONRECV);
	while(1)
	{
		if(perform_count == 0)
		{
			//printf("break\n");
			performtest_printf(&g_performtest);
			break;
		}
#ifdef WILDDOG_PORT_TYPE_WICED
		wiced_rtos_delay_milliseconds(g_performtest.d_tm_trysync_delay);
#else 
		usleep(g_performtest.d_tm_trysync_delay);
#endif
		wilddog_increaseTime(g_performtest.d_tm_trysync_delay);
		wilddog_trySync();
	}
	wilddog_destroy(&wilddog);
	return;
}