彩虹天空cc 发表于 2021-8-15 17:22

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, &noti ) != SUCCESS )
{
    GATT_bm_free( (gattMsg_t *)&noti, 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收不到数据

彩虹天空cc 发表于 2021-8-16 21:05

问题已解决,修改UUID即可

彩虹天空cc 发表于 2021-8-16 21:09

在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-17 10:37

呼叫打野爸爸

WCHTech2 发表于 2021-8-18 10:51

彩虹天空cc 发表于 2021-8-16 21:09
在Central主机例程中,扫描周围蓝牙设备只列出了地址:
Discovering...
Device 1 - Addr e7 62 29 dd d7 63 ...
static void centralEventCB( gapRoleEvent_t *pEvent )
可以自行解析函数参数 pEvent

彩虹天空cc 发表于 2021-8-23 16:47

我想用Central例程连接如下的从机

修改了例程中如下两处


显示连接成功,但是收不到notify信息

彩虹天空cc 发表于 2021-8-23 16:51

串口信息如下:
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 16:53

本帖最后由 彩虹天空cc 于 2021-8-23 18:20 编辑

程序中定位到static void centralGATTDiscoveryEvent( gattMsgEvent_t *pMsg ),3个profile全部不可读,因此特征值句柄为空,这种情况下怎么接收notify

彩虹天空cc 发表于 2021-8-25 17:03

@WCHTech2 打野爸爸 江湖救急

彩虹天空cc 发表于 2021-8-27 18:00

那就只能硬搞了,用一个递增变量一个一个的写CCD,试出来通知句柄为0x20,然后写死

redone 发表于 2021-9-11 12:08

还有这个别称,你们都是老铁了

K359225712 发表于 2021-10-6 12:26

果然硬搞还是是搞定了

两只袜子 发表于 2021-10-11 10:28

哈哈,硬搞,牛

两只袜子 发表于 2021-10-11 10:28

哈哈,硬搞,牛

mutable 发表于 2021-10-11 16:46

你们都是这么牛的么?~~
看着好深奥
页: [1]
查看完整版本: CH579怎么回传数据