add reopen zigbee and modify the stacksize of zigbee receive thread
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user