Ejemplo n.º 1
0
    VALUE rho_sys_get_property(char* szPropName)
    {
        if (!szPropName || !*szPropName)
            return rho_ruby_get_NIL();

        VALUE res;
#ifdef RHODES_EMULATOR
        if (rho_simimpl_get_property(szPropName, &res))
            return res;
#endif

        if (rho_sysimpl_get_property(szPropName, &res))
            return res;

        if (strcasecmp("platform",szPropName) == 0)
            return rho_ruby_create_string(rho_rhodesapp_getplatform());

        if (strcasecmp("has_network",szPropName) == 0)
            return rho_sys_has_network();

        if (strcasecmp("locale",szPropName) == 0)
            return rho_sys_get_locale();

        if (strcasecmp("screen_width",szPropName) == 0)
            return rho_ruby_create_integer(rho_sys_get_screen_width());

        if (strcasecmp("screen_height",szPropName) == 0)
            return rho_ruby_create_integer(rho_sys_get_screen_height());

        if (strcasecmp("device_id",szPropName) == 0)
        {
            rho::String strDeviceID = "";
            if ( rho::sync::CClientRegister::getInstance() )
                strDeviceID = rho::sync::CClientRegister::getInstance()->getDevicePin();

            return rho_ruby_create_string(strDeviceID.c_str());
        }

        if (strcasecmp("phone_id", szPropName) == 0)
            return rho_ruby_create_string("");

        if (strcasecmp("full_browser",szPropName) == 0)
            return rho_ruby_create_boolean(1);

        if (strcasecmp("rhodes_port",szPropName) == 0)
            return rho_ruby_create_integer(atoi(RHODESAPP().getFreeListeningPort()));

        if (strcasecmp("is_emulator",szPropName) == 0)
            return rho_ruby_create_boolean(0);

        if (strcasecmp("has_touchscreen",szPropName) == 0)
            return rho_ruby_create_boolean(1);

        if (strcasecmp("has_sqlite",szPropName) == 0)
            return rho_ruby_create_boolean(1);

        RAWLOG_ERROR1("Unknown Rho::System property : %s", szPropName);

        return rho_ruby_get_NIL();
    }
