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


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

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


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

示例1: onBootStrapCallback

/* Callback Function to be called by the platform
   when response arrives from the BootStrap Server */
void onBootStrapCallback(const HeaderOptions &headerOptions, const OCRepresentation &rep,
                         const int eCode)
{
    dlog_print(DLOG_INFO, LOG_TAG, "#### onBootStrap entry");

    if (SUCCESS_RESPONSE != eCode)
    {
        dlog_print(DLOG_INFO, LOG_TAG, "#### onBootStrap -- onGET Response error: %d", eCode);
        return ;
    }

    dlog_print(DLOG_INFO, LOG_TAG, "#### onBootStrap -- GET request was successful");
    dlog_print(DLOG_INFO, LOG_TAG, "#### onBootStrap -- Resource URI: %s", rep.getUri().c_str());

    logMessage = "----------------------------<br>";
    logMessage += "GET request was successful<br>";
    logMessage += "URI : " + rep.getUri() + "<br>";

    defaultRegion = rep.getValue< std::string >("r");
    defaultSystemTime = rep.getValue< std::string >("st");
    defaultCurrency = rep.getValue< std::string >("c");
    defaultLocation = rep.getValue< std::string >("loc");

    logMessage += "Location : " + defaultLocation + "<br>";
    logMessage += "SystemTime : " + defaultSystemTime + "<br>";
    logMessage += "currency : " + defaultCurrency + "<br>";
    logMessage += "Region : " + defaultRegion + "<br>";

    dlog_print(DLOG_INFO, LOG_TAG, "  %s", logMessage.c_str());

    //Call updateLog in the thread safe mode
    ecore_main_loop_thread_safe_call_sync(updateLog, &logMessage);

}
开发者ID:HoTaeWang,项目名称:iotivity,代码行数:36,代码来源:conserverapp.cpp

示例2: triggerNetworkConnectionCb

        void RemoteEnrolleeResource::triggerNetworkConnectionCb(
                const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep,
                const int eCode)
        {
            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : %s, eCode = %d",
                    rep.getUri().c_str(),
                    eCode);

            if (eCode != 0)
            {
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
                        "triggerNetworkConnectionCb : Trigger action failed ");
                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
                m_provStatusCb(provStatus);
                return;
            }
            else
            {
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
                        "triggerNetworkConnectionCb : Provisioning is success ");
                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
                        ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONING_SUCCESS);
                m_provStatusCb(provStatus);
                return;
            }
        }
开发者ID:mobileink,项目名称:iotivity,代码行数:27,代码来源:RemoteEnrolleeResource.cpp

示例3: onBootstrap

// callback handler on GET request
void onBootstrap(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode)
{
    pthread_mutex_lock(&mutex_lock);
    isWaiting = 0;
    pthread_mutex_unlock(&mutex_lock);

    if (eCode != SUCCESS_RESPONSE)
    {
        std::cout << "onGET Response error: " << eCode << std::endl;
        return ;
    }

    std::cout << "\n\nGET request was successful" << std::endl;
    std::cout << "\tResource URI: " << rep.getUri() << std::endl;

    defaultDeviceName = rep.getValue< std::string >("n");
    defaultLocation = rep.getValue< std::string >("loc");
    defaultLocationName = rep.getValue< std::string >("locn");
    defaultRegion = rep.getValue< std::string >("r");
    defaultCurrency = rep.getValue< std::string >("c");

    std::cout << "\tDeviceName : " << defaultDeviceName << std::endl;
    std::cout << "\tLocation : " << defaultLocation << std::endl;
    std::cout << "\tLocationName : " << defaultLocationName << std::endl;
    std::cout << "\tCurrency : " << defaultCurrency << std::endl;
    std::cout << "\tRegion : " << defaultRegion << std::endl;

}
开发者ID:Frank-KunLi,项目名称:iotivity,代码行数:29,代码来源:con-server.cpp

示例4: 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

示例5: uri

