Exemple #1
0
jobject rho_cast_helper<jobject, rho::Vector<std::string> >::operator()(JNIEnv* env, const rho::Vector<std::string>& stringVector)
{
    RAWTRACE("rho_cast<jobject, HStringVector>");

    if (!initConvertor(env)) return 0;

    jobject jArray = env->NewObject(clsArrayList, midArrayList);
    if(!jArray) return 0;

    for(std::vector<std::string>::const_iterator iter = stringVector.begin(); iter != stringVector.end(); ++iter)
    {
        jhstring jhItem = rho_cast<jstring>(env, *iter);
        env->CallBooleanMethod(jArray, midArrayListAdd, jhItem.get());
    }
    return jArray;
}
Exemple #2
0
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);
    }


}