pass additional param into java world so don't show toast every time connect to relay

This commit is contained in:
Eric House 2013-07-07 13:31:49 -07:00
parent 923d41e0ee
commit e9615cb154
5 changed files with 22 additions and 16 deletions

View file

@ -112,12 +112,12 @@ and_xport_relayConnd( void* closure, XP_UCHAR* const room, XP_Bool reconnect,
AndTransportProcs* aprocs = (AndTransportProcs*)closure; AndTransportProcs* aprocs = (AndTransportProcs*)closure;
if ( NULL != aprocs->jxport ) { if ( NULL != aprocs->jxport ) {
JNIEnv* env = *aprocs->envp; JNIEnv* env = *aprocs->envp;
const char* sig = "(Ljava/lang/String;IZI)V"; const char* sig = "(Ljava/lang/String;ZIZI)V";
jmethodID mid = getMethodID( env, aprocs->jxport, "relayConnd", sig ); jmethodID mid = getMethodID( env, aprocs->jxport, "relayConnd", sig );
jstring str = (*env)->NewStringUTF( env, room ); jstring str = (*env)->NewStringUTF( env, room );
(*env)->CallVoidMethod( env, aprocs->jxport, mid, (*env)->CallVoidMethod( env, aprocs->jxport, mid,
str, devOrder, allHere, nMissing ); str, reconnect, devOrder, allHere, nMissing );
deleteLocalRef( env, str ); deleteLocalRef( env, str );
} }
} }

View file

@ -1030,15 +1030,18 @@ public class BoardActivity extends XWActivity
// TransportProcs.TPMsgHandler interface // TransportProcs.TPMsgHandler interface
////////////////////////////////////////////////// //////////////////////////////////////////////////
public void tpmRelayConnd( final String room, final int devOrder, public void tpmRelayConnd( final String room, boolean isReconnect,
final boolean allHere, final int nMissing ) final int devOrder, final boolean allHere,
final int nMissing )
{ {
if ( !isReconnect ) {
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
handleConndMessage( room, devOrder, allHere, nMissing ); handleConndMessage( room, devOrder, allHere, nMissing );
} }
} ); } );
} }
}
public void tpmRelayErrorProc( TransportProcs.XWRELAY_ERROR relayErr ) public void tpmRelayErrorProc( TransportProcs.XWRELAY_ERROR relayErr )
{ {

View file

@ -435,10 +435,11 @@ public class CommsTransport implements TransportProcs,
} }
} }
public void relayConnd( String room, int devOrder, boolean allHere, public void relayConnd( String room, boolean isReconnect, int devOrder,
int nMissing ) boolean allHere, int nMissing )
{ {
m_tpHandler.tpmRelayConnd( room, devOrder, allHere, nMissing ); m_tpHandler.tpmRelayConnd( room, isReconnect, devOrder, allHere,
nMissing );
} }
public void relayErrorProc( XWRELAY_ERROR relayErr ) public void relayErrorProc( XWRELAY_ERROR relayErr )

View file

@ -48,8 +48,8 @@ public class MultiMsgSink implements TransportProcs {
{ {
} }
public void relayConnd( String room, int devOrder, boolean allHere, public void relayConnd( String room, boolean isReconnect, int devOrder,
int nMissing ) boolean allHere, int nMissing )
{ {
} }

View file

@ -37,7 +37,8 @@ public interface TransportProcs {
}; };
void relayStatus( CommsRelayState newState ); void relayStatus( CommsRelayState newState );
void relayConnd( String room, int devOrder, boolean allHere, int nMissing ); void relayConnd( String room, boolean isReconnect, int devOrder,
boolean allHere, int nMissing );
public static enum XWRELAY_ERROR { NONE public static enum XWRELAY_ERROR { NONE
,OLDFLAGS ,OLDFLAGS
@ -61,7 +62,8 @@ public interface TransportProcs {
boolean relayNoConnProc( byte[] buf, String relayID ); boolean relayNoConnProc( byte[] buf, String relayID );
public interface TPMsgHandler { public interface TPMsgHandler {
public void tpmRelayConnd( String room, int devOrder, boolean allHere, public void tpmRelayConnd( String room, boolean isReconnect,
int devOrder, boolean allHere,
int nMissing ); int nMissing );
public void tpmRelayErrorProc( XWRELAY_ERROR relayErr ); public void tpmRelayErrorProc( XWRELAY_ERROR relayErr );
} }