forked from xuos/xiuos
add reopen zigbee and modify the stacksize of zigbee receive thread
This commit is contained in:
parent
b0f717bee4
commit
626cbb084d
|
@ -369,7 +369,7 @@ static int ATAgentInit(ATAgentType agent)
|
|||
strncpy(at_utask.name, "recv_task", strlen("recv_task"));
|
||||
at_utask.func_entry = ATAgentReceiveProcess;
|
||||
at_utask.func_param = agent;
|
||||
at_utask.stack_size = 1024;
|
||||
at_utask.stack_size = 2048;
|
||||
at_utask.prio = 18;
|
||||
|
||||
agent->at_handler = UserTaskCreate(at_utask);
|
||||
|
@ -448,7 +448,7 @@ ATReplyType CreateATReply(uint32 reply_max_len)
|
|||
free(reply);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(reply->reply_buffer,0,reply_max_len);
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,15 +159,8 @@ static int E18NetworkModeConfig(struct Adapter *adapter)
|
|||
break;
|
||||
}
|
||||
|
||||
if(!ret){
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
||||
if(ret < 0) {
|
||||
printf("%s %d cmd[%s] config failed!\n",__func__,__LINE__,cmd_exit);
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -221,20 +214,16 @@ static int E18NetRoleConfig(struct Adapter *adapter)
|
|||
ret = -1;
|
||||
break;
|
||||
}
|
||||
if(!ret){
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
||||
if(ret < 0) {
|
||||
printf("%s %d cmd[%s] config failed!\n",__func__,__LINE__,cmd_exit);
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
AtCmdConfigAndCheck(adapter->agent, cmd_exit, "+OK");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int E18Open(struct Adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
int try_times = 5;
|
||||
|
||||
if (NULL == adapter) {
|
||||
return -1;
|
||||
|
@ -255,7 +244,16 @@ static int E18Open(struct Adapter *adapter)
|
|||
ATAgentType at_agent = GetATAgent(agent_name);
|
||||
adapter->agent = at_agent;
|
||||
}
|
||||
ret = E18NetRoleConfig(adapter);
|
||||
|
||||
try_again:
|
||||
while(try_times--){
|
||||
ret = E18NetRoleConfig(adapter);
|
||||
if(ret < 0){
|
||||
printf("E18NetRoleConfig failed [%d] times.\n",try_times);
|
||||
goto try_again;
|
||||
}
|
||||
}
|
||||
|
||||
if(ret < 0){
|
||||
printf("E18NetRoleConfig failed\n");
|
||||
return -1;
|
||||
|
|
|
@ -91,11 +91,9 @@ int AdapterZigbeeInit(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/******************4G TEST*********************/
|
||||
/******************TEST*********************/
|
||||
int openzigbee(void)
|
||||
{
|
||||
const char *send_msg = "SendHeart";
|
||||
char recv_msg[128];
|
||||
int ret = 0;
|
||||
|
||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_ZIGBEE_NAME);
|
||||
|
@ -118,24 +116,6 @@ int openzigbee(void)
|
|||
printf("join adapter failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
adapter->net_role = COORDINATOR;
|
||||
ret = AdapterDeviceControl(adapter, CONFIG_ZIGBEE_NET_ROLE, NULL);
|
||||
if(ret < 0){
|
||||
printf("control adapter failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// while (1) {
|
||||
// ret = AdapterDeviceSend(adapter, send_msg, strlen(send_msg));
|
||||
// if(ret < 0){
|
||||
// printf(" adapter send failed\n");
|
||||
// break;
|
||||
// }
|
||||
// printf("zigbee send msg %s\n", send_msg);
|
||||
// AdapterDeviceRecv(adapter, recv_msg, 128);
|
||||
// printf("zigbee recv msg %s\n", recv_msg);
|
||||
// }
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue