Exemplo 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();
    }
Exemplo n.º 2
0
RHO_GLOBAL VALUE get_camera_info(const char* camera_type) {
    
    JNIEnv *env = jnienv();
    jclass cls = getJNIClass(RHODES_JAVA_CLASS_CAMERA);
    if (!cls) return rho_ruby_get_NIL();
    jmethodID mid_w = getJNIClassStaticMethod(env, cls, "getMaxCameraWidth", "(Ljava/lang/String;)I");
    jmethodID mid_h = getJNIClassStaticMethod(env, cls, "getMaxCameraHeight", "(Ljava/lang/String;)I");
    if ((!mid_w) || (!mid_h)) return rho_ruby_get_NIL();
    int w = env->CallStaticIntMethod(cls, mid_w, rho_cast<jhstring>(camera_type).get());
    int h = env->CallStaticIntMethod(cls, mid_h, rho_cast<jhstring>(camera_type).get());
    
    if ((w <= 0) || (h <= 0)) {
        return rho_ruby_get_NIL();
    }

    VALUE hash = rho_ruby_createHash();
    
    VALUE hash_max_resolution = rho_ruby_createHash();
    
    rho_ruby_add_to_hash(hash_max_resolution, rho_ruby_create_string("width"), rho_ruby_create_integer(w));
    rho_ruby_add_to_hash(hash_max_resolution, rho_ruby_create_string("height"), rho_ruby_create_integer(h));

    rho_ruby_add_to_hash(hash, rho_ruby_create_string("max_resolution"), hash_max_resolution);
    
    return hash;
}
Exemplo n.º 3
0
	virtual unsigned long getObjectValue() {
        VALUE b_array = rho_ruby_create_array();
        VALUE b_hash = rho_ruby_createHash();
        rho_ruby_add_to_hash(b_hash, rho_ruby_create_string("friendlyName"), rho_ruby_create_string("RhoBarcode based on ZXing"));
        rho_ruby_add_to_hash(b_hash, rho_ruby_create_string("deviceName"), rho_ruby_create_string("RhoBarcode"));
        rho_ruby_add_to_array(b_array, b_hash);
        return b_array;
	}
