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(); }
RHO_GLOBAL int rho_sys_get_screen_height() { VALUE res; if ( rho_sysimpl_get_property((char*)"screen_height", &res) ) return NUM2INT(res); return 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(); }
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(); }
void CSystemImpl::getOsVersion(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("os_version", result); }
void CSystemImpl::getDeviceOwnerEmail(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("device_owner_email", result); }
//---------------------------------------------------------------------------------------------------------------------- void CSystemImpl::getHasCellNetwork(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("has_cell_network", result); }
void CSystemImpl::getPhoneNumber(CMethodResult& result) { rho_sysimpl_get_property("phone_number", result); }
void CSystemImpl::getPpiY(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("ppi_y", result); }
void CSystemImpl::getRealScreenWidth(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("real_screen_width", result); }
void CSystemImpl::getOemInfo(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("oem_info", result); }
void CSystemImpl::getHasCalendar(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("has_calendar", result); }
void CSystemImpl::getIsEmulator(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("is_emulator", result); }
void CSystemImpl::getCountry(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("country", result); }
void CSystemImpl::getLocale(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("locale", result); }
void CSystemImpl::getDeviceName(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("device_name", result); }
void CSystemImpl::getPhoneId(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("phone_id", result); }
//---------------------------------------------------------------------------------------------------------------------- void CSystemImpl::getIsSymbolDevice(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("is_symbol_device", result); }
void CSystemImpl::getScreenHeight(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("screen_height", result); }
void CSystemImpl::getUuid(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("uuid", result); }
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(); }
void CSystemImpl::getHasCamera(CMethodResult& result) { rho_sysimpl_get_property("has_camera", result); }
void CSystemImpl::getWebviewFramework(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("webview_framework", result); }
void CSystemImpl::getScreenOrientation(rho::apiGenerator::CMethodResult& result) { rho_sysimpl_get_property("screen_orientation", result); }