get uuid from C code so can ensure linux version has same.

This commit is contained in:
Eric House 2012-01-19 18:28:27 -08:00
parent 1f8be87acb
commit 5f77ef6e13
4 changed files with 22 additions and 7 deletions

View file

@ -1,4 +1,4 @@
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh"; -*- */
/* -*-mode: C; compile-command: "../../scripts/ndkbuild.sh -j3"; -*- */
/*
* Copyright © 2009 - 2011 by Eric House (xwords@eehouse.org). All rights
* reserved.
@ -270,6 +270,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getInitialAddr
setJAddrRec( env, jaddr, &addr );
}
JNIEXPORT jstring JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getUUID
( JNIEnv* env, jclass C )
{
const char* uuid = XW_BT_UUID;
XP_LOGF( "uuid: %s", uuid );
jstring jstr = (*env)->NewStringUTF( env, uuid );
(*env)->DeleteLocalRef( env, jstr );
return jstr;
}
JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_dict_1getInfo
( JNIEnv* env, jclass C, jbyteArray jDictBytes, jstring jpath,

View file

@ -23,8 +23,12 @@ package org.eehouse.android.xw4;
import android.app.Application;
import java.util.UUID;
import org.eehouse.android.xw4.jni.XwJNI;
public class XWApp extends Application {
private static UUID s_UUID = null;
@Override
public void onCreate()
{
@ -41,7 +45,10 @@ public class XWApp extends Application {
}
public static UUID getAppUUID() {
return UUID.fromString( "d0837107-421f-11e1-b86c-0800200c9a66" );
if ( null == s_UUID ) {
s_UUID = UUID.fromString( XwJNI.comms_getUUID() );
}
return s_UUID;
}
public static String getAppName() {

View file

@ -50,6 +50,7 @@ public class XwJNI {
public static native void comms_getInitialAddr( CommsAddrRec addr,
String relayHost,
int relayPort );
public static native String comms_getUUID();
// Game methods
public static native int initJNI();

View file

@ -55,11 +55,7 @@ typedef enum {
, COMMS_RELAYSTATE_ALLCONNECTED
} CommsRelayState;
/* WHAT SHOULD THIS BE? Copied from Whiteboard.... PENDING */
#define XW_BT_UUID \
{ 0x83, 0xe0, 0x87, 0xae, 0x4e, 0x18, 0x46, 0xbe, \
0x83, 0xe0, 0x7b, 0x3d, 0xe6, 0xa1, 0xc3, 0x3b }
#define XW_BT_UUID "7be0d084-ff89-4d6d-9c78-594773a6f963"
#define XW_BT_NAME "Crosswords"