CH579怎么回传数据
在peripheral例程中查到如下函数static void peripheralChar4Notify( uint8 *pValue, uint16 len )
{
attHandleValueNoti_t noti;
noti.len = len;
noti.pValue = GATT_bm_alloc( peripheralConnList.connHandle, ATT_HANDLE_VALUE_NOTI, noti.len, NULL, 0 );
tmos_memcpy( noti.pValue, pValue, noti.len );
if( simpleProfile_Notify( peripheralConnList.connHandle, ¬i ) != SUCCESS )
{
GATT_bm_free( (gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI );
}
}
然后又调用了:主动通知函数GATT_Notification:
bStatus_t simpleProfile_Notify( uint16 connHandle, attHandleValueNoti_t *pNoti )
{
uint16 value = GATTServApp_ReadCharCfg( connHandle, simpleProfileChar4Config );
// If notifications enabled
if ( value & GATT_CLIENT_CFG_NOTIFY )
{
// Set the handle
pNoti->handle = simpleProfileAttrTbl.handle;
// Send the notification
return GATT_Notification( connHandle, pNoti, FALSE );
}
return bleIncorrectMode;
}
程序中直接调用GATT_Notification函数发送数据,串口调试助手app收不到数据 问题已解决,修改UUID即可 在Central主机例程中,扫描周围蓝牙设备只列出了地址:
Discovering...
Device 1 - Addr e7 62 29 dd d7 63
Device 2 - Addr 99 7e 51 77 c4 67
怎么查询蓝牙名称,比如我想直接连接名称为Simple Peripheral的蓝牙设备 呼叫打野爸爸 彩虹天空cc 发表于 2021-8-16 21:09
在Central主机例程中,扫描周围蓝牙设备只列出了地址:
Discovering...
Device 1 - Addr e7 62 29 dd d7 63 ...
static void centralEventCB( gapRoleEvent_t *pEvent )
可以自行解析函数参数 pEvent
我想用Central例程连接如下的从机
修改了例程中如下两处
显示连接成功,但是收不到notify信息
串口信息如下:
CH57x_BLE_LIB_V1.80
Discovering...
Device 1 - Addr 35 76 f e4 c2 84
Device 2 - Addr bc ed 36 12 af 62
Device 3 - Addr a4 5 52 7a fa 28
Device found...
Connecting...
Connected...
RSSI : -91 dB
Param Update...
RSSI : -88 dB
RSSI : -85 dB
RSSI : -91 dB
Param Update...
RSSI : -90 dB
RSSI : -89 dB
RSSI : -88 dB
RSSI : -93 dB
RSSI : -92 dB
RSSI : -91 dB
RSSI : -90 dB
RSSI : -87 dB 本帖最后由 彩虹天空cc 于 2021-8-23 18:20 编辑
程序中定位到static void centralGATTDiscoveryEvent( gattMsgEvent_t *pMsg ),3个profile全部不可读,因此特征值句柄为空,这种情况下怎么接收notify @WCHTech2 打野爸爸 江湖救急 那就只能硬搞了,用一个递增变量一个一个的写CCD,试出来通知句柄为0x20,然后写死 还有这个别称,你们都是老铁了 果然硬搞还是是搞定了 哈哈,硬搞,牛 哈哈,硬搞,牛 你们都是这么牛的么?~~
看着好深奥
页:
[1]