it's verified
This commit is contained in:
commit
21f4d6c90f
|
@ -80,13 +80,13 @@ int AdapterBlueToothInit(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************4G TEST*********************/
|
/******************BT TEST*********************/
|
||||||
int AdapterBlueToothTest(void)
|
int AdapterBlueToothTest(void)
|
||||||
{
|
{
|
||||||
const char *bluetooth_msg = "BT Adapter Test";
|
const char *bluetooth_msg = "BT Adapter Test";
|
||||||
char bluetooth_recv_msg[128];
|
char bluetooth_recv_msg[128];
|
||||||
int len;
|
int len;
|
||||||
int baud_rate = BAUD_RATE_115200;
|
int baud_rate = BAUD_RATE_9600;
|
||||||
|
|
||||||
struct Adapter *adapter = AdapterDeviceFindByName(ADAPTER_BLUETOOTH_NAME);
|
struct Adapter *adapter = AdapterDeviceFindByName(ADAPTER_BLUETOOTH_NAME);
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ int AdapterBlueToothTest(void)
|
||||||
printf("bluetooth_recv_msg %s\n", bluetooth_recv_msg);
|
printf("bluetooth_recv_msg %s\n", bluetooth_recv_msg);
|
||||||
AdapterDeviceSend(adapter, bluetooth_msg, len);
|
AdapterDeviceSend(adapter, bluetooth_msg, len);
|
||||||
printf("send %s after recv\n", bluetooth_msg);
|
printf("send %s after recv\n", bluetooth_msg);
|
||||||
PrivTaskDelay(100);
|
PrivTaskDelay(1000);
|
||||||
memset(bluetooth_recv_msg, 0, 128);
|
memset(bluetooth_recv_msg, 0, 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,4 +109,9 @@ int AdapterBlueToothTest(void)
|
||||||
|
|
||||||
return 0;
|
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, AdapterBlueToothTest, AdapterBlueToothTest, show adapter BT information);
|
#ifdef ADD_RTTHREAD_FETURES
|
||||||
|
MSH_CMD_EXPORT(AdapterBlueToothTest,a bt adpter sample);
|
||||||
|
#endif
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterWifiTest, AdapterWifiTest, show adapter wifi information);
|
||||||
|
#endif
|
|
@ -92,7 +92,7 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
|
||||||
ATReplyType reply = CreateATReply(64);
|
ATReplyType reply = CreateATReply(64);
|
||||||
if (NULL == reply) {
|
if (NULL == reply) {
|
||||||
printf("Hc08AtConfigure CreateATReply failed !\n");
|
printf("Hc08AtConfigure CreateATReply failed !\n");
|
||||||
return -ENOMEMORY;
|
return -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (hc08_at_cmd)
|
switch (hc08_at_cmd)
|
||||||
|
@ -152,20 +152,20 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
|
||||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_ROLE_CMD);
|
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_ROLE_CMD);
|
||||||
reply_ok_flag = 0;
|
reply_ok_flag = 0;
|
||||||
break;
|
break;
|
||||||
// case HC08_AT_CMD_SET_ADDR:
|
case HC08_AT_CMD_SET_ADDR:
|
||||||
// ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_SET_ROLE_CMD);
|
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_SET_ROLE_CMD);
|
||||||
// break;
|
break;
|
||||||
// case HC08_AT_CMD_GET_ADDR:
|
case HC08_AT_CMD_GET_ADDR:
|
||||||
// ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_ROLE_CMD);
|
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_ROLE_CMD);
|
||||||
// reply_ok_flag = 0;
|
reply_ok_flag = 0;
|
||||||
// break;
|
break;
|
||||||
// case HC08_AT_CMD_SET_NAME:
|
case HC08_AT_CMD_SET_NAME:
|
||||||
// ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_SET_NAME_CMD);
|
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_SET_NAME_CMD);
|
||||||
// break;
|
break;
|
||||||
// case HC08_AT_CMD_GET_NAME:
|
case HC08_AT_CMD_GET_NAME:
|
||||||
// ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_NAME_CMD);
|
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_NAME_CMD);
|
||||||
// reply_ok_flag = 0;
|
reply_ok_flag = 0;
|
||||||
// break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("hc08 do not support no.%d cmd\n", hc08_at_cmd);
|
printf("hc08 do not support no.%d cmd\n", hc08_at_cmd);
|
||||||
DeleteATReply(reply);
|
DeleteATReply(reply);
|
||||||
|
@ -209,7 +209,7 @@ static int Hc08Open(struct Adapter *adapter)
|
||||||
if (!adapter->agent) {
|
if (!adapter->agent) {
|
||||||
char *agent_name = "bluetooth_uart_client";
|
char *agent_name = "bluetooth_uart_client";
|
||||||
printf("InitATAgent agent_name %s fd %u\n", agent_name, adapter->fd);
|
printf("InitATAgent agent_name %s fd %u\n", agent_name, adapter->fd);
|
||||||
if (EOK != InitATAgent(agent_name, adapter->fd, 512)) {
|
if (0 != InitATAgent(agent_name, adapter->fd, 512)) {
|
||||||
printf("at agent init failed !\n");
|
printf("at agent init failed !\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ static int Hc08Connect(struct Adapter *adapter, enum NetRoleType net_role, const
|
||||||
|
|
||||||
static int Hc08Send(struct Adapter *adapter, const void *buf, size_t len)
|
static int Hc08Send(struct Adapter *adapter, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
x_err_t result = EOK;
|
long result = 0;
|
||||||
if (adapter->agent) {
|
if (adapter->agent) {
|
||||||
EntmSend(adapter->agent, (const char *)buf, len);
|
EntmSend(adapter->agent, (const char *)buf, len);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -285,8 +285,8 @@ CONFIG_BSP_USING_GPIO=y
|
||||||
CONFIG_BSP_USING_UART=y
|
CONFIG_BSP_USING_UART=y
|
||||||
CONFIG_BSP_USING_UART1=y
|
CONFIG_BSP_USING_UART1=y
|
||||||
# CONFIG_BSP_USING_UART2 is not set
|
# CONFIG_BSP_USING_UART2 is not set
|
||||||
# CONFIG_BSP_USING_UART3 is not set
|
CONFIG_BSP_USING_UART3=y
|
||||||
# CONFIG_BSP_USING_UART4 is not set
|
CONFIG_BSP_USING_UART4=y
|
||||||
# CONFIG_BSP_USING_I2C1 is not set
|
# CONFIG_BSP_USING_I2C1 is not set
|
||||||
# CONFIG_BSP_USING_SPI is not set
|
# CONFIG_BSP_USING_SPI is not set
|
||||||
# CONFIG_BSP_USING_CH438 is not set
|
# CONFIG_BSP_USING_CH438 is not set
|
||||||
|
@ -317,11 +317,27 @@ CONFIG_USB_DEVICE_NAME="usb_dev"
|
||||||
# Framework
|
# Framework
|
||||||
#
|
#
|
||||||
CONFIG_TRANSFORM_LAYER_ATTRIUBUTE=y
|
CONFIG_TRANSFORM_LAYER_ATTRIUBUTE=y
|
||||||
CONFIG_ADD_XIZI_FETURES=y
|
# CONFIG_ADD_XIZI_FETURES is not set
|
||||||
# CONFIG_ADD_NUTTX_FETURES is not set
|
# CONFIG_ADD_NUTTX_FETURES is not set
|
||||||
# CONFIG_ADD_RTTHREAD_FETURES is not set
|
CONFIG_ADD_RTTHREAD_FETURES=y
|
||||||
# CONFIG_SUPPORT_SENSOR_FRAMEWORK is not set
|
# CONFIG_SUPPORT_SENSOR_FRAMEWORK is not set
|
||||||
# CONFIG_SUPPORT_CONNECTION_FRAMEWORK is not set
|
CONFIG_SUPPORT_CONNECTION_FRAMEWORK=y
|
||||||
|
CONFIG_CONNECTION_FRAMEWORK_DEBUG=y
|
||||||
|
# CONFIG_CONNECTION_INDUSTRIAL_ETHERNET is not set
|
||||||
|
# CONFIG_CONNECTION_INDUSTRIAL_FIELDBUS is not set
|
||||||
|
# CONFIG_CONNECTION_INDUSTRIAL_WLAN is not set
|
||||||
|
# CONFIG_CONNECTION_ADAPTER_LORA is not set
|
||||||
|
# CONFIG_CONNECTION_ADAPTER_4G is not set
|
||||||
|
# CONFIG_CONNECTION_ADAPTER_NB is not set
|
||||||
|
# CONFIG_CONNECTION_ADAPTER_WIFI is not set
|
||||||
|
# CONFIG_CONNECTION_ADAPTER_ETHERNET is not set
|
||||||
|
CONFIG_CONNECTION_ADAPTER_BLUETOOTH=y
|
||||||
|
CONFIG_ADAPTER_HC08=y
|
||||||
|
CONFIG_ADAPTER_BLUETOOTH_HC08="hc08"
|
||||||
|
CONFIG_ADAPTER_HC08_WORK_ROLE="M"
|
||||||
|
CONFIG_ADAPTER_HC08_DRIVER="/dev/uart4"
|
||||||
|
# CONFIG_CONNECTION_ADAPTER_ZIGBEE is not set
|
||||||
|
# CONFIG_CONNECTION_ADAPTER_5G is not set
|
||||||
# CONFIG_SUPPORT_KNOWING_FRAMEWORK is not set
|
# CONFIG_SUPPORT_KNOWING_FRAMEWORK is not set
|
||||||
# CONFIG_SUPPORT_CONTROL_FRAMEWORK is not set
|
# CONFIG_SUPPORT_CONTROL_FRAMEWORK is not set
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,8 @@
|
||||||
#define BSP_USING_GPIO
|
#define BSP_USING_GPIO
|
||||||
#define BSP_USING_UART
|
#define BSP_USING_UART
|
||||||
#define BSP_USING_UART1
|
#define BSP_USING_UART1
|
||||||
|
#define BSP_USING_UART3
|
||||||
|
#define BSP_USING_UART4
|
||||||
#define BSP_USING_USB
|
#define BSP_USING_USB
|
||||||
#define BSP_USING_STM32_USBH
|
#define BSP_USING_STM32_USBH
|
||||||
#define USB_BUS_NAME "usb"
|
#define USB_BUS_NAME "usb"
|
||||||
|
@ -191,7 +193,14 @@
|
||||||
/* Framework */
|
/* Framework */
|
||||||
|
|
||||||
#define TRANSFORM_LAYER_ATTRIUBUTE
|
#define TRANSFORM_LAYER_ATTRIUBUTE
|
||||||
#define ADD_XIZI_FETURES
|
#define ADD_RTTHREAD_FETURES
|
||||||
|
#define SUPPORT_CONNECTION_FRAMEWORK
|
||||||
|
#define CONNECTION_FRAMEWORK_DEBUG
|
||||||
|
#define CONNECTION_ADAPTER_BLUETOOTH
|
||||||
|
#define ADAPTER_HC08
|
||||||
|
#define ADAPTER_BLUETOOTH_HC08 "hc08"
|
||||||
|
#define ADAPTER_HC08_WORK_ROLE "M"
|
||||||
|
#define ADAPTER_HC08_DRIVER "/dev/uart4"
|
||||||
|
|
||||||
/* Security */
|
/* Security */
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 265 KiB |
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
Loading…
Reference in New Issue