/*
* Class:     org_iotivity_base_OcRepresentation
* Method:    getUri
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcRepresentation_getUri
(JNIEnv *env, jobject thiz)
{
    LOGD("OcRepresentation_getUri");
    OCRepresentation *rep = JniOcRepresentation::getOCRepresentationPtr(env, thiz);
    if (!rep) return nullptr;

    std::string uri(rep->getUri());
    return env->NewStringUTF(uri.c_str());
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:15,代码来源:JniOcRepresentation.cpp

示例6: onObserve

void onObserve(const HeaderOptions &headerOption , const OCRepresentation& rep , const int& eCode, const int& sequenceNumber)
{
	std::cout << "onObserve" << std::endl;
//    if(eCode == SUCCESS_RESPONSE)
	if(eCode <= OC_STACK_RESOURCE_DELETED)
    {

        AttributeMap attributeMap = rep.getAttributeMap();

        for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
        {
            if(attributeMap.find(it->first) == attributeMap.end())
            {
                return;
            }
        }

        if(rep.getUri().empty())
        {
        	cout << "uri is null\n";
            return;
        }

        std::cout << std::endl;
        std::cout << "========================================================" << std::endl;
        std::cout << "Receive OBSERVE RESULT:" << std::endl;
        std::cout << "\tSequenceNumber: " << sequenceNumber << std::endl;
        for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
        {
            std::cout << "\tAttribute name: " << it->first << " value: ";
            for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
            {
                std::cout << "\t" << *valueItr << " ";
            }

            std::cout << std::endl;
        }

        if(observe_count() > 30)
        {
            std::cout << "Cancelling Observe..." << std::endl;
            OCStackResult result = g_curResource->cancelObserve();

            std::cout << "Cancel result: " << result << std::endl;
            sleep(10);
            std::cout << "DONE" << std::endl;
            std::exit(0);
        }
    }
    else
    {
        std::cout << "onObserve Response error: " << eCode << std::endl;
        std::exit(-1);
    }
}
开发者ID:tizenorg,项目名称:platform.upstream.iotivity,代码行数:55,代码来源:SampleConsumer.cpp

示例7: getProvStatusResponse

        void RemoteEnrolleeResource::getProvStatusResponse(const HeaderOptions& /*headerOptions*/,
                const OCRepresentation& rep, const int eCode)
        {
            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : %s, eCode = %d",
                    rep.getUri().c_str(),
                    eCode);

            if (eCode != 0)
            {
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
                        "getProvStatusResponse : Provisioning is failed ");
                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
                m_provStatusCb(provStatus);
                return;
            }

            int ps = -1;

            rep.getValue(OC_RSRVD_ES_PS, ps);

            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ps - %d",
                    ps);

            if (ps == ES_PS_NEED_PROVISIONING) //Indicates the need for provisioning
            {
                OCRepresentation provisioningRepresentation;

                provisioningRepresentation.setValue(OC_RSRVD_ES_TNN,
                std::string(m_ProvConfig.provData.WIFI.ssid));
                provisioningRepresentation.setValue(OC_RSRVD_ES_CD,
                std::string(m_ProvConfig.provData.WIFI.pwd));

                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ssid - %s",
                        m_ProvConfig.provData.WIFI.ssid);
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : pwd - %s",
                        m_ProvConfig.provData.WIFI.pwd);

                m_ocResource->post(provisioningRepresentation, QueryParamsMap(),
                        std::function<
                                void(const HeaderOptions& headerOptions,
                                        const OCRepresentation& rep, const int eCode) >(
                        std::bind(&RemoteEnrolleeResource::checkProvInformationCb, this,
                        std::placeholders::_1, std::placeholders::_2,
                        std::placeholders::_3)));
            }
            else if (ps == ES_PS_PROVISIONING_COMPLETED) //Indicates that provisioning is completed
            {
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
                        "getProvStatusResponse : Provisioning is successful");
                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
                        ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONED_ALREADY);
                m_provStatusCb(provStatus);
            }
        }
