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


C++ CMethodResult::setError方法代码示例

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


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

示例1: setProperties

void CSensorImpl::setProperties(const rho::Hashtable<rho::String, rho::String>& propertyMap, rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request to set properties : " + m_sensorId;

    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot set properties");
    } else
    {
        for (rho::Hashtable<rho::String, rho::String>::const_iterator propMapItr = propertyMap.begin(); propMapItr != propertyMap.end(); propMapItr++)
        {
            if (_stricmp(propMapItr->first.c_str(), "minimumGap") == 0)
            {
                int minimumGap = atoi(propMapItr->second.c_str());
                if (minimumGap < 200)
                {
                    minimumGap = 200;
                }
                this->m_rawSensor->setMinimumGap(minimumGap);
            } else
            {
                oResult.setError(propMapItr->first + " is readonly or is invalid.");
            }
        }
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:26,代码来源:Sensor_impl.cpp

示例2: getProperties

void CSensorImpl::getProperties(const rho::Vector<rho::String>& arrayofNames, rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request for get properties : " + m_sensorId;

    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot get properties");
    } else
    {
        rho::Hashtable<rho::String, rho::String> propsHash;
        for (rho::Vector<rho::String>::const_iterator namesIterator = arrayofNames.begin(); namesIterator != arrayofNames.end(); namesIterator++)
        {
            if (_stricmp((*namesIterator).c_str(), "minimumGap") == 0)
            {
                propsHash.put(*namesIterator, rho::common::convertToStringA<int>(this->m_rawSensor->getMinimumGap()));
            } else if (_stricmp((*namesIterator).c_str(), "type") == 0)
            {
                propsHash.put(*namesIterator, this->m_rawSensor->getType());
            } else if (_stricmp((*namesIterator).c_str(), "status") == 0)
            {
                propsHash.put(*namesIterator, this->m_rawSensor->getStatus());
            } else
            {
                propsHash.put(*namesIterator, "Invalid attribute");
            }
        }
        oResult.set(propsHash);
    }


}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:31,代码来源:Sensor_impl.cpp

示例3: getType

