feat add control_framework, socket connect OK and delete useless printf

This commit is contained in:
Liu_Weichao 2022-11-24 16:07:41 +08:00
parent f4b21208e8
commit ba31c9e0f8
5 changed files with 10 additions and 23 deletions

View File

@ -164,7 +164,7 @@ void TcpSocketRecvTest(int argc, char *argv[])
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, tcp_socket_ip);
lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, tcp_socket_ip);
sys_thread_new("TcpSocketRecvTask", TcpSocketRecvTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
#endif
@ -231,7 +231,7 @@ void TcpSocketSendTest(int argc, char *argv[])
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, tcp_socket_ip);
lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, tcp_socket_ip);
sys_thread_new("Tcp Socket Send", TcpSocketSendTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
#endif
#ifdef ADD_NUTTX_FETURES

View File

@ -144,7 +144,7 @@ void UdpSocketRecvTest(int argc, char *argv[])
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, udp_socket_ip);
lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, udp_socket_ip);
sys_thread_new("UdpSocketRecvTask", UdpSocketRecvTask, NULL,
LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO);
#endif
@ -207,7 +207,7 @@ void UdpSocketSendTest(int argc, char *argv[])
}
#ifdef ADD_XIZI_FETURES
lwip_config_tcp(lwip_ipaddr, lwip_netmask, udp_socket_ip);
lwip_config_tcp(0, lwip_ipaddr, lwip_netmask, udp_socket_ip);
sys_thread_new("UdpSocketSendTask", UdpSocketSendTask, NULL, LWIP_TASK_STACK_SIZE,
LWIP_DEMO_TASK_PRIO);
#endif

View File

@ -22,6 +22,7 @@
void ControlOmronTest(void)
{
int i = 0;
uint16_t read_data_length = 0;
uint8_t read_data[1024] = {0};
ControlProtocolType fins_protocol = ControlProtocolFind();
@ -35,11 +36,11 @@ void ControlOmronTest(void)
if (CONTROL_REGISTERED == fins_protocol->protocol_status) {
ControlProtocolOpen(fins_protocol);
PrivTaskDelay(10000);
for (int i = 0; i < 10; i ++) {
for (;;) {
read_data_length = ControlProtocolRead(fins_protocol, read_data, sizeof(read_data));
printf("%s read [%d] fins data %d using receipe file\n", __func__, i, read_data_length);
i++;
PrivTaskDelay(100000);
}
//ControlProtocolClose(fins_protocol);

View File

@ -128,8 +128,6 @@ static int ControlAnalyzeRecipe(ControlProtocolType control_protocol, const char
control_protocol->protocol_type = control_protocol->recipe->protocol_type;
printf("%s %d control_protocol %p recipe %p\n", __func__, __LINE__, control_protocol, control_protocol->recipe);
/*Get the variable need to read from recipe file*/
RecipeReadVariableItem(control_protocol->recipe, recipe_file_json);
@ -256,9 +254,7 @@ int ControlFrameworkInit(void)
ret = -1;
goto _out;
}
printf("%s malloc control_protocol %p\n", __func__, control_protocol);
//Control Protocol Struct Init
ret = ControlProtocolInit(control_protocol);
if (ret < 0) {
@ -279,8 +275,6 @@ int ControlFrameworkInit(void)
control_protocol->protocol_status = CONTROL_REGISTERED;
printf("%s recipe %p\n", __func__, control_protocol->recipe);
ret = ControlPeripheralInit(control_protocol->recipe);
if (ret < 0) {
printf("%s failed!\n", __func__);

View File

@ -393,7 +393,7 @@ int RecipeBasicInformation(struct ControlRecipe *p_recipe, cJSON *p_recipe_file_
printf("\n************************************************************\n");
}
extern int FinsProtocolFormatCmd(struct ControlRecipe *p_recipe, ProtocolFormatInfo *protocol_format_info);
/**
* @description: Control Framework Read Variable Item Function
* @param p_recipe - Control recipe pointer
@ -420,8 +420,6 @@ void RecipeReadVariableItem(struct ControlRecipe *p_recipe, cJSON *p_recipe_file
protocol_format_info.p_read_item_data = p_recipe->protocol_data.data + CONTROL_DATA_HEAD_LENGTH;
printf("%s %d recipe %p\n", __func__, __LINE__, p_recipe);
/*Init The Control Protocol*/
ControlProtocolInitDesc(p_recipe, protocol_init);
@ -430,11 +428,7 @@ void RecipeReadVariableItem(struct ControlRecipe *p_recipe, cJSON *p_recipe_file
uint16_t read_item_count = p_recipe->read_item_count;
printf("%s %d protocol_format_info %p read_item_count %p\n", __func__, __LINE__, &protocol_format_info, &(p_recipe->read_item_count));
for (i = 0; i < read_item_count; i ++) {
printf("%s %d read_item_index %d read_item_count %d\n", __func__, __LINE__, i, read_item_count);
cJSON *read_single_item_json = cJSON_GetArrayItem(read_item_list_json, i);
protocol_format_info.read_single_item_json = read_single_item_json;
@ -446,8 +440,6 @@ void RecipeReadVariableItem(struct ControlRecipe *p_recipe, cJSON *p_recipe_file
printf("%s read %d item failed!\n", __func__, i);
continue;
}
printf("%s %d ret %d recipe %p count %p [%d] [%d]\n", __func__, __LINE__, ret, p_recipe, &(p_recipe->read_item_count), p_recipe->read_item_count, read_item_count);
}
}
}