From 587f3b7630c8c1e2dc7fbed25aaa6c3931dd1b48 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 11 Jul 2015 14:25:16 -0700 Subject: [PATCH] export comms_formatRelayID via jni. --- xwords4/android/XWords4/jni/xwjni.c | 19 +++++++++++++++++++ .../org/eehouse/android/xw4/jni/XwJNI.java | 1 + 2 files changed, 20 insertions(+) diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index 26445bc1b..af390343d 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -1817,6 +1817,25 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1isConnected return result; } +JNIEXPORT jstring JNICALL +Java_org_eehouse_android_xw4_jni_XwJNI_comms_1formatRelayID +( JNIEnv* env, jclass C, jint gamePtr, jint indx ) +{ + jstring result = NULL; + XWJNI_START_GLOBALS(); + + XP_UCHAR buf[64]; + XP_U16 len = sizeof(buf); + if ( comms_formatRelayID( state->game.comms, indx, buf, &len ) ) { + XP_ASSERT( len < sizeof(buf) ); + LOG_RETURNF( "%s", buf ); + result = (*env)->NewStringUTF( env, buf ); + } + + XWJNI_END(); + return result; +} + JNIEXPORT jstring JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getStats ( JNIEnv* env, jclass C, jint gamePtr ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java index 355d49a91..d415e96fa 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java @@ -338,6 +338,7 @@ public class XwJNI { public static native void comms_transportFailed( int gamePtr, CommsConnType failed ); public static native boolean comms_isConnected( int gamePtr ); + public static native String comms_formatRelayID( int gamePtr, int indx ); public static native String comms_getStats( int gamePtr ); // Dicts