snapshot: comms_invite() call gets to jni

This commit is contained in:
Eric House 2022-08-27 17:08:54 -07:00
parent 5bc2a38439
commit 16857ab74a
6 changed files with 49 additions and 11 deletions

View file

@ -2745,7 +2745,8 @@ public class BoardDelegate extends DelegateBase
WiDirService.inviteRemote( m_activity, dev, nli );
break;
case MQTT:
MQTTUtils.inviteRemote( m_activity, dev, nli );
// MQTTUtils.inviteRemote( m_activity, dev, nli );
MQTTUtils.inviteRemote( m_jniGamePtr, dev, nli );
break;
default:
Assert.failDbg();
@ -3127,8 +3128,8 @@ public class BoardDelegate extends DelegateBase
}
value = m_summary.getStringExtra( GameSummary.EXTRA_REMATCH_MQTT );
if ( null != value ) {
MQTTUtils.inviteRemote( m_activity, value, nli );
recordInviteSent( InviteMeans.MQTT, value );
MQTTUtils.inviteRemote( m_jniGamePtr, value, nli );
// recordInviteSent( InviteMeans.MQTT, value );
}
showToast( R.string.rematch_sent_toast );
@ -3159,8 +3160,8 @@ public class BoardDelegate extends DelegateBase
for ( CommsConnType typ : conTypes ) {
switch ( typ ) {
case COMMS_CONN_MQTT:
MQTTUtils.inviteRemote( m_activity, addr.mqtt_devID, nli );
recordInviteSent( InviteMeans.MQTT, addr.mqtt_devID );
MQTTUtils.inviteRemote( m_jniGamePtr, addr.mqtt_devID, nli );
// recordInviteSent( InviteMeans.MQTT, addr.mqtt_devID );
break;
case COMMS_CONN_BT:
BTUtils.inviteRemote( m_activity, addr.bt_btAddr, nli );

View file

@ -45,6 +45,7 @@ import org.json.JSONObject;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec.ConnExpl;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.XwJNI.GamePtr;
import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.loc.LocUtils;
@ -532,12 +533,19 @@ public class MQTTUtils extends Thread
clearInstance( this );
}
public static void inviteRemote( Context context, String invitee,
NetLaunchInfo nli )
// public static void inviteRemote( Context context, String invitee,
// NetLaunchInfo nli )
// {
// String[] topic = {invitee};
// byte[] packet = XwJNI.dvc_makeMQTTInvite( nli, topic );
// addToSendQueue( context, topic[0], packet );
// }
public static void inviteRemote( GamePtr game, String devID, NetLaunchInfo nli )
{
String[] topic = {invitee};
byte[] packet = XwJNI.dvc_makeMQTTInvite( nli, topic );
addToSendQueue( context, topic[0], packet );
CommsAddrRec destAddr = new CommsAddrRec(CommsConnType.COMMS_CONN_MQTT)
.setMQTTParams( devID );
XwJNI.comms_invite( game, nli, destAddr );
}
private static void notifyNotHere( Context context, String addressee,

View file

@ -521,6 +521,8 @@ public class XwJNI {
public static native String comms_getStats( GamePtr gamePtr );
public static native void comms_addMQTTDevID( GamePtr gamePtr, int channelNo,
String devID );
public static native void comms_invite( GamePtr gamePtr, NetLaunchInfo nli,
CommsAddrRec destAddr );
// Used/defined (in C) for DEBUG only
public static native void comms_setAddrDisabled( GamePtr gamePtr, CommsConnType typ,

View file

@ -42,6 +42,7 @@ LOCAL_DEFINES += \
-DCOMMON_LAYOUT \
-DXWFEATURE_WIDER_COLS \
-DNATIVE_NLI \
-DXWFEATURE_COMMS_INVITE \
-DINITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS} \
-DXW_BT_UUID=\"${XW_BT_UUID}\" \
-DVARIANT_${VARIANT} \

View file

@ -48,6 +48,22 @@ and_xport_getFlags( XWEnv xwe, void* closure )
return result;
}
#ifdef XWFEATURE_COMMS_INVITE
static XP_S16
and_xport_sendInvite( XWEnv xwe, const NetLaunchInfo* nli,
XP_U32 createdStamp,
const CommsAddrRec* addr, void* closure )
{
XP_USE( xwe );
XP_USE( nli );
XP_USE( createdStamp );
XP_USE( addr );
XP_USE( closure );
XP_ASSERT(0);
return -1;
}
#endif
static XP_S16
and_xport_send( XWEnv xwe, const XP_U8* buf, XP_U16 len,
const XP_UCHAR* msgNo, XP_U32 timestamp,
@ -195,7 +211,10 @@ makeXportProcs( MPFORMAL JNIEnv* env,
#ifdef COMMS_XPORT_FLAGSPROC
aprocs->tp.getFlags = and_xport_getFlags;
#endif
aprocs->tp.send = and_xport_send;
aprocs->tp.sendMsg = and_xport_send;
#ifdef XWFEATURE_COMMS_INVITE
aprocs->tp.sendInvt = and_xport_sendInvite;
#endif
#ifdef XWFEATURE_RELAY
aprocs->tp.rstatus = and_xport_relayStatus;
aprocs->tp.rconnd = and_xport_relayConnd;

View file

@ -2621,6 +2621,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1addMQTTDevID
XWJNI_END();
}
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1invite
( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jnli, jobject jaddr )
{
LOG_FUNC();
}
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1dropHostAddr
( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jConnTyp )