0

我想使用 cc2541 先接收 ibeacon 包,然后将其传输到其他 Central 设备。但是 cc2541 怎么能同时充当观察者(或中心)和外围的角色呢?谁能给我一个盗版的解决方案?非常感谢!

4

1 回答 1

1

使用 Bluegiga BLE113 或 BLE121LR 模块(均由内部 CC2541 芯片组供电),可以使用 Bluegiga BLE 堆栈和 SDK 将模块作为外围设备和观察者运行。以下 BGScript 片段演示了如何使模块可连接并同时在观察模式下扫描:

# system boot occurs at power-on and reset
event system_boot(major, minor, patch, build, ll_version, protocol, hw)
    call gap_set_mode(gap_general_discoverable, gap_undirected_connectable)
    call gap_discover(gap_discover_observation)
end

# catch new or updated connection
event connection_status(connection, flags, address, address_type, conn_interval, timeout, latency, bonding)
    # new connection will terminate scan, so re-start here to keep it going
    call gap_discover(gap_discover_observation)
end

# catch scan response during discovery
event gap_scan_response(rssi, packet_type, sender, address_type, bond, data_len, data_data)
    # ad payload data will be in "data_data(0:data_len)" buffer
    # one "gap_scan_response" event per observed ad packet
end

这是演示该概念的一个非常基本的实现,您将需要一些其他项目定义文件来配合它,如 Bluegiga 文档中所述(例如project.bgprojgatt.xmlhardware.xml),但这至少表明它是可能的。您还需要实现额外的逻辑来处理将数据传递到连接的中央设备,此处未显示。有关这些设备和 SDK 的更多信息,请参见此处:

我不熟悉如何使用 TI 等其他堆栈来执行此操作,但它可以与 Bluegiga 的最新 SDK 及其 CC2540/CC2541 供电模块一起使用。

于 2014-11-24T20:09:37.313 回答