Exemple #1
0
        // JVM load the .so and calls this native function
        static jlong Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface(
            ref JNIEnv env,
            jclass clazz,
            jobject activity,

            jstring fromPackageNameString, jstring commandString, jstring uriString
            )
        {
            log.__android_log_print(log.android_LogPriority.ANDROID_LOG_INFO, "xNativeActivity", "enter Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface");

            //jni/HybridOculusVrActivity.dll.c: In function 'Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface':
            //jni/HybridOculusVrActivity.dll.c:64:5: error: format not a string literal and no format arguments [-Werror=format-security]

            //android_native_app_glue.app_dummy();
            //var x = OvrApp.cxxGetString();

            //android_native_app_glue.app_dummy();
            //log.__android_log_print(log.android_LogPriority.ANDROID_LOG_INFO, "xNativeActivity", x);

            //      return (new OvrApp())->SetActivity( jni, clazz, activity );


            //I/System.Console(13696): enter  HybridOculusVrActivity.OVRJVM ApplicationActivity onCreate
            //I/xNativeActivity(13696): enter Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_stringFromJNI
            //I/xNativeActivity(13696): enter Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface

            // http://stackoverflow.com/questions/7281441/elegantly-call-c-from-c

            //long u = 0;

            return(OvrApp.cxxSetAppInterface(
                       ref env,
                       clazz,
                       activity,


                       // added by oculus050
                       fromPackageNameString, commandString, uriString
                       ));
        }
        // defined at
        // X:\opensource\ovr_mobile_sdk_0.6.0.1\VrSamples\Native\Oculus360PhotosSDK\jni\Oculus360Photos.cpp
        // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150721/ovroculus360photoshud
        //public static object AtStartBackgroundPanoLoad;


        public static long Java_com_oculus_oculus360photossdk_MainActivity_nativeSetAppInterface(JNIEnv env,
            jclass clazz,
            jobject activity,

            jstring fromPackageNameString,
            jstring commandString,
            jstring uriString,

            object arg_AtStartBackgroundPanoLoad
         ) { return 0; }
        // JVM load the .so and calls this native function
        static long Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface(
             JNIEnv env,
            jclass clazz,


            // ApplicationActivity : com.oculus.vrappframework.VrActivity
            jobject activity,

            jstring fromPackageNameString,
            jstring commandString,
            jstring uriString
            )
        {
            // can we do typeof() yet and have our env from there?

            // Error	3	No overload for method '__android_log_print' takes 3 arguments	X:\jsc.svn\examples\java\android\synergy\OVROculus360PhotosNDK\OVROculus360PhotosNDK\xNativeActivity.cs	39	13	OVROculus360PhotosNDK

            // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150721/ovroculus360photoshud
            ScriptCoreLibAndroidNDK.Library.ConsoleExtensions.trace("enter Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface");


            //Oculus360Photos_h.AtStartBackgroundPanoLoad = new object();
            xNativeAtStartBackgroundPanoLoad = xNativeAtStartBackgroundPanoLoadInvoke;

            //xNativeAtStartBackgroundPanoLoad("not yet loaded", null);


            var loctype = env.GetObjectClass(env, activity);
            var gtype = (jclass)env.NewGlobalRef(env, loctype);
            //var gtype = (jclass)env.NewGlobalRef<jclass>(env, loctype);

            var typeof_this = new __Type { arg0_env = env, arg1_type = gtype };

            //var setDefaultLocale = typeof_this.GetMethodID("setDefaultLocale", "()V");
            var setDefaultLocale = typeof_this.GetMethod("setDefaultLocale", "()V");

            //var setDefaultLocale = env.GetMethodID(env, loctype, "setDefaultLocale", "()V");

            //Type.GetMethod();



            ConsoleExtensions.tracei64("setDefaultLocale: ", (int)(object)setDefaultLocale);


            //            I/xNativeActivity(24350): [3194400] \xNativeActivity.cs:202 enter Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface
            //I/xNativeActivity(24350): [3194400] \xNativeActivity.cs:222 setDefaultLocale:  -2012160456

            //  public virtual void setDefaultLocale()
            //env.NewStringUTF(env, "en");


            //  error: undefined reference to '__new_jvalue'
            // env.CallVoidMethodA(env, activity, setDefaultLocale, args: default(jvalue[]));

            setDefaultLocale.Invoke(activity);

            return Oculus360Photos_h.Java_com_oculus_oculus360photossdk_MainActivity_nativeSetAppInterface(
                 env,
                //clazz,
                gtype,
                activity,
                fromPackageNameString,
                commandString,
                uriString,


                arg_AtStartBackgroundPanoLoad: xNativeAtStartBackgroundPanoLoad
            );
        }
