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
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.º 3
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();
}