mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
pass relayStatus an enum rather than an int
This commit is contained in:
parent
285e1b47d5
commit
e73c6d1234
3 changed files with 16 additions and 11 deletions
|
@ -85,10 +85,14 @@ and_xport_relayStatus( void* closure, CommsRelayState newState )
|
|||
AndTransportProcs* aprocs = (AndTransportProcs*)closure;
|
||||
if ( NULL != aprocs->jxport ) {
|
||||
JNIEnv* env = *aprocs->envp;
|
||||
const char* sig = "(I)V";
|
||||
const char* sig = "(Lorg/eehouse/android/xw4/jni/"
|
||||
"TransportProcs$CommsRelayState;)V";
|
||||
jmethodID mid = getMethodID( env, aprocs->jxport, "relayStatus", sig );
|
||||
|
||||
(*env)->CallVoidMethod( env, aprocs->jxport, mid, newState );
|
||||
jobject jenum = intToJEnum( env, newState, "org/eehouse/android/xw4/jni/"
|
||||
"TransportProcs$CommsRelayState" );
|
||||
(*env)->CallVoidMethod( env, aprocs->jxport, mid, jenum );
|
||||
(*env)->DeleteLocalRef( env, jenum );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -291,9 +291,9 @@ public class CommsTransport extends Thread implements TransportProcs {
|
|||
return nSent;
|
||||
}
|
||||
|
||||
public void relayStatus( int newState )
|
||||
public void relayStatus( CommsRelayState newState )
|
||||
{
|
||||
Utils.logf( "relayStatus called; state=" + newState );
|
||||
Utils.logf( "relayStatus called; state=%s", newState.toString() );
|
||||
}
|
||||
|
||||
public void relayConnd( boolean allHere, int nMissing )
|
||||
|
|
|
@ -6,13 +6,14 @@ package org.eehouse.android.xw4.jni;
|
|||
public interface TransportProcs {
|
||||
int transportSend( byte[] buf, final CommsAddrRec addr );
|
||||
|
||||
public static final int COMMS_RELAYSTATE_UNCONNECTED = 0;
|
||||
public static final int COMMS_RELAYSTATE_DENIED = 1;
|
||||
public static final int COMMS_RELAYSTATE_CONNECT_PENDING = 2;
|
||||
public static final int COMMS_RELAYSTATE_CONNECTED = 3;
|
||||
public static final int COMMS_RELAYSTATE_RECONNECTED = 4;
|
||||
public static final int COMMS_RELAYSTATE_ALLCONNECTED = 5;
|
||||
void relayStatus( int newState );
|
||||
enum CommsRelayState { COMMS_RELAYSTATE_UNCONNECTED
|
||||
, COMMS_RELAYSTATE_DENIED
|
||||
, COMMS_RELAYSTATE_CONNECT_PENDING
|
||||
, COMMS_RELAYSTATE_CONNECTED
|
||||
, COMMS_RELAYSTATE_RECONNECTED
|
||||
, COMMS_RELAYSTATE_ALLCONNECTED
|
||||
};
|
||||
void relayStatus( CommsRelayState newState );
|
||||
|
||||
void relayConnd( boolean allHere, int nMissing );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue