Browse Source

1、add BT

master
Liu_Weichao 10 months ago
parent
commit
da37bf4777
  1. 2
      APP_Framework/Framework/connection/4G/EC200T/Kconfig
  2. 93
      APP_Framework/Framework/connection/4G/EC200T/ec200t.c
  3. 30
      APP_Framework/Framework/connection/4G/adapter_4G.c
  4. 152
      APP_Framework/Framework/connection/adapter.c
  5. 17
      APP_Framework/Framework/connection/adapter.h
  6. 32
      APP_Framework/Framework/connection/bluetooth/HC08/Kconfig
  7. 3
      APP_Framework/Framework/connection/bluetooth/HC08/Makefile
  8. 170
      APP_Framework/Framework/connection/bluetooth/HC08/hc08.c
  9. 14
      APP_Framework/Framework/connection/bluetooth/Kconfig
  10. 4
      APP_Framework/Framework/connection/bluetooth/Makefile
  11. 0
      APP_Framework/Framework/connection/lora/SX1278/Kconfig
  12. 0
      APP_Framework/Framework/connection/lora/SX1278/Makefile
  13. 0
      APP_Framework/Framework/connection/lora/SX1278/sx1278.c
  14. 0
      APP_Framework/Framework/connection/nbiot/BC28/Kconfig
  15. 0
      APP_Framework/Framework/connection/nbiot/BC28/Makefile
  16. 0
      APP_Framework/Framework/connection/nbiot/BC28/bc28.c
  17. 20
      APP_Framework/Framework/connection/wifi/HFA21/hfa21.c
  18. 8
      APP_Framework/Framework/connection/wifi/adapter_wifi.c
  19. 0
      APP_Framework/Framework/connection/zigbee/E18/Kconfig
  20. 0
      APP_Framework/Framework/connection/zigbee/E18/Makefile
  21. 0
      APP_Framework/Framework/connection/zigbee/E18/e18.c

2
APP_Framework/Framework/connection/4G/EC200T/Kconfig

@ -9,7 +9,7 @@ if ADD_XIUOS_FETURES
config ADAPTER_EC200T_PIN_DRIVER
string "EC200T device pin driver path"
default "/dev/pin"
default "/dev/pin_dev"
config ADAPTER_EC200T_DRIVER_EXTUART
bool "Using extra uart to support 4G"

93
APP_Framework/Framework/connection/4G/EC200T/ec200t.c

@ -19,6 +19,7 @@
*/
#include <adapter.h>
#include <at_agent.h>
static void Ec200tPowerSet(void)
{
@ -50,8 +51,6 @@ static void Ec200tPowerSet(void)
static int Ec200tOpen(struct Adapter *adapter)
{
uint8_t ec200t_cmd[64];
/*step1: open ec200t serial port*/
adapter->fd = PrivOpen(ADAPTER_EC200T_DRIVER, O_RDWR);
if (adapter->fd < 0) {
@ -59,43 +58,43 @@ static int Ec200tOpen(struct Adapter *adapter)
return -1;
}
/*step2: serial write "+++", quit transparent mode*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "+++");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
/*step2: init AT agent*/
if (!adapter->agent) {
char *agent_name = "4G_uart_client";
if (EOK != InitATAgent(agent_name, adapter->fd, 512)) {
printf("at agent init failed !\n");
return -1;
}
ATAgentType at_agent = GetATAgent(agent_name);
/*step3: serial write "AT+CCID", get SIM ID*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+CCID\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
adapter->agent = at_agent;
}
/*step3: serial write "+++", quit transparent mode*/
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "+++");
/*step4: serial write "AT+CCID", get SIM ID*/
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+CCID\r\n");
PrivTaskDelay(2500);
/*step4: serial write "AT+CPIN?", check SIM status*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+CPIN?\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
/*step5: serial write "AT+CPIN?", check SIM status*/
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+CPIN?\r\n");
PrivTaskDelay(2500);
/*step5: serial write "AT+CREG?", check whether registered to GSM net*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+CREG?\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
/*step6: serial write "AT+CREG?", check whether registered to GSM net*/
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+CREG?\r\n");
PrivTaskDelay(2500);
/*step6: serial write "AT+QICLOSE", close socket connect before open socket*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+QICLOSE=0\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
/*step7: serial write "AT+QICLOSE", close socket connect before open socket*/
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+QICLOSE=0\r\n");
PrivTaskDelay(2500);
/*step7: serial write "AT+QIDEACT", close TCP net before open socket*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+QIDEACT=1\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
/*step8: serial write "AT+QIDEACT", close TCP net before open socket*/
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+QIDEACT=1\r\n");
PrivTaskDelay(2500);
@ -106,24 +105,21 @@ static int Ec200tOpen(struct Adapter *adapter)
static int Ec200tClose(struct Adapter *adapter)
{
uint8_t ec200t_cmd[64];
if (!adapter->agent) {
printf("Ec200tClose AT agent NULL\n");
return -1;
}
/*step1: serial write "+++", quit transparent mode*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "+++");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "+++");
/*step2: serial write "AT+QICLOSE", close socket connect before open socket*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+QICLOSE=0\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+QICLOSE=0\r\n");
PrivTaskDelay(2500);
/*step3: serial write "AT+QIDEACT", close TCP net before open socket*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+QIDEACT=1\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+QIDEACT=1\r\n");
PrivTaskDelay(2500);
@ -167,7 +163,7 @@ static int Ec200tIoctl(struct Adapter *adapter, int cmd, void *args)
return 0;
}
static int Ec200tConnect(struct Adapter *adapter, const char *ip, const char *port, enum IpType ip_type)
static int Ec200tConnect(struct Adapter *adapter, enum NetRoleType net_role, const char *ip, const char *port, enum IpType ip_type)
{
uint8_t ec200t_cmd[64];
@ -180,14 +176,12 @@ static int Ec200tConnect(struct Adapter *adapter, const char *ip, const char *po
strcpy(ec200t_cmd, "AT+QICSGP=1,2,\"CMNET\",\"\",\"\",1\r\n");
}
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, ec200t_cmd);
PrivTaskDelay(2500);
/*step2: serial write "AT+QIACT", open TCP net*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+QIACT=1\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+QIACT=1\r\n");
PrivTaskDelay(2500);
@ -200,7 +194,7 @@ static int Ec200tConnect(struct Adapter *adapter, const char *ip, const char *po
strcat(ec200t_cmd, ",0,2\r\n");
ADAPTER_DEBUG("Ec200t connect AT CMD :%s\n", ec200t_cmd);
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, ec200t_cmd);
ADAPTER_DEBUG("Ec200t connect TCP done\n");
@ -224,14 +218,10 @@ static int Ec200tDisconnect(struct Adapter *adapter)
uint8_t ec200t_cmd[64];
/*step1: serial write "+++", quit transparent mode*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "+++");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "+++");
/*step2: serial write "AT+QICLOSE", close socket connect before open socket*/
memset(ec200t_cmd, 0, sizeof(ec200t_cmd));
strcpy(ec200t_cmd, "AT+QICLOSE=0\r\n");
PrivWrite(adapter->fd, ec200t_cmd, strlen(ec200t_cmd));
ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+QICLOSE=0\r\n");
PrivTaskDelay(2500);
@ -245,6 +235,13 @@ static const struct IpProtocolDone ec200t_done =
.open = Ec200tOpen,
.close = Ec200tClose,
.ioctl = Ec200tIoctl,
.setup = NULL,
.setdown = NULL,
.setaddr = NULL,
.setdns = NULL,
.setdhcp = NULL,
.ping = NULL,
.netstat = NULL,
.connect = Ec200tConnect,
.send = Ec200tSend,
.recv = Ec200tRecv,

30
APP_Framework/Framework/connection/4G/adapter_4G.c

@ -51,7 +51,6 @@ int Adapter4GInit(void)
struct Adapter *adapter = malloc(sizeof(struct Adapter));
if (!adapter) {
printf("Adapter4GInit malloc error\n");
free(adapter);
return -1;
}
@ -80,11 +79,32 @@ int Adapter4GInit(void)
return ret;
}
/******************TEST*********************/
static int Adapter4GTest(void)
/******************4G TEST*********************/
int Adapter4GTest(void)
{
int ret = 0;
const char *send_msg = "SendHeart";
char recv_msg[128];
int baud_rate = BAUD_RATE_115200;
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_4G_NAME);
return ret;
#ifdef ADAPTER_EC200T
//Using DSD server to test 4G Socket connection
uint8 server_addr[64] = "115.238.53.61";
uint8 server_port[64] = "33333";
AdapterDeviceOpen(adapter);
AdapterDeviceControl(adapter, OPE_INT, &baud_rate);
AdapterDeviceConnect(adapter, CLIENT, server_addr, server_port, IPV4);
while (1) {
AdapterDeviceSend(adapter, send_msg, strlen(send_msg));
AdapterDeviceRecv(adapter, recv_msg, 128);
printf("4G recv msg %s\n", recv_msg);
}
#endif
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, Adapter4GTest, Adapter4GTest, show adapter 4G information);

152
APP_Framework/Framework/connection/adapter.c

@ -446,6 +446,11 @@ int AdapterDeviceDisconnect(struct Adapter *adapter)
}
}
/**
* @description: Set up to net
* @param adapter - adapter device pointer
* @return success: 0 , failure: other
*/
int AdapterDeviceSetUp(struct Adapter *adapter)
{
if (!adapter)
@ -501,6 +506,11 @@ int AdapterDeviceSetUp(struct Adapter *adapter)
return result;
}
/**
* @description: Set down from net
* @param adapter - adapter device pointer
* @return success: 0 , failure: other
*/
int AdapterDeviceSetDown(struct Adapter *adapter)
{
if (!adapter)
@ -556,6 +566,14 @@ int AdapterDeviceSetDown(struct Adapter *adapter)
return result;
}
/**
* @description: Set ip/gateway/netmask address
* @param adapter - adapter device pointer
* @param ip - ip address
* @param gateway - gateway address
* @param netmast - netmast address
* @return success: 0 , failure: other
*/
int AdapterDeviceSetAddr(struct Adapter *adapter, const char *ip, const char *gateway, const char *netmask)
{
if (!adapter)
@ -611,6 +629,135 @@ int AdapterDeviceSetAddr(struct Adapter *adapter, const char *ip, const char *ga
return result;
}
/**
* @description: Set dns function
* @param adapter - adapter device pointer
* @param dns_addr - dns address
* @param dns_count - dns count
* @return success: 0 , failure: other
*/
int AdapterDeviceSetDns(struct Adapter *adapter, const char *dns_addr, uint8 dns_count)
{
if (!adapter)
return -1;
int result = 0;
struct IpProtocolDone *ip_done = NULL;
struct PrivProtocolDone *priv_done = NULL;
switch (adapter->net_protocol)
{
case PRIVATE_PROTOCOL:
priv_done = (struct PrivProtocolDone *)adapter->done;
if (NULL == priv_done->setdns)
return 0;
result = priv_done->setdns(adapter, dns_addr, dns_count);
if (0 == result) {
printf("Device %s setdns success.\n", adapter->name);
adapter->adapter_status = INSTALL;
} else {
if (adapter->fd) {
PrivClose(adapter->fd);
adapter->fd = 0;
}
printf("Device %s setdns failed(%d).\n", adapter->name, result);
}
break;
case IP_PROTOCOL:
ip_done = (struct IpProtocolDone *)adapter->done;
if (NULL == ip_done->setdns)
return 0;
result = ip_done->setdns(adapter, dns_addr, dns_count);
if (0 == result) {
printf("Device %s setdns success.\n", adapter->name);
adapter->adapter_status = INSTALL;
} else {
if (adapter->fd) {
PrivClose(adapter->fd);
adapter->fd = 0;
}
printf("Device %s setdns failed(%d).\n", adapter->name, result);
}
break;
default:
break;
}
return result;
}
/**
* @description: Set DHCP function
* @param adapter - adapter device pointer
* @param enable - enable DHCP or not
* @return success: 0 , failure: other
*/
int AdapterDeviceSetDhcp(struct Adapter *adapter, int enable)
{
if (!adapter)
return -1;
int result = 0;
struct IpProtocolDone *ip_done = NULL;
struct PrivProtocolDone *priv_done = NULL;
switch (adapter->net_protocol)
{
case PRIVATE_PROTOCOL:
priv_done = (struct PrivProtocolDone *)adapter->done;
if (NULL == priv_done->setdhcp)
return 0;
result = priv_done->setdhcp(adapter, enable);
if (0 == result) {
printf("Device %s setdhcp success.\n", adapter->name);
adapter->adapter_status = INSTALL;
} else {
if (adapter->fd) {
PrivClose(adapter->fd);
adapter->fd = 0;
}
printf("Device %s setdhcp failed(%d).\n", adapter->name, result);
}
break;
case IP_PROTOCOL:
ip_done = (struct IpProtocolDone *)adapter->done;
if (NULL == ip_done->setdhcp)
return 0;
result = ip_done->setdhcp(adapter, enable);
if (0 == result) {
printf("Device %s setdhcp success.\n", adapter->name);
adapter->adapter_status = INSTALL;
} else {
if (adapter->fd) {
PrivClose(adapter->fd);
adapter->fd = 0;
}
printf("Device %s setdhcp failed(%d).\n", adapter->name, result);
}
break;
default:
break;
}
return result;
}
/**
* @description: ping function
* @param adapter - adapter device pointer
* @param destination - the destination ip address
* @return success: 0 , failure: other
*/
int AdapterDevicePing(struct Adapter *adapter, const char *destination)
{
if (!adapter)
@ -666,6 +813,11 @@ int AdapterDevicePing(struct Adapter *adapter, const char *destination)
return result;
}
/**
* @description: Show the net status
* @param adapter - adapter device pointer
* @return success: 0 , failure: other
*/
int AdapterDeviceNetstat(struct Adapter *adapter)
{
if (!adapter)

17
APP_Framework/Framework/connection/adapter.h

@ -59,8 +59,6 @@ struct AdapterProductInfo;
typedef struct Adapter *AdapterType;
typedef struct AdapterProductInfo *AdapterProductInfoType;
#define ADAPTER_WIFI_NAME "wifi"
struct Socket
{
int id;
@ -90,6 +88,8 @@ enum NetRoleType
{
CLIENT = 1,
SERVER,
MASTER,
SLAVE,
ROLE_NONE,
};
@ -210,12 +210,25 @@ int AdapterDeviceJoin(struct Adapter *adapter, const char *priv_net_group);
/*Adapter disconnect from ip net or private net group*/
int AdapterDeviceDisconnect(struct Adapter *adapter);
/*Set up to net*/
int AdapterDeviceSetUp(struct Adapter *adapter);
/*Set down from net*/
int AdapterDeviceSetDown(struct Adapter *adapter);
/*Set ip/gateway/netmask address*/
int AdapterDeviceSetAddr(struct Adapter *adapter, const char *ip, const char *gateway, const char *netmask);
/**/
int AdapterDeviceSetDns(struct Adapter *adapter, const char *dns_addr, uint8 dns_count);
/**/
int AdapterDeviceSetDhcp(struct Adapter *adapter, int enable);
/*ping function*/
int AdapterDevicePing(struct Adapter *adapter, const char *destination);
/*Show the net status*/
int AdapterDeviceNetstat(struct Adapter *adapter);
#ifdef __cplusplus

32
APP_Framework/Framework/connection/bluetooth/HC08/Kconfig

@ -0,0 +1,32 @@
config ADAPTER_BLUETOOTH_HC08
string "HC08 adapter name"
default "hc08"
if ADD_XIUOS_FETURES
config ADAPTER_HC08_DRIVER_EXTUART
bool "Using extra uart to support bluetooth"
default n
config ADAPTER_HC08_DRIVER
string "HC08 device uart driver path"
default "/dev/uart4_dev4"
depends on !ADAPTER_HC08_DRIVER_EXTUART
if ADAPTER_HC08_DRIVER_EXTUART
config ADAPTER_HC08_DRIVER
string "HC08 device extra uart driver path"
default "/dev/extuart_dev7"
config ADAPTER_HC08_DRIVER_EXT_PORT
int "if HC08 device using extuart, choose port"
default "7"
endif
endif
if ADD_NUTTX_FETURES
endif
if ADD_RTTHREAD_FETURES
endif

3
APP_Framework/Framework/connection/bluetooth/HC08/Makefile

@ -0,0 +1,3 @@
SRC_FILES := hc08.c
include $(KERNEL_ROOT)/compiler.mk

170
APP_Framework/Framework/connection/bluetooth/HC08/hc08.c

@ -0,0 +1,170 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file hc08.c
* @brief Implement the connection Bluetooth adapter function, using HC08 device
* @version 1.1
* @author AIIT XUOS Lab
* @date 2021.07.12
*/
#include <adapter.h>
#include <at_agent.h>
static int rx_sem;
static sem_t *hc08_sem;
static pthread_t hc08_recv_thread;
void Hc08RecvThreadEntry(void *parameter)
{
while (1)
{
PrivRead(adapter->fd, buf, len);
UserSemaphoreAbandon(rx_sem);
}
}
static int Hc08Open(struct Adapter *adapter)
{
if (INSTALL == adapter->adapter_status) {
printf("Hc08 has already been open\n");
return 0;
}
/*step1: open hc08 serial port*/
adapter->fd = PrivOpen(ADAPTER_HC08_DRIVER, O_RDWR);
if (adapter->fd < 0) {
printf("Hc08Open get serial %s fd error\n", ADAPTER_HC08_DRIVER);
return -1;
}
/*step2: init AT agent*/
if (!adapter->agent) {
char *agent_name = "bluetooth_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;
}
/*step3: create bluetooth receive task*/
PrivSemaphoreCreate(hc08_sem, 0, rx_sem);
PrivTaskCreate(&hc08_recv_thread, NULL, Hc08RecvThreadEntry, NULL);
ADAPTER_DEBUG("Hc08 open done\n");
}
static int Hc08Close(struct Adapter *adapter)
{
return 0;
}
static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
{
if (OPE_INT != cmd) {
printf("Hc08Ioctl only support OPE_INT, do not support %d\n", cmd);
return -1;
}
uint32_t baud_rate = *((uint32_t *)args);
struct SerialDataCfg serial_cfg;
memset(&serial_cfg, 0 ,sizeof(struct SerialDataCfg));
serial_cfg.serial_baud_rate = baud_rate;
serial_cfg.serial_data_bits = DATA_BITS_8;
serial_cfg.serial_stop_bits = STOP_BITS_1;
serial_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
serial_cfg.serial_parity_mode = PARITY_NONE;
serial_cfg.serial_bit_order = STOP_BITS_1;
serial_cfg.serial_invert_mode = NRZ_NORMAL;
#ifdef ADAPTER_HC08_DRIVER_EXT_PORT
serial_cfg.ext_uart_no = ADAPTER_HC08_DRIVER_EXT_PORT;
serial_cfg.port_configure = PORT_CFG_INIT;
#endif
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
ioctl_cfg.args = &serial_cfg;
PrivIoctl(adapter->fd, OPE_INT, &ioctl_cfg);
ADAPTER_DEBUG("Hc08 ioctl done\n");
return 0;
}
static int Hc08SetAddr(struct Adapter *adapter, const char *ip, const char *gateway, const char *netmask)
{
}
static int Hc08Connect(struct Adapter *adapter, enum NetRoleType net_role, const char *ip, const char *port, enum IpType ip_type)
{
}
static int Hc08Send(struct Adapter *adapter, const void *buf, size_t len)
{
PrivWrite(adapter->fd, buf, len);
return 0;
}
static int Hc08Recv(struct Adapter *adapter, void *buf, size_t len)
{
return 0;
}
static int Hc08Disconnect(struct Adapter *adapter)
{
}
static const struct IpProtocolDone hc08_done =
{
.open = Hc08Open,
.close = Hc08Close,
.ioctl = Hc08Ioctl,
.setup = NULL,
.setdown = NULL,
.setaddr = Hc08SetAddr,
.setdns = NULL,
.setdhcp = NULL,
.ping = NULL,
.netstat = NULL,
.connect = Hc08Connect,
.send = Hc08Send,
.recv = Hc08Recv,
.disconnect = Hc08Disconnect,
};
AdapterProductInfoType Hc08Attach(struct Adapter *adapter)
{
struct AdapterProductInfo *product_info = malloc(sizeof(struct AdapterProductInfo));
if (!product_info) {
printf("Hc08Attach malloc product_info error\n");
free(product_info);
return NULL;
}
product_info->model_name = ADAPTER_BLUETOOTH_HC08;
product_info->model_done = (void *)&hc08_done;
return product_info;
}

14
APP_Framework/Framework/connection/bluetooth/Kconfig

@ -0,0 +1,14 @@
config ADAPTER_BLUETOOTH
bool "Using bluetooth adapter function"
default y
if ADAPTER_BLUETOOTH
config ADAPTER_HC08
bool "Using bluetooth adapter device HC08"
default y
if ADAPTER_HC08
source "$APP_DIR/Framework/connection/bluetooth/HC08/Kconfig"
endif
endif

4
APP_Framework/Framework/connection/bluetooth/Makefile

@ -1,3 +1,7 @@
SRC_FILES := adapter_bluetooth.c
ifeq ($(CONFIG_ADAPTER_HC08),y)
SRC_DIR += HC08
endif
include $(KERNEL_ROOT)/compiler.mk

0
APP_Framework/Framework/connection/lora/SX1278/Kconfig

0
APP_Framework/Framework/connection/lora/SX1278/Makefile

0
APP_Framework/Framework/connection/lora/SX1278/sx1278.c

0
APP_Framework/Framework/connection/nbiot/BC28/Kconfig

0
APP_Framework/Framework/connection/nbiot/BC28/Makefile

0
APP_Framework/Framework/connection/nbiot/BC28/bc28.c

20
APP_Framework/Framework/connection/wifi/HFA21/hfa21.c

@ -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

8
APP_Framework/Framework/connection/wifi/adapter_wifi.c

@ -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);
}

0
APP_Framework/Framework/connection/zigbee/E18/Kconfig

0
APP_Framework/Framework/connection/zigbee/E18/Makefile

0
APP_Framework/Framework/connection/zigbee/E18/e18.c

Loading…
Cancel
Save