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


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

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


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

示例1: RoomResource

    /// Constructor
    RoomResource(): m_roomName("John's Room"), m_roomHandle(nullptr), m_lightState(false),
                    m_lightColor(0),m_lightHandle(nullptr),  m_fanState(false), m_fanSpeed(0),
                    m_fanHandle(nullptr)
    {
        m_roomUri = "/a/room"; // URI of the resource
        m_roomTypes.push_back("core.room"); // resource type name. In this case, it is light
        m_roomInterfaces.push_back(DEFAULT_INTERFACE); // resource interface.
        m_roomInterfaces.push_back(BATCH_INTERFACE); // resource interface.
        m_roomInterfaces.push_back(LINK_INTERFACE); // resource interface.
        m_roomRep.setValue("name", m_roomName);
        m_roomRep.setUri(m_roomUri);
        m_roomRep.setResourceTypes(m_roomTypes);
        m_roomRep.setResourceInterfaces(m_roomInterfaces);


        m_lightUri = "/a/light"; // URI of the resource
        m_lightTypes.push_back("core.light"); // resource type name. In this case, it is light
        m_lightInterfaces.push_back(DEFAULT_INTERFACE); // resource interface.

        m_lightRep.setUri(m_lightUri);
        m_lightRep.setResourceTypes(m_lightTypes);
        m_lightRep.setResourceInterfaces(m_lightInterfaces);
        m_lightRep.setValue("state", m_lightState);
        m_lightRep.setValue("color", m_lightColor);

        m_fanUri = "/a/fan"; // URI of the resource
        m_fanTypes.push_back("core.fan"); // resource type name. In this case, it is light
        m_fanInterfaces.push_back(DEFAULT_INTERFACE); // resource interface.

        m_fanRep.setUri(m_fanUri);
        m_fanRep.setResourceTypes(m_fanTypes);
        m_fanRep.setResourceInterfaces(m_fanInterfaces);
        m_fanRep.setValue("state", m_fanState);
        m_fanRep.setValue("speed", m_fanSpeed);

    }
开发者ID:iotk,项目名称:iochibity-cxx,代码行数:37,代码来源:roomserver.cpp

示例2: LOGD

/*
* Class:     org_iotivity_base_OcRepresentation
* Method:    setResourceInterfaceArray
* Signature: ([Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_iotivity_base_OcRepresentation_setResourceInterfaceArray
(JNIEnv *env, jobject thiz, jobjectArray jResourceInterfaceArray)
{
    LOGD("OcRepresentation_setResourceInterfaceArray");
    if (!jResourceInterfaceArray)
    {
        ThrowOcException(OC_STACK_INVALID_PARAM, "resourceInterfaceList cannot be null");
        return;
    }
    OCRepresentation *rep = JniOcRepresentation::getOCRepresentationPtr(env, thiz);
    if (!rep) return;

    std::vector<std::string> resourceInterfaces;
    JniUtils::convertJavaStrArrToStrVector(env, jResourceInterfaceArray, resourceInterfaces);
    rep->setResourceInterfaces(resourceInterfaces);
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:21,代码来源:JniOcRepresentation.cpp


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