void CSensorImpl::getType(rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Request received for type : " + m_sensorId;
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot get type.");
    } else
    {
        oResult.set(this->m_rawSensor->getType());
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:11,代码来源:Sensor_impl.cpp

示例4: start

        //methods
        virtual void start( int interval, rho::apiGenerator::CMethodResult& oResult) 
		{
			if (interval <= 0)
			{
				oResult.setError("invalid interval");
				return;
			}

			m_oResult = oResult;
			common::CRhoTimer& timerManager = RHODESAPP().getTimer();
			timerManager.addNativeTimer(interval, this);
        } 
开发者ID:Gaurav2728,项目名称:rhodes,代码行数:13,代码来源:TimerImpl.cpp

示例5: setProperty

void CSensorImpl::setProperty(const rho::String& propertyName,  const rho::String& propertyValue, rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request to set property : " + m_sensorId + " : " + propertyName + " = " + propertyValue;
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot set property " + propertyName);
    } else
    {
        if (_stricmp(propertyName.c_str(), "minimumGap") == 0)
        {
            int minimumGap = atoi(propertyValue.c_str());
            if (minimumGap < 200)
            {
                minimumGap = 200;
            }
            this->m_rawSensor->setMinimumGap(minimumGap);            
        } else
        {
            oResult.setError(propertyName + " is readonly or is invalid.");
        }
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:22,代码来源:Sensor_impl.cpp

示例6: getProperty

void CSensorImpl::getProperty(const rho::String& propertyName, rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request for get property : " + m_sensorId + " : " + propertyName;
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot set " + propertyName);
    } else
    {
        if (_stricmp(propertyName.c_str(), "minimumGap") == 0)
        {
            oResult.set(this->m_rawSensor->getMinimumGap());
        } else if (_stricmp(propertyName.c_str(), "type") == 0)
        {
            oResult.set(this->m_rawSensor->getType());
        } else if (_stricmp(propertyName.c_str(), "status") == 0)
        {
            oResult.set(this->m_rawSensor->getStatus());
        } else
        {
            oResult.setError("Invalid attribute");
        }
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:23,代码来源:Sensor_impl.cpp

示例7: setMinimumGap

void CSensorImpl::setMinimumGap(int minimumGap, rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Request received to set minimum gap : " + m_sensorId + " : to " + rho::common::convertToStringA<int>(minimumGap);
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot set minimumegap.");
    }
    else
    {
        if (minimumGap < 200)
            minimumGap = 200;         
        this->m_rawSensor->setMinimumGap(minimumGap);
        oResult.set(true);
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:15,代码来源:Sensor_impl.cpp

示例8: getAllProperties

void CSensorImpl::getAllProperties(rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request for get all properties : " + m_sensorId;

    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot get properties");
    } else
    {
        rho::Hashtable<rho::String, rho::String> propsHash;

        propsHash.put("minimumGap", rho::common::convertToStringA<int>(this->m_rawSensor->getMinimumGap()));
        propsHash.put("type", this->m_rawSensor->getType());
        propsHash.put("status", this->m_rawSensor->getStatus());
        oResult.set(propsHash);

    }

}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:19,代码来源:Sensor_impl.cpp

示例9: stop

void CSensorImpl::stop(rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request to stop sensor: " + m_sensorId;
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot get stop.");
    }
    else
    {
        
        this->m_rawSensor->Stop();
        if ((NULL != m_callbackMethodResult) && (m_callbackMethodResult->hasCallback()))
        {
            m_callbackMethodResult = NULL;

        }
        rho::common::CMutexLock lock(m_cs);
        m_cache.clear();
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:20,代码来源:Sensor_impl.cpp

示例10: readData

void CSensorImpl::readData(rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request to readData: " + m_sensorId;
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot get stop.");
    }
    else
    {
        rho::common::CMutexLock lock(m_cs);
        if (m_cache.empty())
        {
            rho::Hashtable<rho::String, rho::String> props;
            props.put("message", "No Samples received from sensor. Check status");// The sampling is stopped (check status) or retry based on the minium gap property or reduce the gap interval");
	        props.put("status", "error");
            oResult.set(props);
        }
        else
            oResult.set(m_cache);
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:21,代码来源:Sensor_impl.cpp

示例11: start

void CSensorImpl::start(rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request to start sensor: " + m_sensorId;
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot get start.");
    }
    else
    {
        //const char * status = m_rawSensor->getStatus();
        this->m_rawSensor->Start();
        rho::common::CMutexLock lock(m_cs);
        if (oResult.hasCallback())
        {
            m_callbackMethodResult = &oResult;
        }
        else
        {
            m_callbackMethodResult = NULL;
        }
    }

}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:23,代码来源:Sensor_impl.cpp

示例12: setWindowSize

void CSystemImpl::setWindowSize(int, int, rho::apiGenerator::CMethodResult& result)
{
    result.setError("not implemented at Android platform");
}
开发者ID:taolin204,项目名称:rhodes,代码行数:4,代码来源:SystemImpl.cpp

示例13: getScreenSleeping

void CSystemImpl::getScreenSleeping(rho::apiGenerator::CMethodResult& result)
{
    result.setError("not implemented at Android platform");
}
开发者ID:taolin204,项目名称:rhodes,代码行数:4,代码来源:SystemImpl.cpp

示例14: setShowKeyboard

void CSystemImpl::setShowKeyboard(bool, rho::apiGenerator::CMethodResult& result)
{
    result.setError("not implemented at Android platform");
}
开发者ID:taolin204,项目名称:rhodes,代码行数:4,代码来源:SystemImpl.cpp

示例15: setHttpProxyURI

void CSystemImpl::setHttpProxyURI(const rho::String&, rho::apiGenerator::CMethodResult& result)
{
    result.setError("not implemented at Android platform");
}
开发者ID:taolin204,项目名称:rhodes,代码行数:4,代码来源:SystemImpl.cpp


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