4527|1

5310

帖子

453

TA的资源

五彩晶圆(高级)

楼主
 

【Nucleo+BLUENRG心得】+BLUENRG 控制小车详解3 [复制链接]

【Nucleo+BLUENRG心得】+BLUENRG 控制小车详解31、BLE信息
SBBLEController
提供了Service UUID  和 Characteristic UUID  同时支持不同的BLE设备


(3) RCB default typoe peripherals
Service UUID: 0xFFF0
Characteristic UUID: 0xFFF1


2、数据协议信息
The 1 - 2nd byte: Button
(Right buttons)
 UP: 0x0001
 DOWN: 0x0002
 RIGHT: 0x0004
 LEFT: 0x0008
(Left buttons)
 Y button: 0x0010
 A button: 0x0020
 B button: 0x0040
 X button: 0x0100
 left center: 0x0080
(Shift buttons)
 L1: 0x0200
 L2: 0x0400
 R1: 0x0800
 R2: 0x1000
(Other)
 START: 0x0003
 SELECT: 0x000C

The 3 - 4th byte: Left analog Stick
 Left - Right: 1-255 (Neutral=128)
 Up - Down: 1-255 (Neutral=128)

The 5 - 6th byte: Right analog Stick
 Left - Right: 1-255 (Neutral=128)
 Up - Down: 1-255 (Neutral=128)

The 7 - 9th byte: Accelerator
 X axis: 1-255 (Neutral=128)
 Y axis: 1-255 (Neutral=128)
 Z axis: 1-255 (Neutral=128)

The 10th byte: Status information


3、BLUENRG 程序 增加 Service UUID: 0xFFF0


const uint8_t service_uuid[2]  = {0xF0,0xFF};         //service

//添加SERVICE
  ret = aci_gatt_add_serv(UUID_TYPE_16, service_uuid, PRIMARY_SERVICE, 10, &sampleServHandle); /* original is 9?? */
  if (ret != BLE_STATUS_SUCCESS) goto fail;   

aci_gatt_add_serv函数修改部分
a:UUID类型选择16位
b:service_type         
c:max_attr_records  这点很重要,Characteristic 如果越多该参数也要增加

3、BLUENRG 程序 增加 Characteristic UUID: 0xFFF1

const tHalUint8 charUuidTX[2]  = {0xF1,0xFF};          //Characteristic


//1添加一个  Characteristic 服务
        ret =  aci_gatt_add_char(sampleServHandle,  UUID_TYPE_16, charUuidTX, 12, CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP, ATTR_PERMISSION_NONE, GATT_SERVER_ATTR_READ_WRITE,//GATT_SERVER_ATTR_WRITE,
                                                                                                        16, 1, &TXCharHandle);
  if (ret != BLE_STATUS_SUCCESS) goto fail;




此帖出自stm32/stm8论坛

最新回复

怎么不能添加多个服务及服务下的特征值 const uint8_t uuid[16] =                  {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe0,0xf2,0x73,0xd9};   const uint8_t charUuidTX[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe1,0xf2,0x73,0xd9};   const uint8_t charUuidRX[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe2,0xf2,0x73,0xd9};   const uint8_t charUuidRX1[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe3,0xf2,0x73,0xd9}; Osal_MemCpy(&service_uuid.Service_UUID_128, uuid, 16);   ret = aci_gatt_add_service(UUID_TYPE_128, &service_uuid, PRIMARY_SERVICE, 8, &chatServHandle);   if (ret != BLE_STATUS_SUCCESS) goto fail;      Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidTX, 16);   ret =  aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &char_uuid, 20, CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, 0,                 16, 1, &TXCharHandle);   if (ret != BLE_STATUS_SUCCESS) goto fail;   Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidRX, 16);   ret =  aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &char_uuid, 20, CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP, ATTR_PERMISSION_NONE, GATT_NOTIFY_ATTRIBUTE_WRITE,                 16, 1, &RXCharHandle);   if (ret != BLE_STATUS_SUCCESS) goto fail;   Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidRX1, 16);   ret =  aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &char_uuid, 20, CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP, ATTR_PERMISSION_NONE, GATT_NOTIFY_ATTRIBUTE_WRITE,                 16, 1, &RXCharHandle1);   if (ret != BLE_STATUS_SUCCESS) goto fail; 报如下错:BlueNRG-1 BLE Chat Server Application (version: 1.0.0) Error while adding Chat service. Add_Chat_Service fail CHAT_DeviceInit()--> Failed 0x41  详情 回复 发表于 2016-11-15 10:53
点赞 关注
 

回复
举报

6

帖子

1

TA的资源

一粒金砂(初级)

沙发
 
怎么不能添加多个服务及服务下的特征值
const uint8_t uuid[16] =                  {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe0,0xf2,0x73,0xd9};
  const uint8_t charUuidTX[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe1,0xf2,0x73,0xd9};
  const uint8_t charUuidRX[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe2,0xf2,0x73,0xd9};
  const uint8_t charUuidRX1[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x96,0x9e,0xe2,0x11,0x9e,0xb1,0xe3,0xf2,0x73,0xd9};
Osal_MemCpy(&service_uuid.Service_UUID_128, uuid, 16);
  ret = aci_gatt_add_service(UUID_TYPE_128, &service_uuid, PRIMARY_SERVICE, 8, &chatServHandle);
  if (ret != BLE_STATUS_SUCCESS) goto fail;   

  Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidTX, 16);
  ret =  aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &char_uuid, 20, CHAR_PROP_NOTIFY, ATTR_PERMISSION_NONE, 0,
                16, 1, &TXCharHandle);
  if (ret != BLE_STATUS_SUCCESS) goto fail;

  Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidRX, 16);
  ret =  aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &char_uuid, 20, CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP, ATTR_PERMISSION_NONE, GATT_NOTIFY_ATTRIBUTE_WRITE,
                16, 1, &RXCharHandle);
  if (ret != BLE_STATUS_SUCCESS) goto fail;

  Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidRX1, 16);
  ret =  aci_gatt_add_char(chatServHandle, UUID_TYPE_128, &char_uuid, 20, CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP, ATTR_PERMISSION_NONE, GATT_NOTIFY_ATTRIBUTE_WRITE,
                16, 1, &RXCharHandle1);
  if (ret != BLE_STATUS_SUCCESS) goto fail;


报如下错:BlueNRG-1 BLE Chat Server Application (version: 1.0.0)
Error while adding Chat service.
Add_Chat_Service fail
CHAT_DeviceInit()--> Failed 0x41
此帖出自stm32/stm8论坛
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表