Exemplo n.º 4
0
RHO_GLOBAL VALUE rho_webview_get_current_url(int tab_index) {
    JNIEnv *env = jnienv();
    jclass cls = getJNIClass(RHODES_JAVA_CLASS_WEB_VIEW);
    if (!cls) return rho_ruby_create_string("");
    jmethodID mid = getJNIClassStaticMethod(env, cls, "get_current_url", "(I)Ljava/lang/String;");
    if (!mid) return rho_ruby_create_string("");

    jstring jhUrl = static_cast<jstring>(env->CallStaticObjectMethod(cls, mid, tab_index));

    return rho_cast<VALUE>(env, jhUrl);

}
Exemplo n.º 5
0
VALUE rho_cast_helper<VALUE, jobject>::operator()(JNIEnv *env, jobject obj)
{
    if (env->IsSameObject(obj, NULL) == JNI_TRUE)
        return Qnil;

    if (!initConvertor(env))
    {
        env->ThrowNew(getJNIClass(RHODES_JAVA_CLASS_RUNTIME_EXCEPTION), "Java <=> Ruby conversion initialization failed");
        return Qnil;
    }

    if (env->IsInstanceOf(obj, clsString))
    {
        const char *str = env->GetStringUTFChars(static_cast<jstring>(obj), JNI_FALSE);
        VALUE res = rho_ruby_create_string(str);
        env->ReleaseStringUTFChars(static_cast<jstring>(obj), str);
        return res;
    }

    if (env->IsInstanceOf(obj, clsMap))
        return convertJavaMapToRubyHash(env, obj);

    RAWLOG_ERROR("rho_cast<VALUE, jobject>: unknown type of value");
    return Qnil;
}
Exemplo n.º 6
0
unsigned long CAsyncHttp::CHttpCommand::getRetValue()
{
    if ( m_strCallback.length() == 0 )
        return rho_ruby_create_string(m_strResBody.c_str());

    return rho_ruby_get_NIL();
}
Exemplo n.º 7
0
VALUE rho_cast_helper<VALUE, jstring>::operator()(JNIEnv *env, jstring jStr)
{
    if(env->IsSameObject(jStr, NULL) == JNI_TRUE)
        return Qnil;

    const char *str = env->GetStringUTFChars(jStr, JNI_FALSE);
    VALUE res = rho_ruby_create_string(str);
    env->ReleaseStringUTFChars(jStr, str);

    return res;
}
Exemplo n.º 8
0
RHO_GLOBAL VALUE rho_bluetooth_session_read_string(const char* connected_device_name) {
    JNIEnv *env = jnienv();
    jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
    if (!cls) return 0;
    jmethodID mid = getJNIClassStaticMethod(env, cls, "session_read_string", "(Ljava/lang/String;)Ljava/lang/String;");
    if (!mid) return 0;
    jhstring objStr1 = rho_cast<jstring>(env, connected_device_name);
    jhstring res = static_cast<jstring>(env->CallStaticObjectMethod(cls, mid, objStr1.get()));
    std::string msg = rho_cast<std::string>(env, res);
    return rho_ruby_create_string(msg.c_str());
}
Exemplo n.º 9
0
RHO_GLOBAL VALUE rho_bluetooth_get_device_name() {
    JNIEnv *env = jnienv();
    jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHOBLUETOOTHMANAGER);
    if (!cls) return rho_ruby_get_NIL();
    jmethodID mid = getJNIClassStaticMethod(env, cls, "get_device_name", "()Ljava/lang/String;");
    if (!mid) return rho_ruby_get_NIL();
    jstring jname = static_cast<jstring>(env->CallStaticObjectMethod(cls, mid));
    if (!jname) return rho_ruby_get_NIL();
    std::string name = rho_cast<std::string>(env, jname); 
    RAWLOG_INFO1("rho_bluetooth_get_device_name() : %s", name.c_str());
    return rho_ruby_create_string(name.c_str());
}
Exemplo n.º 10
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();
}
extern "C" VALUE locationmanager_native_process_string(const char* str) {

    JNIEnv *env = jnienv();
    jclass cls = rho_find_class(env, "com/locationmanager/Locationmanager");
    if (!cls) return rho_ruby_get_NIL();;
    jmethodID mid = env->GetStaticMethodID( cls, "processString", "(Ljava/lang/String;)Ljava/lang/String;");
    if (!mid) return rho_ruby_get_NIL();;
    jstring objStr = env->NewStringUTF(str);
    jstring jstr = (jstring)env->CallStaticObjectMethod(cls, mid, objStr);
    env->DeleteLocalRef(objStr);
    const char* buf = env->GetStringUTFChars(jstr,0);
    VALUE result = rho_ruby_create_string(buf);
    env->ReleaseStringUTFChars(jstr, buf);
    return result;
}
Exemplo n.º 12
0
int rho_simimpl_get_property(char* szPropName, VALUE* resValue)
{
	if (strcasecmp("os_version",szPropName) == 0)
	{
        *resValue = rho_ruby_create_string( RHOSIMCONF().getString("os_version").c_str());
		return 1;
	}

	if (strcasecmp("is_emulator",szPropName) == 0)
    {
        *resValue = rho_ruby_create_boolean(1);
        return 1;
    }

    return 0;
}
Exemplo n.º 13
0
extern "C" VALUE rawsensors_native_process_string(const char* str) {
    
    const char block[] = "<WM>";
    char* buf = NULL;
    buf = (char*)malloc(strlen(str) + strlen(block)*2 + 1);

    strcpy(buf, block);
    strcat(buf, str);
    strcat(buf, block);

    VALUE result = rho_ruby_create_string(buf);

    free(buf);

    return result;
}
Exemplo n.º 14
0
RHO_GLOBAL int rho_sysimpl_get_property(char* szPropName, VALUE* resValue)
{
    JNIEnv *env = jnienv();

    jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
    if (!cls) return 0;
    jmethodID mid = getJNIClassStaticMethod(env, cls, "getProperty", "(Ljava/lang/String;)Ljava/lang/Object;");
    if (!mid) return 0;

    jhstring propNameObj = rho_cast<jhstring>(szPropName);
    jhobject result = jhobject(env->CallStaticObjectMethod(cls, mid, propNameObj.get()));
    if (!result) return 0;

    jclass clsBoolean = getJNIClass(RHODES_JAVA_CLASS_BOOLEAN);
    jclass clsInteger = getJNIClass(RHODES_JAVA_CLASS_INTEGER);
    jclass clsFloat = getJNIClass(RHODES_JAVA_CLASS_FLOAT);
    jclass clsDouble = getJNIClass(RHODES_JAVA_CLASS_DOUBLE);
    jclass clsString = getJNIClass(RHODES_JAVA_CLASS_STRING);

    if (env->IsInstanceOf(result.get(), clsBoolean)) {
        jmethodID midValue = getJNIClassMethod(env, clsBoolean, "booleanValue", "()Z");
        *resValue = rho_ruby_create_boolean((int)env->CallBooleanMethod(result.get(), midValue));
        return 1;
    }
    else if (env->IsInstanceOf(result.get(), clsInteger)) {
        jmethodID midValue = getJNIClassMethod(env, clsInteger, "intValue", "()I");
        *resValue = rho_ruby_create_integer((int)env->CallIntMethod(result.get(), midValue));
        return 1;
    }
    else if (env->IsInstanceOf(result.get(), clsFloat)) {
        jmethodID midValue = getJNIClassMethod(env, clsFloat, "floatValue", "()F");
        *resValue = rho_ruby_create_double((double)env->CallFloatMethod(result.get(), midValue));
        return 1;
    }
    else if (env->IsInstanceOf(result.get(), clsDouble)) {
        jmethodID midValue = getJNIClassMethod(env, clsDouble, "doubleValue", "()D");
        *resValue = rho_ruby_create_double((double)env->CallDoubleMethod(result.get(), midValue));
        return 1;
    }
    else if (env->IsInstanceOf(result.get(), clsString)) {
        jstring resStrObj = (jstring)result.get();
        *resValue = rho_ruby_create_string(rho_cast<std::string>(resStrObj).c_str());
        return 1;
    }

    return 0;
}
Exemplo n.º 15
0
unsigned long CAsyncHttp::CAsyncHttpResponse::getObjectValue()
{
    if (m_NetResponse.isSuccess())
    {
        if ( m_strContentType.find("application/json") != String::npos )
        {
            char* szError = 0;
            unsigned long valBody = rjson_tokener_parse(m_NetResponse.getCharData(), &szError);
            if ( valBody != 0 )
                return valBody;

            LOG(ERROR) + "Incorrect json body.Error:" + (szError ? szError : "");
            if ( szError )
                free(szError);
        }
    }

    return rho_ruby_create_string(m_NetResponse.getCharData());
}
Exemplo n.º 16
0
VALUE rho_cast_helper<VALUE, jobject>::operator()(JNIEnv *env, jobject obj)
{
    if (!rho_cast_java_ruby_init(env))
    {
        env->ThrowNew(getJNIClass(RHODES_JAVA_CLASS_RUNTIME_EXCEPTION), "Java <=> Ruby conversion initialization failed");
        return Qnil;
    }

    if (!obj)
        return Qnil;

    if (env->IsInstanceOf(obj, clsString))
        return rho_ruby_create_string(rho_cast<std::string>(env, (jstring)obj).c_str());

    if (env->IsInstanceOf(obj, clsMap))
        return convertJavaMapToRubyHash(env, obj);

    RAWLOG_ERROR("rho_cast<VALUE, jobject>: unknown type of value");
    return Qnil;
}
Exemplo n.º 17
0
VALUE rho_conf_read_log(int limit)
{
    VALUE res = rho_ruby_create_string("");
    bool bOldSaveToFile = LOGCONF().isLogToFile();
    LOGCONF().setLogToFile(false);

    rho::common::CRhoFile oFile;
    if ( oFile.open( LOGCONF().getLogFilePath().c_str(), rho::common::CRhoFile::OpenReadOnly) )
    {
        int nFileSize = oFile.size();
        int nPos = LOGCONF().getLogTextPos();
        int nMaxSize = nFileSize > nPos ? nFileSize : nPos;
        if ( limit <= 0 || limit > nMaxSize)
            limit = nMaxSize;

        res = rho_ruby_create_string_withlen(limit);
        char* szStr = getStringFromValue(res);

        if ( limit <= nPos )
        {
            oFile.setPosTo(nPos-limit);
            oFile.readData(szStr,0,limit);
        }else
        {
            oFile.setPosTo(nFileSize-(limit-nPos));
            int nRead = oFile.readData(szStr,0,limit);

            oFile.setPosTo(0);
            oFile.readData(szStr,nRead,limit-nRead);
        }

    }

    LOGCONF().setLogToFile(bOldSaveToFile);

    return res;
}
Exemplo n.º 18
0
VALUE rho_bluetooth_session_read_string(const char* connected_device_name) {
	return rho_ruby_create_string(RhoBluetoothManager::getInstance()->rho_bluetooth_session_read_string(connected_device_name));
}
Exemplo n.º 19
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();
}
Exemplo n.º 20
0
void RhoRubyStart()
{
    const char* szRoot = rho_native_rhopath();
    //VALUE moduleRhom;
#ifdef HAVE_LOCALE_H
    setlocale(LC_CTYPE, "");
#endif
    {
#ifdef ENABLE_RUBY_VM_STAT
        g_collect_stat = 1;
#endif

        RUBY_INIT_STACK;
        ruby_init();
#if defined(WIN32)
        rb_w32_sysinit(NULL,NULL);
#endif

#if defined(DEBUG)
        //enable_gc_profile();
#endif
        //rb_funcall(rb_mGC, rb_intern("stress="), 1, Qtrue);

        ruby_init_loadpath(szRoot);
#if defined(RHODES_EMULATOR) || defined(APP_BUILD_CAPABILITY_MOTOROLA) || defined(OS_WP8)
        {
            VALUE load_path = GET_VM()->load_path;
            char* app_path = malloc(strlen(szRoot)+100);

            rb_ary_clear(load_path);

            strcpy(app_path, szRoot);
#if defined(RHODES_EMULATOR)
            strcat(app_path, "app");
#elif defined(OS_WP8)
            strcat(app_path, "/apps/app");
#else
            strcat(app_path, "apps/app");
#endif
            rb_ary_push(load_path, rb_str_new2(app_path) );

#if defined(APP_BUILD_CAPABILITY_MOTOROLA)
            strcpy(app_path, rho_native_reruntimepath());
            strcat(app_path, "lib");
#elif defined(OS_WP8)
            strcpy(app_path, szRoot);
            strcat(app_path, "/lib");
#else
            strcpy(app_path, rho_simconf_getRhodesPath());
            strcat(app_path, "/lib/framework");
#endif
            rb_ary_push(load_path, rb_str_new2(app_path) );
        }

#endif

//DO not use it! Keeps for backward compatibility with ruby extensions. Use Rho::System.isRhoSimulator
#ifdef RHODES_EMULATOR
        rb_const_set(rb_cObject, rb_intern("RHODES_EMULATOR"), Qtrue);
#endif

#if !defined(OS_WP8)

        Init_strscan(); //+
        Init_GeoLocation(); //+

        Init_Phonebook();
#if !defined(OS_MACOSX) && !defined( OS_WINDOWS_DESKTOP ) && !defined(OS_WINCE) && !defined(OS_ANDROID)
        Init_WebView(); //+
#endif

#if !defined(RHO_NO_RUBY)
        Init_RhoConf(); //+
#endif

//#if !defined(OS_WINDOWS_DESKTOP) || defined(RHODES_EMULATOR)
//    Init_Alert();
//#endif

#if defined(WINDOWS_PLATFORM) && !defined(RHODES_EMULATOR) && !defined(RHODES_QT_PLATFORM)
        init_rhoext_Signature();
#else
        //Init_SignatureCapture();
#endif
        Init_RhoBluetooth();
        Init_RhodesNativeViewManager();
#if !defined(OS_MACOSX)
        Init_Camera();
#endif
        Init_stringio(); //+
        Init_DateTimePicker();
//#if !defined(WINDOWS_PLATFORM) && !defined(RHODES_EMULATOR) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
//    Init_NativeBar();
//#endif
        Init_RhoSupport(); //+
        Init_MapView();
        Init_RingtoneManager();
        Init_socket(); //+
//#if !defined(WINDOWS_PLATFORM) && !defined(RHODES_EMULATOR) && !defined(OS_MACOSX)
//    Init_NavBar();
//#endif
        Init_RhoEvent();
        Init_Calendar();
//#if !defined(OS_WINDOWS_DESKTOP) && !defined(RHODES_EMULATOR) && ! defined(OS_WINCE)
//    Init_Alert();
//#endif

#if defined(OS_MACOSX)
#ifndef RHO_DISABLE_OLD_CAMERA_SIGNATURE_API
        Init_Camera();
        Init_SignatureCapture();
#endif
#endif

#if defined(OS_ANDROID)
#ifndef RHO_DISABLE_OLD_CAMERA_SIGNATURE_API
        Init_SignatureCapture();
#endif
#endif

//TODO: RhoSimulator  - load extensions dll dynamically
#if !defined(RHO_SYMBIAN)
        Init_Extensions();
#endif //RHO_SYMBIAN

#else // OS_WP8 is set
        Init_strscan();
        Init_GeoLocation();
        Init_NavBar();
        Init_RhoSupport();
        Init_RhoConf();
        Init_Alert();

        Init_socket();
        Init_stringio();

        Init_Extensions();
#endif //OS_WP8

        extensions_loaded = 1;

        if ( rho_rcclient_have_rhoconnect_client() ) {
            rb_const_set(rb_cObject, rb_intern("RHOCONNECT_CLIENT_PRESENT"), Qtrue);
        }

        if (rho_is_remote_debug())
        {
            rb_const_set(rb_cObject, rb_intern("RHOSTUDIO_REMOTE_DEBUG"), Qtrue);
            rb_const_set(rb_cObject, rb_intern("RHOSTUDIO_REMOTE_HOST"), rho_ruby_create_string(rho_get_remote_debug_host()));
            rb_const_set(rb_cObject, rb_intern("RHOSTUDIO_REMOTE_APPPATH"), rho_ruby_create_string(rho_native_rhopath()));
        }
        else
        {
            rb_const_set(rb_cObject, rb_intern("RHOSTUDIO_REMOTE_DEBUG"), Qfalse);
        }

#if defined(APP_BUILD_CAPABILITY_MOTOROLA)
        rb_require("rhomotoapi");
#endif //APP_BUILD_CAPABILITY_MOTOROLA

#ifdef ENABLE_RUBY_VM_STAT
        struct timeval  start;
        struct timeval  end;

        gettimeofday (&start, NULL);
#endif

#ifdef RHODES_EMULATOR
        require_compiled(rb_str_new2("rhoframework"), &framework );
        framework = rb_const_get(rb_cObject,rb_intern("RHO_FRAMEWORK"));
#else
        {
            VALUE res = rho_ruby_disable_gc();

            require_compiled(rb_str_new2("rhoframework"), &framework );
            rho_ruby_enable_gc(res);
        }
#endif //RHODES_EMULATOR

        if ( framework == 0 || framework == Qnil )
        {
            RAWLOG_FATAL("RHO framework creating failed. Application will exit.");
        }

#ifdef ENABLE_RUBY_VM_STAT
        gettimeofday (&end, NULL);

        if ( end.tv_sec > 0 )
            g_require_compiled_msec += (end.tv_sec  - start.tv_sec) * 1000;
        else
            g_require_compiled_msec += (end.tv_usec - start.tv_usec)/1000;

#endif

        rb_gc_register_mark_object(framework);

        CONST_ID(framework_mid, "serve");
        CONST_ID(framework_mid2, "serve_index");
        CONST_ID(initApp_mid, "init_app");
        CONST_ID(onConfigConflicts_mid, "on_config_conflicts");
        CONST_ID(activateApp_mid, "activate_app");
        CONST_ID(deactivateApp_mid, "deactivate_app");
        CONST_ID(uiCreated_mid, "ui_created");
        CONST_ID(uiDestroyed_mid, "ui_destroyed");
        CONST_ID(loadServerSources_mid,"load_server_sources");
        CONST_ID(loadAllSyncSources_mid,"load_all_sync_sources");
        CONST_ID(resetDBOnSyncUserChanged_mid, "reset_db_on_sync_user_changed");

        //moduleRhom = rb_const_get(rb_cObject, rb_intern("Rhom"));

#ifdef ENABLE_RUBY_VM_STAT
        g_collect_stat = 0;
#endif

    }
}
Exemplo n.º 21
0
VALUE rho_bluetooth_get_device_name()
{
    return rho_ruby_create_string("ERROR");
}
Exemplo n.º 22
0
VALUE rho_conf_get_property_by_name(char* name)
{
	char* szValue = rho_conf_getString(name);

    return rho_ruby_create_string(szValue);
}
Exemplo n.º 23
0
VALUE rho_bluetooth_session_read_string(const char* connected_device_name) {
	return  rho_ruby_create_string("ERROR");
}