1、add BT

This commit is contained in:
Liu_Weichao
2021-08-30 10:56:48 +08:00
parent fde280b6a0
commit da37bf4777
21 changed files with 475 additions and 70 deletions
@@ -48,8 +48,6 @@ static int Hfa21InitAtCmd(ATAgentType at_agent)
*/
static int Hfa21Open(struct Adapter *adapter)
{
uint8_t hfa21_cmd[64];
/*step1: open ec200t serial port*/
adapter->fd = PrivOpen(ADAPTER_HFA21_DRIVER, O_RDWR);
if (adapter->fd < 0) {
@@ -58,14 +56,16 @@ static int Hfa21Open(struct Adapter *adapter)
}
/*step2: init AT agent*/
char *agent_name = "uart3_client";
if (InitATAgent(agent_name, adapter->fd, 512)) {
printf("at agent init failed !\n");
return -1;
}
ATAgentType at_agent = GetATAgent(agent_name);
if (!adapter->agent) {
char *agent_name = "wifi_uart_client";
if (EOK != InitATAgent(agent_name, adapter->fd, 512)) {
printf("at agent init failed !\n");
return -1;
}
ATAgentType at_agent = GetATAgent(agent_name);
adapter->agent = at_agent;
adapter->agent = at_agent;
}
ADAPTER_DEBUG("Hfa21 open done\n");
@@ -195,7 +195,7 @@ static int Hfa21SetDown(struct Adapter *adapter)
}
/**
* @description: set wifi ip/gatewy/netmask address(in sta mode)
* @description: set wifi ip/gateway/netmask address(in sta mode)
* @param adapter - wifi device pointer
* @param ip - ip address
* @param gateway - gateway address
@@ -25,6 +25,8 @@
extern AdapterProductInfoType Hfa21Attach(struct Adapter *adapter);
#endif
#define ADAPTER_WIFI_NAME "wifi"
static int AdapterWifiRegister(struct Adapter *adapter)
{
int ret = 0;
@@ -151,15 +153,13 @@ int AdapterWifiTest(void)
const char *wifi_msg = "LiuKai Test";
int len = strlen(wifi_msg);
for(int i=0;i<10;++i)
{
for(int i = 0;i < 10; ++i) {
AdapterDeviceSend(adapter, wifi_msg, len);
PrivTaskDelay(4000);
}
char wifi_recv_msg[128];
while (1)
{
while (1) {
AdapterDeviceRecv(adapter, wifi_recv_msg, 128);
}