Rewrite BT comms to not use a Service

It's simpler this way, and I'm tired of stuff not happening because the
OS chooses not to schedule e.g. an invitation send for minutes. Goal's
to be running BluetoothServerSocket.accept() as much as possible when
there are active BT games in play OR when the game's in the foreground.
If that's happening, sent invitations and moves will be received when
users expect. When there's no traffic and app isn't being brought to
foreground, backoff will ensure I don't try to run accept() too often.

FWIW, BTLE seems to offer a better way to do this (to have an app be
responsive to incoming invitations when it hasn't run in the foreground
in a while), but it requires users to accept FINE_LOCATION
permission. I'm hoping I can make this work to avoid asking for that
permission.
This commit is contained in:
Eric House 2020-10-21 21:10:09 -07:00
parent 8240f753ca
commit af37fb45f7
26 changed files with 1003 additions and 1260 deletions

View file

@ -143,7 +143,7 @@
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver android:name="RelayTimerReceiver"/>
<receiver android:name="TimerReceiver"/>
<receiver android:name="NagTurnReceiver"/>
<receiver android:name="SMSResendReceiver"/>
<receiver android:name="DupeModeTimer"/>
@ -181,10 +181,6 @@
<activity android:name=".loc.LocItemEditActivity"
/>
<service android:name="BTService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"
/>
<service android:name="RelayService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"
@ -201,15 +197,6 @@
</intent-filter>
</receiver>
<receiver android:name="BTReceiver">
<intent-filter>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
</intent-filter>
<intent-filter>
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
</intent-filter>
</receiver>
<service android:name="FBMService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />

View file

