diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index f0b6028fa..d93bb05f5 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -1,6 +1,6 @@ /* -*- compile-command: "cd ../../../../../; ant debug install"; -*- */ /* - * Copyright 2009-2011 by Eric House (xwords@eehouse.org). All + * Copyright 2009 - 2012 by Eric House (xwords@eehouse.org). All * rights reserved. * * This program is free software; you can redistribute it and/or @@ -1080,7 +1080,7 @@ public class BoardActivity extends XWActivity public void playerScoreHeld( int player ) { String expl = XwJNI.model_getPlayersLastScore( m_jniGamePtr, - player ); + player ); if ( expl.length() == 0 ) { expl = getString( R.string.no_moves_made ); } @@ -1379,9 +1379,7 @@ public class BoardActivity extends XWActivity m_jniGamePtr = XwJNI.initJNI(); - boolean standalone = - m_gi.serverRole == DeviceRole.SERVER_STANDALONE; - if ( !standalone ) { + if ( m_gi.serverRole != DeviceRole.SERVER_STANDALONE ) { m_xport = new CommsTransport( m_jniGamePtr, this, this, m_gi.serverRole ); } @@ -1463,9 +1461,9 @@ public class BoardActivity extends XWActivity DBUtils.setMsgFlags( m_rowid, GameSummary.MSG_FLAGS_NONE ); } - if ( !standalone ) { + if ( null != m_xport ) { trySendChats(); - m_jniThread.handle( JNIThread.JNICmd.CMD_RESEND ); + m_xport.tickle(); } } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java index 08ed82f21..ab62e362f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java @@ -1,6 +1,6 @@ /* -*- compile-command: "cd ../../../../../; ant debug install"; -*- */ /* - * Copyright 2009-2010 by Eric House (xwords@eehouse.org). All + * Copyright 2009 - 2012 by Eric House (xwords@eehouse.org). All * rights reserved. * * This program is free software; you can redistribute it and/or @@ -221,6 +221,25 @@ public class CommsTransport implements TransportProcs, } } + public void tickle() + { + CommsAddrRec addr = new CommsAddrRec( m_context ); + XwJNI.comms_getAddr( m_jniGamePtr, addr ); + switch( addr.conType ) { + case COMMS_CONN_RELAY: + // do nothing + break; + case COMMS_CONN_BT: + // Let other know I'm here + m_jniThread.handle( JNIThread.JNICmd.CMD_RESEND ); + break; + default: + DbgUtils.logf( "tickle: unexpected type %s", + addr.conType.toString() ); + Assert.fail(); + } + } + private synchronized void putOut( final byte[] buf ) { int len = buf.length;