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


C++ OCRepresentation::getPayload方法代码示例

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


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

示例1: onGet

// Callback handler on GET request
void onGet(const HeaderOptions &headerOptions, const OCRepresentation &rep, const int eCode)
{
    (void)headerOptions;
    try
    {
        if (eCode == OC_STACK_OK)
        {
            std::cout << "GET request was successful" << std::endl;
            std::cout << "Resource URI: " << rep.getUri() << std::endl;

            std::cout << "Payload: " << rep.getPayload() << std::endl;

            rep.getValue("on-off", mylight.m_on_off);
            rep.getValue("dim", mylight.m_dim);
            rep.getValue("color", mylight.m_color);

            std::cout << "\ton-off: " << mylight.m_on_off << std::endl;
            std::cout << "\tcolor: " << mylight.m_color << std::endl;
            std::cout << "\tdim: " << mylight.m_dim << std::endl;

            putLightRepresentation(curResource);
        }
        else
        {
            std::cout << "onGET Response error: " << eCode << std::endl;
        }
    }
    catch (std::exception &e)
    {
        std::cout << "Exception: " << e.what() << " in onGet" << std::endl;
    }
}
开发者ID:KonexyIoT,项目名称:iotivity,代码行数:33,代码来源:ContainerSampleClient.cpp

示例2: onGetForDISensor

void onGetForDISensor(const HeaderOptions &headerOptions, const OCRepresentation &rep,
                      const int eCode)
{
    (void)headerOptions;
    try
    {
        if (eCode == OC_STACK_OK)
        {
            std::cout << "GET request was successful" << std::endl;
            std::cout << "Resource URI: " << DISensorResource->uri() << std::endl;

            std::cout << "Payload: " << rep.getPayload() << std::endl;

            std::cout << "\tdiscomfortIndex: " << rep.getValue<std::string>("discomfortIndex") << std::endl;
        }
        else
        {
            std::cout << "onGET Response error: " << eCode << std::endl;
        }
    }
    catch (std::exception &e)
    {
        std::cout << "Exception: " << e.what() << " in onPut" << std::endl;
    }
}
开发者ID:KonexyIoT,项目名称:iotivity,代码行数:25,代码来源:ContainerSampleClient.cpp

示例3: handleLoginoutCB

void handleLoginoutCB(const HeaderOptions &,
                      const OCRepresentation &rep, const int ecode)
{
    cout << "Auth response received code: " << ecode << endl;

    if (rep.getPayload() != NULL)
    {
        printRepresentation(rep);
    }

    if (ecode == 4)
    {
        g_accesstoken = rep.getValueToString("accesstoken");

        g_uid = rep.getValueToString("uid");
    }

    g_callbackLock.notify_all();
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:19,代码来源:mq_publisher.cpp


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