开发者ID:mobileink,项目名称:iotivity,代码行数:55,代码来源:RemoteEnrolleeResource.cpp

示例8: onReboot

void onReboot(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode)
{
    pthread_mutex_lock(&mutex_lock);
    isWaiting = 0;
    pthread_mutex_unlock(&mutex_lock);

    if (eCode != SUCCESS_RESPONSE)
    {
        return ;
    }

    std::cout << "\tResource URI: " << rep.getUri() << std::endl;
    std::cout << "\t\tReboot:" << rep.getValue< std::string >("value") << std::endl;
}
开发者ID:rzr,项目名称:iotivity-1,代码行数:14,代码来源:con-client.cpp

示例9: onGet

void onGet(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode)
{
	try
	{
		if(eCode == OC_STACK_OK)
		{
			dlog_print(DLOG_INFO, LOG_TAG,  "GET request was successful %s", rep.getUri().c_str());
			std::cout << "Attributes : " << rep.numberOfAttributes() << std::endl;
			typedef std::map<std::string, int>::iterator it_type;
			for(it_type iterator = intprops.begin(); iterator != intprops.end(); iterator++) {
				std::cout << "Key  : " << iterator->first << " Value = "<<rep[iterator->first]<<std::endl;
				iterator->second = rep[iterator->first];
			}
			typedef std::map<std::string, double>::iterator itd_type;
			for(itd_type iterator = doubleprops.begin(); iterator != doubleprops.end(); iterator++) {
				std::cout << "Key  : " << iterator->first << " Value = "<<rep[iterator->first]<<std::endl;
				iterator->second = rep[iterator->first];
			}

			rvidata r;
			r.lt = rep["leftTemperature"];
			r.rt = rep["rightTemperature"];
			r.lhs = rep["leftSeatHeat"];
			r.rhs = rep["rightSeatHeat"];
			r.fs = rep["fanSpeed"];
			r.fd = rep["fanDown"];
			r.fr = rep["fanRight"];
			r.fu = rep["fanUp"];
			r.fac = rep["fanAC"];
			r.fa = rep["fanAuto"];
			r.fr = rep["fanRecirc"];
			r.dm = rep["defrostMax"];
			r.df = rep["defrostFront"];
			r.dr = rep["defrostRear"];

			send_message(&r);



		}
		else
		{
			dlog_print(DLOG_INFO, LOG_TAG,  "GET request was UNsuccessful");
		}
	}
	catch(std::exception& e)
	{
		std::cout << "Exception: " << e.what() << " in onPut" << std::endl;
	}
}
开发者ID:iamsanjeev,项目名称:practice,代码行数:50,代码来源:geniviocfs2.cpp

示例10: checkProvInformationCb

        void RemoteEnrolleeResource::checkProvInformationCb(const HeaderOptions& /*headerOptions*/,
                const OCRepresentation& rep, const int eCode)
        {
            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : %s, eCode = %d",
                    rep.getUri().c_str(),
                    eCode);

            if (eCode != 0)
            {
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
                        "checkProvInformationCb : Provisioning is failed ");
                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
                m_provStatusCb(provStatus);
                return;
            }

            int ps = -1;

            rep.getValue(OC_RSRVD_ES_PS, ps);

            OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : ps - %d", ps);

            //Provisioning status check
            if (ps == ES_PS_PROVISIONING_COMPLETED)
            {
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
                        "checkProvInformationCb : Provisioning is success. "
                        "Now trigger network connection ");

                #ifdef REMOTE_ARDUINO_ENROLEE
                 std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
                        ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONING_SUCCESS);
                m_provStatusCb(provStatus);
                #endif

                triggerNetworkConnection();
                return;
            }
            else
            {
                OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
                        "checkProvInformationCb : Provisioning is failed ");
                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
                m_provStatusCb(provStatus);
                return;
            }
        }
开发者ID:mobileink,项目名称:iotivity,代码行数:49,代码来源:RemoteEnrolleeResource.cpp

示例11: onGet