@ -48,7 +48,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class BTInviteDelegate extends InviteDelegate {
public class BTInviteDelegate extends InviteDelegate
implements BTUtils.ScanListener {
private static final String TAG = BTInviteDelegate.class.getSimpleName();
private static final String KEY_PERSIST = TAG + "_persist";
private static final int[] BUTTONIDS = { R.id.button_scan,
@ -177,6 +179,20 @@ public class BTInviteDelegate extends InviteDelegate {
}
}
@Override
protected void onResume()
{
BTUtils.addScanListener( this );
super.onResume();
}
@Override
protected void onPause()
{
BTUtils.removeScanListener( this );
super.onResume();
}
@Override
protected void onBarButtonClicked( int id )
{
@ -185,7 +201,7 @@ public class BTInviteDelegate extends InviteDelegate {
scan();
break;
case R.id.button_settings:
BTService.openBTSettings( m_activity );
BTUtils.openBTSettings( m_activity );
break;
case R.id.button_clear:
int count = getChecked().size();
@ -197,37 +213,6 @@ public class BTInviteDelegate extends InviteDelegate {
}
}
// MultiService.MultiEventListener interface
@Override
public void eventOccurred( MultiService.MultiEvent event, final Object ... args )
{
switch( event ) {
case SCAN_DONE:
post( new Runnable() {
public void run() {
hideProgress();
if ( sPersistedRef[0].empty() || 0 == mNDevsThisScan ) {
makeNotAgainBuilder( R.string.not_again_emptybtscan,
R.string.key_notagain_emptybtscan )
.show();
}
}
} );
break;
case HOST_PONGED:
post( new Runnable() {
@Override
public void run() {
processScanResult( (BluetoothDevice)args[0] );
}
} );
break;
default:
super.eventOccurred( event, args );
}
}
@Override
protected void onChildAdded( View child, InviterItem data )
{
@ -256,18 +241,45 @@ public class BTInviteDelegate extends InviteDelegate {
}
}
// interface ScanListener
@Override
public void onDeviceScanned( final BluetoothDevice dev )
{
post( new Runnable() {
@Override
public void run() {
processScanResult( dev );
}
} );
}
@Override
public void onScanDone()
{
post( new Runnable() {
@Override
public void run() {
hideProgress();
if ( sPersistedRef[0].empty() || 0 == mNDevsThisScan ) {
makeNotAgainBuilder( R.string.not_again_emptybtscan,
R.string.key_notagain_emptybtscan )
.show();
}
}
} );
}
private void scan()
{
if ( ENABLE_FAKER && Utils.nextRandomInt() % 5 == 0 ) {
sPersistedRef[0].add( "00:00:00:00:00:00", "Do Not Invite Me" );
}
Set<BluetoothDevice> devs = BTService.getCandidates();
int count = devs.size();
int count = BTUtils.scan( m_activity, 1000 * SCAN_SECONDS );
if ( 0 < count ) {
mNDevsThisScan = 0;
showProgress( count, 2 * SCAN_SECONDS );
BTService.scan( m_activity, 1000 * SCAN_SECONDS );
} else {
makeConfirmThenBuilder( R.string.bt_no_devs,
Action.OPEN_BT_PREFS_ACTION )
@ -329,9 +341,9 @@ public class BTInviteDelegate extends InviteDelegate {
private static void removeNotPaired( Persisted prs )
{
Log.d( TAG, "removeNotPaired()" );
BluetoothAdapter adapter = BTService.getAdapterIf();
BluetoothAdapter adapter = BTUtils.getAdapterIf();
if ( null != adapter ) {
Set<BluetoothDevice> pairedDevs = BTService.getCandidates();
Set<BluetoothDevice> pairedDevs = BTUtils.getCandidates();
Set<String> paired = new HashSet<>();
for ( BluetoothDevice dev : pairedDevs ) {
Log.d( TAG, "removeNotPaired(): paired dev: %s", dev.getName() );
@ -404,7 +416,7 @@ public class BTInviteDelegate extends InviteDelegate {
boolean handled = true;
switch( action ) {
case OPEN_BT_PREFS_ACTION:
BTService.openBTSettings( m_activity );
BTUtils.openBTSettings( m_activity );
break;
case CLEAR_ACTION:
sPersistedRef[0].remove( getChecked() );
@ -420,8 +432,9 @@ public class BTInviteDelegate extends InviteDelegate {
return handled;
}
public static void onHeardFromDev( Context context, BluetoothDevice dev )
public static void onHeardFromDev( BluetoothDevice dev )
{
Context context = XWApp.getContext();
load( context );
sPersistedRef[0].add( dev.getAddress(), dev.getName() );
store( context );

View file

@ -1,59 +0,0 @@
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright 2012 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BTReceiver extends BroadcastReceiver {
private static final String TAG = BTReceiver.class.getSimpleName();
@Override
public void onReceive( Context context, Intent intent )
{
String action = intent.getAction();
Log.d( TAG, "BTReceiver.onReceive(action=%s, intent=%s)",
action, intent.toString() );
switch (action ) {
case BluetoothDevice.ACTION_ACL_CONNECTED:
BTService.onACLConnected( context );
break;
case BluetoothAdapter.ACTION_STATE_CHANGED:
int newState =
intent.getIntExtra( BluetoothAdapter.EXTRA_STATE, -1 );
switch ( newState ) {
case BluetoothAdapter.STATE_OFF:
BTService.radioChanged( context, false );
break;
case BluetoothAdapter.STATE_ON:
BTService.radioChanged( context, true );
break;
case BluetoothAdapter.STATE_TURNING_ON:
case BluetoothAdapter.STATE_TURNING_OFF:
break;
}
}
}
}

View file

@ -2597,8 +2597,7 @@ public class BoardDelegate extends DelegateBase
CommsAddrRec[] addrs = XwJNI.comms_getAddrs( m_jniGamePtr );
for ( CommsAddrRec addr : addrs ) {
if ( addr.contains( CommsConnType.COMMS_CONN_BT ) ) {
BTService.pingHost( m_activity, addr.bt_btAddr,
m_gi.gameID );
BTUtils.pingHost( m_activity, addr.bt_btAddr, m_gi.gameID );
}
}
}
@ -2810,7 +2809,7 @@ public class BoardDelegate extends DelegateBase
case BLUETOOTH:
if ( ! m_progressShown ) {
m_progressShown = true;
String progMsg = BTService.nameForAddr( dev );
String progMsg = BTUtils.nameForAddr( dev );
progMsg = getString( R.string.invite_progress_fmt, progMsg );
startProgress( R.string.invite_progress_title, progMsg,
new OnCancelListener() {
@ -2820,7 +2819,7 @@ public class BoardDelegate extends DelegateBase
}
});
}
BTService.inviteRemote( m_activity, dev, nli );
BTUtils.inviteRemote( m_activity, dev, nli );
break;
case SMS_DATA:
sendNBSInviteIf( dev, nli, true );
@ -3186,7 +3185,7 @@ public class BoardDelegate extends DelegateBase
}
value = m_summary.getStringExtra( GameSummary.EXTRA_REMATCH_BTADDR );
if ( null != value ) {
BTService.inviteRemote( m_activity, value, nli );
BTUtils.inviteRemote( m_activity, value, nli );
recordInviteSent( InviteMeans.BLUETOOTH, value );
}
value = m_summary.getStringExtra( GameSummary.EXTRA_REMATCH_RELAY );
@ -3237,7 +3236,7 @@ public class BoardDelegate extends DelegateBase
recordInviteSent( InviteMeans.MQTT, addr.mqtt_devID );
break;
case COMMS_CONN_BT:
BTService.inviteRemote( m_activity, addr.bt_btAddr, nli );
BTUtils.inviteRemote( m_activity, addr.bt_btAddr, nli );
recordInviteSent( InviteMeans.BLUETOOTH, addr.bt_btAddr );
break;
// case COMMS_CONN_RELAY:

View file

@ -437,7 +437,7 @@ public class CommsTransport implements TransportProcs,
gameID, buf, msgID );
break;
case COMMS_CONN_BT:
nSent = BTService.sendPacket( context, buf, msgID, addr, gameID );
nSent = BTUtils.sendPacket( context, buf, msgID, addr, gameID );
break;
case COMMS_CONN_P2P:
nSent = WiDirService

View file

@ -674,7 +674,7 @@ public class ConnStatusHandler {
&& !getAirplaneModeOn( context );
break;
case COMMS_CONN_BT:
result = BTService.BTEnabled();
result = BTUtils.BTEnabled();
// No: we can be in airplane mode but with BT turned on manually.
//!getAirplaneModeOn( context );
break;

View file

@ -123,7 +123,7 @@ public class ConnViaViewLayout extends LinearLayout {
enabled = XWPrefs.getNBSEnabled( context );
break;
case COMMS_CONN_BT:
enabled = BTService.BTEnabled();
enabled = BTUtils.BTEnabled();
break;
case COMMS_CONN_RELAY:
enabled = XWPrefs.getRelayEnabled( context );

View file

@ -595,7 +595,7 @@ public class DBUtils {
msg = LocUtils.getString( context, fmt, target, timestamp );
break;
case BLUETOOTH:
String devName = BTService.nameForAddr( target );
String devName = BTUtils.nameForAddr( target );
msg = LocUtils.getString( context, R.string.invit_expl_bt_fmt,
devName, timestamp );
break;

View file

@ -149,7 +149,7 @@ public abstract class DelegateBase implements DlgClickNotify,
m_isVisible = true;
XWServiceHelper.setListener( this );
runIfVisible();
BTService.setAmForeground();
BTUtils.setAmForeground();
}
protected void onPause()
@ -775,7 +775,7 @@ public abstract class DelegateBase implements DlgClickNotify,
XWPrefs.setNBSEnabled( m_activity, true );
break;
case ENABLE_BT_DO:
BTService.enable();
BTUtils.enable();
break;
case ENABLE_RELAY_DO:
RelayService.setEnabled( m_activity, true );

View file

@ -1311,7 +1311,7 @@ public class GameUtils {
// see below
break;
case COMMS_CONN_BT:
BTService.gameDied( context, addr.bt_btAddr, gameID );
BTUtils.gameDied( context, addr.bt_btAddr, gameID );
break;
case COMMS_CONN_SMS:
NBSProto.gameDied( context, gameID, addr.sms_phone );

View file

@ -93,7 +93,7 @@ public class InviteChoicesAlert extends DlgDelegateAlert
if ( Utils.deviceSupportsNBS(context) ) {
means.add( InviteMeans.SMS_DATA );
}
if ( BTService.BTAvailable() ) {
if ( BTUtils.BTAvailable() ) {
means.add( InviteMeans.BLUETOOTH );
}
if ( WiDirWrapper.enabled() ) {

View file

@ -214,7 +214,8 @@ abstract class InviteDelegate extends DelegateBase
updateChecked( items );
m_lv.removeAllViews();
for ( InviterItem item : items ) {
InviterItem[] itemsArr = items.toArray( new InviterItem[items.size()] );
for ( InviterItem item : itemsArr ) {
m_lv.addView( makeViewFor( itemId, item ) );
}
}

View file

@ -500,7 +500,7 @@ public class MQTTUtils extends Thread implements IMqttActionListener, MqttCallba
ConnStatusHandler
.updateStatusIn( mContext, CommsConnType.COMMS_CONN_MQTT, true );
RelayTimerReceiver.restartBackoff( mContext, TAG );
TimerReceiver.restartBackoff( mContext );
}
@Override
@ -509,7 +509,7 @@ public class MQTTUtils extends Thread implements IMqttActionListener, MqttCallba
Log.d( TAG, "%H.deliveryComplete(token=%s)", this, token );
ConnStatusHandler
.updateStatusOut( mContext, CommsConnType.COMMS_CONN_MQTT, true );
RelayTimerReceiver.restartBackoff( mContext, TAG );
TimerReceiver.restartBackoff( mContext );
}
private void subscribe()

View file

@ -54,8 +54,6 @@ public class MultiMsgSink implements TransportProcs {
public long getRowID() { return m_rowid; };
public MultiMsgSink setRowID( long rowID ) { m_rowid = rowID; return this; };
// These will be overridden by e.g. BTService which for sendViaBluetooth()
// can just insert a message into its queue
int sendViaRelay( byte[] buf, String msgID, int gameID )
{
Assert.assertTrue( BuildConfig.UDP_ENABLED );
@ -65,7 +63,7 @@ public class MultiMsgSink implements TransportProcs {
int sendViaBluetooth( byte[] buf, String msgID, int gameID,
CommsAddrRec addr )
{
return BTService.sendPacket( m_context, buf, msgID, addr, gameID );
return BTUtils.sendPacket( m_context, buf, msgID, addr, gameID );
}
int sendViaSMS( byte[] buf, String msgID, int gameID, CommsAddrRec addr )

View file

@ -74,8 +74,6 @@ public class MultiService {
APP_NOT_FOUND_BT,
BT_ENABLED,
BT_DISABLED,
SCAN_DONE,
HOST_PONGED,
NEWGAME_SUCCESS,
NEWGAME_FAILURE,
NEWGAME_DUP_REJECTED,

View file

@ -451,7 +451,7 @@ public class NetLaunchInfo implements Serializable {
if ( addrs.contains( CommsConnType.COMMS_CONN_BT ) ) {
obj.put( MultiService.BT_NAME, btName );
if ( ! BTService.isBogusAddr( btAddress ) ) {
if ( ! BTUtils.isBogusAddr( btAddress ) ) {
obj.put( MultiService.BT_ADDRESS, btAddress );
}
}
@ -657,7 +657,7 @@ public class NetLaunchInfo implements Serializable {
public void addBTInfo()
{
String[] got = BTService.getBTNameAndAddress();
String[] got = BTUtils.getBTNameAndAddress();
if ( null != got ) {
btName = got[0];
btAddress = got[1];

View file

@ -45,7 +45,7 @@ public class OnBootReceiver extends BroadcastReceiver {
protected static void startTimers( Context context )
{
NagTurnReceiver.restartTimer( context );
RelayTimerReceiver.setTimer( context, true );
TimerReceiver.setTimer( context, true );
SMSResendReceiver.setTimer( context );
}
}

View file

@ -981,7 +981,7 @@ public class RelayService extends XWJIService
private void gotPacket( DatagramPacket packet )
{
ConnStatusHandler.showSuccessIn();
RelayTimerReceiver.restartBackoff( this, TAG );
TimerReceiver.restartBackoff( this );
int packetLen = packet.getLength();
byte[] data = new byte[packetLen];
@ -1698,7 +1698,7 @@ public class RelayService extends XWJIService
*
* Goal: maintain connection by keeping this service alive with
* its periodic pings to relay. When it dies or is killed,
* notice, and use RelayTimerReceiver's timer to get it restarted a bit
* notice, and use TimerReceiver's timer to get it restarted a bit
* later. But note: s_lastFCM will not be set when the app is
* relaunched.
*/

View file

@ -27,12 +27,12 @@ import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
public class RelayTimerReceiver extends BroadcastReceiver {
private static final String TAG = RelayTimerReceiver.class.getSimpleName();
public class TimerReceiver extends BroadcastReceiver {
private static final String TAG = TimerReceiver.class.getSimpleName();
private static final String KEY_BACKOFF = TAG + "/backoff";
private static final String KEY_NEXT_BACKOFF = TAG + "/next_backoff";
private static final long MIN_BACKOFF = 1000 * 10; // 10 seconds
private static final long MAX_BACKOFF = 1000 * 60 * 60 * 32; // 23 hours
private static final long MAX_BACKOFF = 1000 * 60 * 60 * 23; // 23 hours
@Override
public void onReceive( Context context, Intent intent )
@ -40,6 +40,7 @@ public class RelayTimerReceiver extends BroadcastReceiver {
Log.d( TAG, "onReceive(intent=%s)", intent );
RelayService.timerFired( context );
MQTTUtils.timerFired( context );
BTUtils.timerFired( context );
long nextBackoff = DBUtils.getLongFor( context, KEY_BACKOFF, MIN_BACKOFF );
if ( nextBackoff == MAX_BACKOFF ) {
@ -54,7 +55,7 @@ public class RelayTimerReceiver extends BroadcastReceiver {
setTimer( context, nextBackoff, true );
}
static void restartBackoff( Context context, String tag )
static void restartBackoff( Context context )
{
DBUtils.setLongFor( context, KEY_BACKOFF, MIN_BACKOFF );
setTimer( context, MIN_BACKOFF, false );
@ -68,26 +69,22 @@ public class RelayTimerReceiver extends BroadcastReceiver {
private synchronized static void setTimer( Context context, long backoff, boolean force )
{
if ( XWPrefs.getRelayEnabled( context ) ) {
if ( !force ) {
long curBackoff = DBUtils.getLongFor( context, KEY_NEXT_BACKOFF, MIN_BACKOFF );
force = backoff != curBackoff;
}
if ( force ) {
long now = SystemClock.elapsedRealtime();
long fireMillis = now + backoff;
if ( !force ) {
long curBackoff = DBUtils.getLongFor( context, KEY_NEXT_BACKOFF, MIN_BACKOFF );
force = backoff != curBackoff;
}
if ( force ) {
long now = SystemClock.elapsedRealtime();
long fireMillis = now + backoff;
AlarmManager am =
(AlarmManager)context.getSystemService( Context.ALARM_SERVICE );
AlarmManager am =
(AlarmManager)context.getSystemService( Context.ALARM_SERVICE );
Intent intent = new Intent( context, RelayTimerReceiver.class );
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
am.set( AlarmManager.ELAPSED_REALTIME_WAKEUP, fireMillis, pi );
Log.d( TAG, "setTimer() set for %d seconds from now (%d)", backoff / 1000, now / 1000 );
DBUtils.setLongFor( context, KEY_NEXT_BACKOFF, backoff );
}
} else {
Log.d( TAG, "setTimer(): relay disabled, so dropping" );
Intent intent = new Intent( context, TimerReceiver.class );
PendingIntent pi = PendingIntent.getBroadcast( context, 0, intent, 0 );
am.set( AlarmManager.ELAPSED_REALTIME_WAKEUP, fireMillis, pi );
Log.d( TAG, "setTimer() set for %d seconds from now (%d)", backoff / 1000, now / 1000 );
DBUtils.setLongFor( context, KEY_NEXT_BACKOFF, backoff );
}
}
}

View file

@ -38,7 +38,6 @@ import org.eehouse.android.xw4.jni.XwJNI;
import java.util.UUID;
import static androidx.lifecycle.Lifecycle.Event.ON_ANY;
public class XWApp extends Application
@ -102,6 +101,7 @@ public class XWApp extends Application
DupeModeTimer.init( this );
MQTTUtils.init( this );
BTUtils.init( this, getAppName(), getAppUUID() );
}
@OnLifecycleEvent(ON_ANY)
@ -111,12 +111,16 @@ public class XWApp extends Application
switch( event ) {
case ON_RESUME:
MQTTUtils.onResume( this );
BTUtils.onResume( this );
// Do here what checkForMoves does
if ( null != DBUtils.getRelayIDs( this, null ) ) {
RelayService.timerFired( this );
}
GameUtils.resendAllIf( this, null );
break;
case ON_STOP:
BTUtils.onStop( this );
break;
}
}
@ -168,8 +172,9 @@ public class XWApp extends Application
return s_UUID;
}
public static String getAppName( Context context )
public static String getAppName()
{
Context context = getContext();
return context.getString( R.string.app_name );
}

View file

@ -507,7 +507,7 @@ public class XWPrefs {
if ( getRelayEnabled( context ) ) {
result.addWithCheck( CommsConnType.COMMS_CONN_RELAY );
}
if ( BTService.BTEnabled() ) {
if ( BTUtils.BTEnabled() ) {
result.add( CommsConnType.COMMS_CONN_BT );
}
} else {

View file

@ -24,7 +24,7 @@ import android.content.Context;
import android.text.TextUtils;
import org.eehouse.android.xw4.Assert;
import org.eehouse.android.xw4.BTService;
import org.eehouse.android.xw4.BTUtils;
import org.eehouse.android.xw4.BuildConfig;
import org.eehouse.android.xw4.GameUtils;
import org.eehouse.android.xw4.Log;
@ -154,7 +154,7 @@ public class CommsAddrRec implements java.io.Serializable {
if ( BuildConfig.OFFER_MQTT ) {
supported.add( CommsConnType.COMMS_CONN_MQTT );
}
if ( BTService.BTAvailable() ) {
if ( BTUtils.BTAvailable() ) {
supported.add( CommsConnType.COMMS_CONN_BT );
}
if ( WiDirWrapper.enabled() ) {
@ -338,7 +338,7 @@ public class CommsAddrRec implements java.io.Serializable {
public void setBTParams( String btAddr, String btName )
{
bt_hostName = btName;
if ( ! BTService.isBogusAddr( btAddr ) ) {
if ( ! BTUtils.isBogusAddr( btAddr ) ) {
bt_btAddr = btAddr;
}
}
@ -431,7 +431,7 @@ public class CommsAddrRec implements java.io.Serializable {
setRelayParams( host, port, room );
break;
case COMMS_CONN_BT:
String[] strs = BTService.getBTNameAndAddress();
String[] strs = BTUtils.getBTNameAndAddress();
if ( null != strs ) {
bt_hostName = strs[0];
bt_btAddr = strs[1];

View file

@ -1702,7 +1702,7 @@
</plurals>
<!-- Appended to above -->
<string name="invite_bt_desc_postscript">\n\n(The list is of
paired devices on which CrossWords has been detected via a
paired devices where CrossWords has been detected via a
scan.)</string>
<plurals name="bt_scan_progress_fmt">
<item quantity="one">Scanning for CrossWords</item>

View file

@ -49,6 +49,7 @@ LOCAL_DEFINES += \
-DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \
# -DNO_ADD_MQTT_TO_ALL \
# -DXWFEATURE_SCOREONEPASS \
LOCAL_SRC_FILES += \

View file

@ -1057,6 +1057,12 @@ void
comms_addMQTTDevID( CommsCtxt* comms, XP_PlayerAddr channelNo,
const MQTTDevID* devID )
{
#ifdef NO_ADD_MQTT_TO_ALL /* set for (usually) BT testing on Android */
XP_LOGFF("ifdef'd out");
XP_USE( comms );
XP_USE( channelNo );
XP_USE( devID );
#else
XP_LOGFF( "(devID: " MQTTDevID_FMT ")", *devID );
XP_Bool found = XP_FALSE;
for ( AddressRecord* rec = comms->recs; !!rec && !found; rec = rec->next ) {
@ -1075,6 +1081,7 @@ comms_addMQTTDevID( CommsCtxt* comms, XP_PlayerAddr channelNo,
if ( !found ) {
XP_LOGFF( "unable to augment address!!" );
}
#endif
}
void