本文整理汇总了C++中BLE::onDataWritten方法的典型用法代码示例。如果您正苦于以下问题:C++ BLE::onDataWritten方法的具体用法?C++ BLE::onDataWritten怎么用?C++ BLE::onDataWritten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLE
的用法示例。
在下文中一共展示了BLE::onDataWritten方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
ble.init();
ble.onDisconnection(disconnectionCallback);
ble.onDataWritten(WrittenHandler);
// setup advertising
ble.accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_PHONE);
ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, (const uint8_t *)NAME, sizeof(NAME) - 1);
ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (const uint8_t *)uart_base_uuid_rev, sizeof(uart_base_uuid));
ble.setAdvertisingPayload();
ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
ble.setActiveScan(false);
ble.setAdvertisingInterval(100);
ble.addService(uartService);
ble.startAdvertising();
while(1)
{
ble.waitForEvent();
}
}