微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > WiFi CC3200 P2P如何实现连接断开能够自动重连?

WiFi CC3200 P2P如何实现连接断开能够自动重连?

时间:10-02 整理:3721RD 点击:

大神们,请教一个P2P 例程的问题, 当手机连接上后,主动断开连接,然后再连接就出现扫描不到的问题,请问当连接断开后需要如何设置才能让板子被扫描并且可以被连接?

自顶一个!

我在文档swru368a.pdf中看到有以下代码:

unsigned char val = 1;
unsigned char policyVal;
unsigned char my_p2p_device[33];
unsigned char *remote_p2p_device = "Remote_GO_Device_XX";
unsigned char bssidEmpty[6] = {0,0,0,0,0,0};
sl_Start(NULL, NULL, NULL);
//Set P2P as active role
sl_WlanSetMode(3/*P2P_ROLE*/);
//Set P2P client dhcp enable (assuming remote GO running DHCP server)
sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,1,1,&val);
//Set Device Name
strcpy(my_p2p_device,"jacky_sl_p2p_device");
sl_NetAppSet (SL_NET_APP_DEVICE_CONFIG_ID,
NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, strlen(my_p2p_device),
(unsigned char *) my_p2p_device);
//set connection policy Auto-Connect
sl_WlanPolicySet( SL_POLICY_CONNECTION,
SL_CONNECTION_POLICY(1/*Auto*/,0/*Fast*/,
0/*OpenAP*/,0/*AnyP2P*/),
&policyVal, 0 /*PolicyValLen*/
);
//set P2P Policy - intent 0, random backoff
sl_WlanPolicySet( SL_POLICY_P2P,
SL_P2P_POLICY(SL_P2P_ROLE_CLIENT/*Intent 0 - Client*/,
SL_P2P_NEG_INITIATOR_RAND_BACKOFF/*Negotiation initiator – random backoff*/),
&policyVal,0 /*PolicyValLen*/
);
sl_WlanProfileAdd(
SL_SEC_TYPE_P2P_PBC,
remote_p2p_device,
strlen(remote_p2p_device),
bssidEmpty,
0, //unsigned long Priority,
0,//unsigned char *pKey,
0,//unsigned long KeyLen,
0//unsigned long Options)
);
sl_Stop(1);
sl_Start(NULL, NULL, NULL);

我将上面代码写为一个函数,在main函数里面创建一个任务并且调用该函数后进入mainloop,但是用手机根本都扫描不到?

是不是还需要有其他的设置呢?

求救啊!

如果连接断开后你应该会收到一个DISCONNECT的事件,收到后再把p2p configure一下。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top