你好。新版本SDK,启动tuya_ipc_init_sdk()调用失败。返回-3.提示配置参数不正确。我对比了一下demo中的main的配置项。未能发现还需要配置哪个变量。
可以麻烦你帮忙看一下吗。下面的是串口打印日志。谢谢你。我打印了env变量数据结构的所有成员变量的值,回调函数我打印的回调函数的地址(%p)。
[09:49:48:111 INFO-]:inspExtNetwork[262]:network interface name: usb0, addr count: 0
[09:49:48:111 INFO-]:inspExtNetwork[262]:network interface name: eth1, addr count: 1
[09:49:48:152 INFO-]:externalNetwork[496]:lookup_hostname IPV4=1 addr=223.111.109.190; IPV6=0 addr=253e:cdb6:9d3c:cdb6:880b:)
[09:49:48:222 INFO-]:inspExtNetwork[273]:ipV4 externalNetwork: OK
[09:49:48:223 INFO-]:inspExtNetwork[286]:wwan0 addr info: [IPV4] 10.57.140.5
[09:49:48:223 INFO-]:cardvInputMessageProcess[3280]:==>cmd len_11:mobileNet 1
[09:49:48:223 INFO-]:cardv_cmd_handler_mobileNet[2124]:mobileNet on In
[09:49:48:223 INFO-]:tuya_main_start[487]:pid=arcakhdm8sumi4kg uuid=ldts287e8887058ce2ad key=t2na0QlZgEbrNhWfl6XwTe9fSVXGLNpF
write int exc: mkdir -p /sn_block/tuya.cfgs/;echo 0 > /sn_block/tuya.cfgs/tuya_ap_on_off
===SDK Version:< TuyaOS V:6.0.11 BS:40.00_PT:2.3_LAN:3.5_CAD:1.0.5_CD:1.0.0 >
< BUILD AT:2024_04_17_17_54_20 BY ci_manage FOR tuyaos-ipc AT gcc-sigmastar-9.1.0-2019.11-x86_64_arm-linux-gnueabihf >
IOT DEFS < WIFI_GW:1 DEBUG:0 KV_FILE:0 LITTLE_END:1 SL:1 OPERATING_SYSTEM:100 RELIABLE_TRANSFER:0 >
===szDevSWVer Version:1.0.5===
MODE:2 LINK_TYPE:1
#################################################
env.storage_path=/sn_block/tuya.cfgs/
env.online_log_path=
env.product_key=arcakhdm8sumi4kg
env.uuid=ldts287e8887058ce2ad
env.auth_key=t2na0QlZgEbrNhWfl6XwTe9fSVXGLNpF
env.p2p_id=
env.firmware_key=
env.dev_sw_version=1.0.5
env.dev_serial_num=tuya_ipc
env.dev_obj_dp_cb=0x88201
env.dev_raw_dp_cb=0x88309
env.dev_dp_query_cb=0x883dd
env.status_changed_cb=0x8a9f9
env.upgrade_cb_info=0x8aca9
env.gw_rst_cb=0x8aaed
env.gw_restart_cb=0x8ab4d
env.qrcode_active_cb=(nil)
env.mem_save_mode=0
env.dev_type=0
env.link_type=1
env.p_reserved=0
#################################################
init sdk is error
ipc sdk start fail,please check run parameter,ret=-3
TUYA_IPC_Get_MqttStatus() is FALSE
Fri Apr 19 09:49:50 UTC 2024
[09:49:50:001 INFO-]:doSystemExAchv[84]:timeSync[298]: exit status value = [0x0]
[09:49:50:001 INFO-]:doSystemExAchv[90]:timeSync[298]: run
[date -s "2024-04-19 09:49:50"]
successfully.
源码片段如下:
if(NULL == pRunInfo)
{
printf("start sdk para is NULL\n");
return OPRT_INVALID_PARM;
}
Code: Select all
OPERATE_RET ret = 0;
STATIC BOOL_T s_ipc_sdk_started = FALSE;
if(TRUE == s_ipc_sdk_started )
{
printf("IPC SDK has started\n");
return ret;
}
// memcpy(&g_sdk_run_info, pRunInfo, SIZEOF(TUYA_IPC_SDK_RUN_VAR_S));
Code: Select all
//setup1:init sdk
TUYA_IPC_ENV_VAR_T env;
memset(&env, 0, sizeof(TUYA_IPC_ENV_VAR_T));
strcpy(env.storage_path, pRunInfo->iot_info.cfg_storage_path);
strcpy(env.product_key,pRunInfo->iot_info.product_key);
strcpy(env.uuid, pRunInfo->iot_info.uuid);
strcpy(env.auth_key, pRunInfo->iot_info.auth_key);
strcpy(env.dev_sw_version, pRunInfo->iot_info.dev_sw_version);
strcpy(env.dev_serial_num, "tuya_ipc");
//TODO:raw
env.dev_raw_dp_cb = pRunInfo->dp_info.raw_dp_cmd_proc;
env.dev_obj_dp_cb = pRunInfo->dp_info.common_dp_cmd_proc;
env.dev_dp_query_cb = pRunInfo->dp_info.dp_query;
env.status_changed_cb = pRunInfo->net_info.ipc_status_change_cb;
env.upgrade_cb_info.upgrade_cb = pRunInfo->upgrade_info.upgrade_cb;
env.gw_rst_cb = pRunInfo->iot_info.gw_reset_cb;
env.gw_restart_cb = pRunInfo->iot_info.gw_restart_cb;
#if defined(QRCODE_ACTIVE_MODE) && (QRCODE_ACTIVE_MODE==1)
env.qrcode_active_cb = pRunInfo->qrcode_active_cb;
#endif
env.dev_type = pRunInfo->iot_info.dev_type;
env.link_type = pRunInfo->net_info.link_type;
printf("#################################################\n");
printf("env.storage_path=%s\n", env.storage_path);
printf("env.online_log_path=%s\n", env.online_log_path);
printf("env.product_key=%s\n", env.product_key);
printf("env.uuid=%s\n", env.uuid);
printf("env.auth_key=%s\n", env.auth_key);
printf("env.p2p_id=%s\n", env.p2p_id);
printf("env.firmware_key=%s\n", env.firmware_key);
printf("env.dev_sw_version=%s\n", env.dev_sw_version);
printf("env.dev_serial_num=%s\n", env.dev_serial_num);
printf("env.dev_obj_dp_cb=%p\n", env.dev_obj_dp_cb);
printf("env.dev_raw_dp_cb=%p\n", env.dev_raw_dp_cb);
printf("env.dev_dp_query_cb=%p\n", env.dev_dp_query_cb);
printf("env.status_changed_cb=%p\n", env.status_changed_cb);
printf("env.upgrade_cb_info=%p\n", env.upgrade_cb_info);
printf("env.gw_rst_cb=%p\n", env.gw_rst_cb);
printf("env.gw_restart_cb=%p\n", env.gw_restart_cb);
printf("env.qrcode_active_cb=%p\n", env.qrcode_active_cb);
printf("env.mem_save_mode=%d\n", env.mem_save_mode);
printf("env.dev_type=%d\n", env.dev_type);
printf("env.link_type=%d\n", env.link_type);
printf("env.p_reserved=%d\n", env.p_reserved);
printf("#################################################\n");
ret = tuya_ipc_init_sdk(&env);
if(OPRT_OK != ret)
{
printf("init sdk is error\n");
return ret;
}
辛苦你了。