// callback handler on GET request
void onGet(const HeaderOptions &headerOption , const OCRepresentation& rep , const int eCode)
{
    if(eCode == SUCCESS_RESPONSE)
    {
        std::cout << "GET request was successful" << std::endl;

        AttributeMap attributeMap = rep.getAttributeMap();

        std::cout << "Resource URI: " << rep.getUri() << std::endl;

        for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
        {
            std::cout << "\tAttribute name: " << it->first << " value: ";
            for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
            {
                std::cout << "\t" << *valueItr << " ";
            }

            std::cout << std::endl;
        }

        std::vector< OCRepresentation > children = rep.getChildren();

        for(auto oit = children.begin() ; oit != children.end() ; ++oit)
        {
            std::cout << "Child Resource URI: " << oit->getUri() << std::endl;

            attributeMap = oit->getAttributeMap();

            for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
            {
                std::cout << "\tAttribute name: " << it->first << " value: ";
                for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
                {
                    std::cout << "\t" << *valueItr << " ";
                }

                std::cout << std::endl;
            }
        }
    }
    else
    {
        std::cout << "onGET Response error: " << eCode << std::endl;
        std::exit(-1);
    }
}
开发者ID:tizenorg,项目名称:platform.upstream.iotivity,代码行数:48,代码来源:SampleConsumer.cpp

示例12: onGetForPresence

void GroupManager::onGetForPresence(const HeaderOptions& headerOptions,
        const OCRepresentation& rep, const int eCode, CollectionPresenceCallback callback)
{
    if (eCode == OC_STACK_OK)
    {
        std::cout << "GET request was successful" << std::endl;
        std::cout << "Resource URI: " << rep.getUri() << std::endl;

        checkCollectionRepresentation(rep, callback);

    }
    else
    {
        std::cout << "onGET Response error: " << eCode << std::endl;
        callback("", OC_STACK_ERROR);
    }
}
开发者ID:EmuxEvans,项目名称:iotivity,代码行数:17,代码来源:GroupManager.cpp

示例13: onGet

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

        printRepresentation(rep);

        putLightRepresentation(curResource);
    }
    else
    {
        std::cout << "onGET Response error: " << eCode << std::endl;
        std::exit(-1);
    }
}
开发者ID:TizenTeam,项目名称:iotivity,代码行数:18,代码来源:garageclient.cpp

示例14: onGet

void SensorResource::onGet(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode)
{
	try {
		if(eCode == OC_STACK_OK) {
			std::cout << "Resource URI: " << rep.getUri() << std::endl;

			if (rep.hasAttribute("fanstate")) {
				std::string state = rep.getValue<std::string>("fanstate");
				m_fanState = (state == "on" ? true:false);
				std::cout << "\tfanstate: " << m_fanState << std::endl;
			}
		}
		else {
			std::cout << "onGET Response error: " << eCode << std::endl;
		}
	}
	catch(std::exception& e) {
		std::cout << "Exception: " << e.what() << " in onGet" << std::endl;
	}
}
开发者ID:ttzeng,项目名称:makeground,代码行数:20,代码来源:sensor_resource.cpp

示例15: onLightGet

void onLightGet(const HeaderOptions &headerOptions, const OCRepresentation &rep, const int eCode)
{
    if (eCode == OC_STACK_OK)
    {
        std::cout << "GET Light request was successful" << std::endl;
        std::cout << "Resource URI: " << rep.getUri() << std::endl;

        rep.getValue("state", mylight.m_state);
        rep.getValue("power", mylight.m_power);
        rep.getValue("name", mylight.m_name);

        std::cout << "\tstate: " << mylight.m_state << std::endl;
        std::cout << "\tpower: " << mylight.m_power << std::endl;
        std::cout << "\tname: " << mylight.m_name << std::endl;
    }
    else
    {
        std::cout << "onGET Response error: " << eCode << std::endl;
        std::exit(-1);
    }
}
开发者ID:MCherifiOSS,项目名称:iotivity,代码行数:21,代码来源:mqttclient.cpp


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