当前位置: 首页>>代码示例>>C++>>正文


C++ UUID::getLen方法代码示例

本文整理汇总了C++中UUID::getLen方法的典型用法代码示例。如果您正苦于以下问题:C++ UUID::getLen方法的具体用法?C++ UUID::getLen怎么用?C++ UUID::getLen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UUID的用法示例。


在下文中一共展示了UUID::getLen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: print_uuid

    /**
     * Print the value of a UUID.
     */
    static void print_uuid(const UUID &uuid)
    {
        const uint8_t *uuid_value = uuid.getBaseUUID();

        // UUIDs are in little endian, print them in big endian
        for (size_t i = 0; i < uuid.getLen(); ++i) {
            printf("%02X", uuid_value[(uuid.getLen() - 1) - i]);
        }
    }
开发者ID:ARMmbed,项目名称:mbed-os-example-ble,代码行数:12,代码来源:main.cpp

示例2: app_start

void app_start(int, char *[])
{
    buffer = (uint8_t*)malloc(24);
    memset(buffer, 0, 24);
    console.attach(serialHandler);
    printf("{{end}}\r\n");
    // setup buttons
    // button1.mode(PullUp);
    // Delay for initial pullup to take effect
    wait(.01);
    // button1.fall(button1ISR);

    // button2.mode(PullUp);
    // Delay for initial pullup to take effect
    wait(.01);
    // button2.fall(button2ISR);

    /*************************************************************************/
    /*************************************************************************/
    /* bluetooth le */
    ble.init();

    // security
    ble.securityManager().onSecuritySetupInitiated(securityInitiated);
    ble.securityManager().onSecuritySetupCompleted(securityCompleted);
    ble.securityManager().onLinkSecured(linkSecured);
    ble.securityManager().onSecurityContextStored(contextStored);
    ble.securityManager().onPasskeyDisplay(passkeyDisplay);

    // connection status handlers
    ble.gap().onConnection(whenConnected);
    ble.gap().onDisconnection(whenDisconnected);

    // set preferred connection parameters to lowest latency
    Gap::ConnectionParams_t fast;
    ble.gap().getPreferredConnectionParams(&fast);
    fast.minConnectionInterval = 16; // 20 ms
    fast.maxConnectionInterval = 32; // 40 ms
    fast.slaveLatency = 0;
    ble.gap().setPreferredConnectionParams(&fast);

    /* construct advertising beacon */
    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED|GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, (const uint8_t *) DEVICE_NAME, sizeof(DEVICE_NAME) - 1);

    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, uuid.getBaseUUID(), uuid.getLen());

    ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
    ble.gap().setAdvertisingInterval(200);

    // Apple uses device name instead of beacon name
    ble.gap().setDeviceName((const uint8_t*) DEVICE_NAME);

    // ble setup complete - start advertising
    ble.gap().startAdvertising();


    /*************************************************************************/
    /*************************************************************************/
    bts = new BlockTransferService();
    btc = new BlockTransferClient();
    watch = new Timer();

    bts->init(uuid, SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK);

#if 0
    writeBlock.push_back(&writeBlockFragment2);
    writeBlock.push_back(&writeBlockFragment3);
    writeBlock.push_back(&writeBlockFragment4);
#endif

    // set callback functions
    bts->setWriteAuthorizationCallback(blockServerWriteHandler, &receiveBlock);
    bts->setReadAuthorizationCallback(blockServerReadHandler);


    printf("BlockTransfer: %s %s %d\r\n", __DATE__, __TIME__, MAX_INDEX_SET_SIZE);
}
开发者ID:rgrover,项目名称:BLE_Validation_Suite,代码行数:78,代码来源:main.cpp


注:本文中的UUID::getLen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。