Exemple #4
0
 //jlong cxxSetAppInterface(JNIEnv* jni, jclass clazz, jobject activity);
 public static jlong cxxSetAppInterface(ref JNIEnv jni, jclass c, jobject activity,
                                        jstring fromPackageNameString, jstring commandString, jstring uriString)
 {
     return((jlong)(object)0);
 }
        // JVM load the .so and calls this native function
        static jlong Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface(
            ref JNIEnv env,
            jclass clazz,
            jobject activity,

            jstring fromPackageNameString, jstring commandString, jstring uriString
            )
        {
            log.__android_log_print(log.android_LogPriority.ANDROID_LOG_INFO, "xNativeActivity", "enter Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface");

            //jni/HybridOculusVrActivity.dll.c: In function 'Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface':
            //jni/HybridOculusVrActivity.dll.c:64:5: error: format not a string literal and no format arguments [-Werror=format-security]

            //android_native_app_glue.app_dummy();
            //var x = OvrApp.cxxGetString();

            //android_native_app_glue.app_dummy();
            //log.__android_log_print(log.android_LogPriority.ANDROID_LOG_INFO, "xNativeActivity", x);

            //      return (new OvrApp())->SetActivity( jni, clazz, activity );


            //I/System.Console(13696): enter  HybridOculusVrActivity.OVRJVM ApplicationActivity onCreate
            //I/xNativeActivity(13696): enter Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_stringFromJNI
            //I/xNativeActivity(13696): enter Java_HybridOculusVrActivity_OVRJVM_ApplicationActivity_nativeSetAppInterface

            // http://stackoverflow.com/questions/7281441/elegantly-call-c-from-c

            //long u = 0;

            return OvrApp.cxxSetAppInterface(
                ref env,
                clazz,
                activity,


                // added by oculus050
                fromPackageNameString, commandString, uriString
           );
        }
 //jlong cxxSetAppInterface(JNIEnv* jni, jclass clazz, jobject activity);
 public static jlong cxxSetAppInterface(ref JNIEnv jni, jclass c, jobject activity,
     jstring fromPackageNameString, jstring commandString, jstring uriString)
 { return (jlong)(object)0; }
        // defined at
        // X:\opensource\ovr_mobile_sdk_0.6.0.1\VrSamples\Native\Oculus360PhotosSDK\jni\Oculus360Photos.cpp
        // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150721/ovroculus360photoshud
        //public static object AtStartBackgroundPanoLoad;


        public static long Java_com_oculus_oculus360photossdk_MainActivity_nativeSetAppInterface(JNIEnv env,
                                                                                                 jclass clazz,
                                                                                                 jobject activity,

                                                                                                 jstring fromPackageNameString,
                                                                                                 jstring commandString,
                                                                                                 jstring uriString,

                                                                                                 object arg_AtStartBackgroundPanoLoad
                                                                                                 )
        {
            return(0);
        }
        // JVM load the .so and calls this native function
        static long Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface(
            JNIEnv env,
            jclass clazz,


            // ApplicationActivity : com.oculus.vrappframework.VrActivity
            jobject activity,

            jstring fromPackageNameString,
            jstring commandString,
            jstring uriString
            )
        {
            // can we do typeof() yet and have our env from there?

            // Error	3	No overload for method '__android_log_print' takes 3 arguments	X:\jsc.svn\examples\java\android\synergy\OVROculus360PhotosNDK\OVROculus360PhotosNDK\xNativeActivity.cs	39	13	OVROculus360PhotosNDK

            // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150721/ovroculus360photoshud
            ScriptCoreLibAndroidNDK.Library.ConsoleExtensions.trace("enter Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface");


            //Oculus360Photos_h.AtStartBackgroundPanoLoad = new object();
            xNativeAtStartBackgroundPanoLoad = xNativeAtStartBackgroundPanoLoadInvoke;

            //xNativeAtStartBackgroundPanoLoad("not yet loaded", null);


            var loctype = env.GetObjectClass(env, activity);
            var gtype   = (jclass)env.NewGlobalRef(env, loctype);
            //var gtype = (jclass)env.NewGlobalRef<jclass>(env, loctype);

            var typeof_this = new __Type {
                arg0_env = env, arg1_type = gtype
            };

            //var setDefaultLocale = typeof_this.GetMethodID("setDefaultLocale", "()V");
            var setDefaultLocale = typeof_this.GetMethod("setDefaultLocale", "()V");

            //var setDefaultLocale = env.GetMethodID(env, loctype, "setDefaultLocale", "()V");

            //Type.GetMethod();



            ConsoleExtensions.tracei64("setDefaultLocale: ", (int)(object)setDefaultLocale);


            //            I/xNativeActivity(24350): [3194400] \xNativeActivity.cs:202 enter Java_OVROculus360Photos_Activities_xMarshal_nativeSetAppInterface
            //I/xNativeActivity(24350): [3194400] \xNativeActivity.cs:222 setDefaultLocale:  -2012160456

            //  public virtual void setDefaultLocale()
            //env.NewStringUTF(env, "en");


            //  error: undefined reference to '__new_jvalue'
            // env.CallVoidMethodA(env, activity, setDefaultLocale, args: default(jvalue[]));

            setDefaultLocale.Invoke(activity);

            return(Oculus360Photos_h.Java_com_oculus_oculus360photossdk_MainActivity_nativeSetAppInterface(
                       env,
                       //clazz,
                       gtype,
                       activity,
                       fromPackageNameString,
                       commandString,
                       uriString,


                       arg_AtStartBackgroundPanoLoad: xNativeAtStartBackgroundPanoLoad
                       ));
        }