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(); }
String CClientRegister::getRegisterBody(const String& strClientID) { String strPushType = rho::push::CPushManager::getInstance()->getDefaultID(); if(strPushType == "rhoconnect") { strPushType = "rhoconnect_push"; } int port = RHOCONF().getInt("push_port"); String body = CSyncThread::getSyncEngine().getProtocol().getClientRegisterBody( strClientID, m_strDevicePin, port > 0 ? port : DEFAULT_PUSH_PORT, rho_rhodesapp_getplatform(), rho::System::getPhoneId(), strPushType); LOG(INFO)+"getRegisterBody() BODY is: " + body; return body; }
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(); }