mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
more removing relay
This commit is contained in:
parent
63b0d7c2fb
commit
06583daf7d
4 changed files with 32 additions and 14 deletions
|
@ -2980,6 +2980,7 @@ public class BoardDelegate extends DelegateBase
|
|||
phone = addr.sms_phone;
|
||||
}
|
||||
if ( addr.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
|
||||
Assert.failDbg();
|
||||
Assert.assertNull( relayID );
|
||||
relayID = XwJNI.comms_formatRelayID( jniGamePtr, ii );
|
||||
}
|
||||
|
|
|
@ -2623,6 +2623,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
String btAddr = extras.getString( REMATCH_BTADDR_EXTRA );
|
||||
String phone = extras.getString( REMATCH_PHONE_EXTRA );
|
||||
String relayID = extras.getString( REMATCH_RELAYID_EXTRA );
|
||||
Assert.assertTrueNR( null == relayID );
|
||||
String p2pMacAddress = extras.getString( REMATCH_P2PADDR_EXTRA );
|
||||
String dict = extras.getString( REMATCH_DICT_EXTRA );
|
||||
int lang = extras.getInt( REMATCH_LANG_EXTRA, -1 );
|
||||
|
@ -3153,6 +3154,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
intent.putExtra( REMATCH_PHONE_EXTRA, phone );
|
||||
}
|
||||
if ( null != relayID ) {
|
||||
Assert.failDbg();
|
||||
Assert.assertTrue( addrTypes.contains( CommsConnType.COMMS_CONN_RELAY ) );
|
||||
intent.putExtra( REMATCH_RELAYID_EXTRA, relayID );
|
||||
}
|
||||
|
|
|
@ -83,6 +83,20 @@ and_xport_send( XWEnv xwe, const XP_U8* buf, XP_U16 len,
|
|||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
and_xport_countChanged( XWEnv xwe, void* closure, XP_U16 count )
|
||||
{
|
||||
AndTransportProcs* aprocs = (AndTransportProcs*)closure;
|
||||
ASSERT_ENV( aprocs->ti, xwe );
|
||||
if ( NULL != aprocs && NULL != aprocs->jxport ) {
|
||||
JNIEnv* env = xwe;
|
||||
const char* sig = "(I)V";
|
||||
jmethodID mid = getMethodID( env, aprocs->jxport, "countChanged", sig );
|
||||
(*env)->CallVoidMethod( env, aprocs->jxport, mid, count );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef XWFEATURE_RELAY
|
||||
static void
|
||||
and_xport_relayStatus( XWEnv XP_UNUSED(xwe), void* XP_UNUSED(closure),
|
||||
CommsRelayState XP_UNUSED(newState) )
|
||||
|
@ -136,19 +150,6 @@ and_xport_sendNoConn( XWEnv xwe, const XP_U8* buf, XP_U16 len,
|
|||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
and_xport_countChanged( XWEnv xwe, void* closure, XP_U16 count )
|
||||
{
|
||||
AndTransportProcs* aprocs = (AndTransportProcs*)closure;
|
||||
ASSERT_ENV( aprocs->ti, xwe );
|
||||
if ( NULL != aprocs && NULL != aprocs->jxport ) {
|
||||
JNIEnv* env = xwe;
|
||||
const char* sig = "(I)V";
|
||||
jmethodID mid = getMethodID( env, aprocs->jxport, "countChanged", sig );
|
||||
(*env)->CallVoidMethod( env, aprocs->jxport, mid, count );
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
and_xport_relayError( XWEnv xwe, void* closure, XWREASON relayErr )
|
||||
{
|
||||
|
@ -169,6 +170,7 @@ and_xport_relayError( XWEnv xwe, void* closure, XWREASON relayErr )
|
|||
deleteLocalRef( env, jenum );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TransportProcs*
|
||||
makeXportProcs( MPFORMAL JNIEnv* env,
|
||||
|
@ -192,10 +194,12 @@ makeXportProcs( MPFORMAL JNIEnv* env,
|
|||
aprocs->tp.getFlags = and_xport_getFlags;
|
||||
#endif
|
||||
aprocs->tp.send = and_xport_send;
|
||||
#ifdef XWFEATURE_RELAY
|
||||
aprocs->tp.rstatus = and_xport_relayStatus;
|
||||
aprocs->tp.rconnd = and_xport_relayConnd;
|
||||
aprocs->tp.rerror = and_xport_relayError;
|
||||
aprocs->tp.sendNoConn = and_xport_sendNoConn;
|
||||
#endif
|
||||
aprocs->tp.countChanged = and_xport_countChanged;
|
||||
aprocs->tp.closure = aprocs;
|
||||
|
||||
|
|
|
@ -967,10 +967,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getInitialAddr
|
|||
( JNIEnv* env, jclass C, jstring jname, jint port )
|
||||
{
|
||||
CommsAddrRec addr;
|
||||
|
||||
#ifdef XWFEATURE_RELAY
|
||||
const char* chars = (*env)->GetStringUTFChars( env, jname, NULL );
|
||||
comms_getInitialAddr( &addr, chars, port );
|
||||
(*env)->ReleaseStringUTFChars( env, jname, chars );
|
||||
#else
|
||||
comms_getInitialAddr( &addr );
|
||||
#endif
|
||||
jobject jaddr = makeObjectEmptyConst( env, PKG_PATH("jni/CommsAddrRec") );
|
||||
setJAddrRec( env, jaddr, &addr );
|
||||
return jaddr;
|
||||
|
@ -2248,6 +2251,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
|
|||
for ( XP_U32 st = 0; addr_iter( &addr, &typ, &st ); ) {
|
||||
switch( typ ) {
|
||||
case COMMS_CONN_RELAY: {
|
||||
#ifdef XWFEATURE_RELAY
|
||||
XP_UCHAR buf[128];
|
||||
XP_U16 len = VSIZE(buf);
|
||||
if ( comms_getRelayID( comms, buf, &len ) ) {
|
||||
|
@ -2255,6 +2259,9 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
|
|||
setString( env, jsummary, "relayID", buf );
|
||||
}
|
||||
setString( env, jsummary, "roomName", addr.u.ip_relay.invite );
|
||||
#else
|
||||
XP_ASSERT(0);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case COMMS_CONN_NFC:
|
||||
|
@ -2565,6 +2572,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1formatRelayID
|
|||
( JNIEnv* env, jclass C, GamePtrType gamePtr, jint indx )
|
||||
{
|
||||
jstring result = NULL;
|
||||
#ifdef XWFEATURE_RELAY
|
||||
XWJNI_START();
|
||||
|
||||
XP_UCHAR buf[64];
|
||||
|
@ -2576,6 +2584,9 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1formatRelayID
|
|||
}
|
||||
|
||||
XWJNI_END();
|
||||
#else
|
||||
XP_ASSERT(0);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue