Page 1 of 1

【技术干货】互联互通对接demo

Posted: 2023年 Apr 21日 10:54
by 0x1abin

1. 功能接入

1.1 待连接IPC参数

user_main中,定义待连接的IPC的local_key和devid

Code: Select all

CHAR_T g_local_key[64] = "local_key";
CHAR_T g_remote_id[64] = "devid";

1.2 测试命令

如果需要测试中控互联互通功能,可以在IPC_APP_simulation中加入以下测试指令:

Code: Select all

else if(0 == strcmp(test_input,"tmm_test"))
{
    int ret = 0;
    for(int i=0; i<20; i++) {
        tuya_ipc_p2p_client_connect(&handle, g_remote_id, g_local_key);

        tuya_ipc_p2p_client_start_prev(handle);

        tuya_ipc_p2p_client_start_audio(handle);

        tuya_ipc_p2p_client_audio_send_start(handle);

        tuya_ipc_p2p_client_video_send_start(handle);

        tuya_ipc_p2p_client_stop_prev(handle);

        tuya_ipc_p2p_client_stop_audio(handle);

        tuya_ipc_p2p_client_audio_send_stop(handle);

        tuya_ipc_p2p_client_video_send_stop(handle);

        ret = tuya_ipc_p2p_client_disconnect(handle);
        if(ret == OPRT_OK){
            PR_INFO("disconnect success!!!!!!!!!!\n");
        }
        sleep(2);
    }  
} else if(0 == strcmp(test_input,"connect")) {
    tuya_ipc_p2p_client_connect(&handle, g_remote_id, g_local_key);
} else if(0 == strcmp(test_input,"disconnect")) {
    tuya_ipc_p2p_client_disconnect(handle);
} else if(0 == strcmp(test_input,"video_start")) {
    tuya_ipc_p2p_client_start_prev(handle);
} else if(0 == strcmp(test_input,"video_stop")) {
    tuya_ipc_p2p_client_stop_prev(handle);
} else if(0 == strcmp(test_input,"audio_start")) {
    tuya_ipc_p2p_client_start_audio(handle);
} else if(0 == strcmp(test_input,"audio_stop")) {
    tuya_ipc_p2p_client_stop_audio(handle);
} else if(0 == strcmp(test_input,"video_send_start")) {
    tuya_ipc_p2p_client_video_send_start(handle);
} else if(0 == strcmp(test_input,"video_send_stop")) {
    tuya_ipc_p2p_client_video_send_stop(handle);
} else if(0 == strcmp(test_input,"audio_send_start")) {
    tuya_ipc_p2p_client_audio_send_start(handle);
} else if(0 == strcmp(test_input,"audio_send_stop")) {
    tuya_ipc_p2p_client_audio_send_stop(handle);
} else if(0 == strcmp(test_input,"standard")) {
    tuya_ipc_p2p_client_set_video_clarity_standard(handle);
} else if(0 == strcmp(test_input,"high")) {
    tuya_ipc_p2p_client_set_video_clarity_high(handle);
}