Ejemplo n.º 2
0
RHO_GLOBAL int rho_sys_get_screen_height()
{
    VALUE res;
    if ( rho_sysimpl_get_property((char*)"screen_height", &res) )
        return NUM2INT(res);

    return 0;
}
Ejemplo n.º 3
0
RHO_GLOBAL VALUE rho_sys_get_locale()
{
    VALUE res;
    if ( rho_sysimpl_get_property((char*)"locale", &res) )
        return res;

    return rho_ruby_get_NIL();
}
Ejemplo n.º 4
0
VALUE rho_sys_get_property(char* szPropName) 
{
	if (!szPropName || !*szPropName) 
        return rho_ruby_get_NIL();
    
    VALUE res = rho_sysimpl_get_property(szPropName);
    if (res)
        return res;

	if (strcasecmp("platform",szPropName) == 0) 
        return rho_ruby_create_string(getPlatformProp());

	if (strcasecmp("has_network",szPropName) == 0) 
        return rho_sys_has_network();

	if (strcasecmp("locale",szPropName) == 0) 
        return rho_sys_get_locale();

	if (strcasecmp("screen_width",szPropName) == 0) 
        return rho_ruby_create_integer(rho_sys_get_screen_width());

	if (strcasecmp("screen_height",szPropName) == 0) 
        return rho_ruby_create_integer(rho_sys_get_screen_height());

	if (strcasecmp("device_id",szPropName) == 0) 
    {
        rho::String strDeviceID = "";
        if ( rho::sync::CClientRegister::getInstance() )
            strDeviceID = rho::sync::CClientRegister::getInstance()->getDevicePin();

        return rho_ruby_create_string(strDeviceID.c_str());
    }

	if (strcasecmp("full_browser",szPropName) == 0) 
        return rho_ruby_create_boolean(1);

    RAWLOG_ERROR1("Unknown Rho::System property : %s", szPropName);

    return rho_ruby_get_NIL();
}
Ejemplo n.º 5
0
void CSystemImpl::getOsVersion(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("os_version", result);
}
Ejemplo n.º 6
0
void CSystemImpl::getDeviceOwnerEmail(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("device_owner_email", result);
}
Ejemplo n.º 7
0
//----------------------------------------------------------------------------------------------------------------------
void CSystemImpl::getHasCellNetwork(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("has_cell_network", result);
}
Ejemplo n.º 8
0
void CSystemImpl::getPhoneNumber(CMethodResult& result)
{
    rho_sysimpl_get_property("phone_number", result);
}
Ejemplo n.º 9
0
void CSystemImpl::getPpiY(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("ppi_y", result);
}
Ejemplo n.º 10
0
void CSystemImpl::getRealScreenWidth(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("real_screen_width", result);
}
Ejemplo n.º 11
0
void CSystemImpl::getOemInfo(rho::apiGenerator::CMethodResult& result)
{
	rho_sysimpl_get_property("oem_info", result);
}
Ejemplo n.º 12
0
void CSystemImpl::getHasCalendar(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("has_calendar", result);
}
Ejemplo n.º 13
0
void CSystemImpl::getIsEmulator(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("is_emulator", result);
}
Ejemplo n.º 14
0
void CSystemImpl::getCountry(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("country", result);
}
Ejemplo n.º 15
0
void CSystemImpl::getLocale(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("locale", result);
}
Ejemplo n.º 16
0
void CSystemImpl::getDeviceName(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("device_name", result);
}
Ejemplo n.º 17
0
void CSystemImpl::getPhoneId(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("phone_id", result);
}
Ejemplo n.º 18
0
//----------------------------------------------------------------------------------------------------------------------
void CSystemImpl::getIsSymbolDevice(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("is_symbol_device", result);
}
Ejemplo n.º 19
0
void CSystemImpl::getScreenHeight(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("screen_height", result);
}
Ejemplo n.º 20
0
void CSystemImpl::getUuid(rho::apiGenerator::CMethodResult& result)
{
	rho_sysimpl_get_property("uuid", result);
}
Ejemplo n.º 21
0
VALUE rho_sys_get_property(char* szPropName) 
{
	if (!szPropName || !*szPropName) 
        return rho_ruby_get_NIL();
    
    VALUE res;
#ifdef RHODES_EMULATOR
    if (rho_simimpl_get_property(szPropName, &res))
        return res;
#endif

    if (rho_sysimpl_get_property(szPropName, &res))
        return res;

	if (strcasecmp("platform",szPropName) == 0) 
        return rho_ruby_create_string(rho_rhodesapp_getplatform());

	if (strcasecmp("has_network",szPropName) == 0) 
        return rho_sys_has_network();

	if (strcasecmp("locale",szPropName) == 0) 
        return rho_sys_get_locale();

	if (strcasecmp("screen_width",szPropName) == 0) 
        return rho_ruby_create_integer(rho_sys_get_screen_width());

	if (strcasecmp("screen_height",szPropName) == 0) 
        return rho_ruby_create_integer(rho_sys_get_screen_height());

	if (strcasecmp("real_screen_width",szPropName) == 0) 
        return rho_ruby_create_integer(rho_sys_get_screen_width());
    
	if (strcasecmp("real_screen_height",szPropName) == 0) 
        return rho_ruby_create_integer(rho_sys_get_screen_height());

	if (strcasecmp("device_id",szPropName) == 0) 
    {
        rho::String strDeviceID = "";
        if ( rho::sync::CClientRegister::getInstance() )
            strDeviceID = rho::sync::CClientRegister::getInstance()->getDevicePin();

        return rho_ruby_create_string(strDeviceID.c_str());
    }

    if (strcasecmp("phone_id", szPropName) == 0)
        return rho_ruby_create_string(""); 

	if (strcasecmp("full_browser",szPropName) == 0) 
        return rho_ruby_create_boolean(1);

	if (strcasecmp("rhodes_port",szPropName) == 0) 
        return rho_ruby_create_integer(atoi(RHODESAPP().getFreeListeningPort()));

	if (strcasecmp("free_server_port",szPropName) == 0) 
        return rho_ruby_create_integer(RHODESAPP().determineFreeListeningPort());

	if (strcasecmp("is_emulator",szPropName) == 0) 
        return rho_ruby_create_boolean(0);

	if (strcasecmp("has_touchscreen",szPropName) == 0)
        return rho_ruby_create_boolean(1);

	if (strcasecmp("has_sqlite",szPropName) == 0)
        return rho_ruby_create_boolean(1);
    
    if (strcasecmp("security_token_not_passed",szPropName) == 0) {
        int passed = 0;
        if ((RHODESAPP().isSecurityTokenNotPassed())) {
            passed = 1;
        }
        return rho_ruby_create_boolean(passed);
    }

	if (strcasecmp("is_moto_device",szPropName) == 0)
#ifdef APP_BUILD_CAPABILITY_MOTOROLA
        return rho_ruby_create_boolean(1);
#else
        return rho_ruby_create_boolean(0);
#endif

    RAWLOG_ERROR1("Unknown Rho::System property : %s", szPropName);

    return rho_ruby_get_NIL();
}
Ejemplo n.º 22
0
void CSystemImpl::getHasCamera(CMethodResult& result)
{
    rho_sysimpl_get_property("has_camera", result);
}
Ejemplo n.º 23
0
void CSystemImpl::getWebviewFramework(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("webview_framework", result);

}
Ejemplo n.º 24
0
void CSystemImpl::getScreenOrientation(rho::apiGenerator::CMethodResult& result)
{
    rho_sysimpl_get_property("screen_orientation", result);
}