mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
cleanup
Add new method with default values, etc: no change in behavior
This commit is contained in:
parent
5f0c3bf4bd
commit
134bcbdfa4
4 changed files with 22 additions and 25 deletions
|
@ -404,8 +404,7 @@ public class BTService extends XWService {
|
||||||
: MultiEvent.BT_DISABLED;
|
: MultiEvent.BT_DISABLED;
|
||||||
postEvent( evt );
|
postEvent( evt );
|
||||||
if ( cameOn ) {
|
if ( cameOn ) {
|
||||||
GameUtils.resendAllIf( this, CommsConnType.COMMS_CONN_BT,
|
GameUtils.resendAllIf( this, CommsConnType.COMMS_CONN_BT );
|
||||||
false, false );
|
|
||||||
} else {
|
} else {
|
||||||
ConnStatusHandler.updateStatus( this, null,
|
ConnStatusHandler.updateStatus( this, null,
|
||||||
CommsConnType.COMMS_CONN_BT,
|
CommsConnType.COMMS_CONN_BT,
|
||||||
|
|
|
@ -438,6 +438,11 @@ public class GameUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
// force applies only to relay
|
// force applies only to relay
|
||||||
|
public static void resendAllIf( Context context, CommsConnType filter )
|
||||||
|
{
|
||||||
|
resendAllIf( context, filter, false, false );
|
||||||
|
}
|
||||||
|
|
||||||
public static void resendAllIf( Context context, CommsConnType filter,
|
public static void resendAllIf( Context context, CommsConnType filter,
|
||||||
boolean force, boolean showUI )
|
boolean force, boolean showUI )
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,7 +252,7 @@ public class NetStateCache {
|
||||||
if ( s_netAvail ) {
|
if ( s_netAvail ) {
|
||||||
CommsConnType typ = CommsConnType
|
CommsConnType typ = CommsConnType
|
||||||
.COMMS_CONN_RELAY;
|
.COMMS_CONN_RELAY;
|
||||||
GameUtils.resendAllIf( context, typ, false, false );
|
GameUtils.resendAllIf( context, typ );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*- compile-command: "find-and-gradle.sh insXw4Deb"; -*- */
|
/* -*- compile-command: "find-and-gradle.sh insXw4Deb"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2016 by Eric House (xwords@eehouse.org). All
|
* Copyright 2016 - 2018 by Eric House (xwords@eehouse.org). All rights
|
||||||
* rights reserved.
|
* reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License as
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
@ -105,7 +105,7 @@ public class WiDirService extends XWService {
|
||||||
private static GroupInfoListener sGroupListener;
|
private static GroupInfoListener sGroupListener;
|
||||||
private static WFDBroadcastReceiver sReceiver;
|
private static WFDBroadcastReceiver sReceiver;
|
||||||
// private static boolean sDiscoveryStarted;
|
// private static boolean sDiscoveryStarted;
|
||||||
private static boolean sDiscoveryRunning; // set via broadcast
|
private static boolean sDiscoveryRunning; // set via broadcast; unused
|
||||||
private static boolean sEnabled;
|
private static boolean sEnabled;
|
||||||
private static boolean sHavePermission;
|
private static boolean sHavePermission;
|
||||||
// These two kinda overlap...
|
// These two kinda overlap...
|
||||||
|
@ -647,9 +647,8 @@ public class WiDirService extends XWService {
|
||||||
WifiP2pDevice srcDevice) {
|
WifiP2pDevice srcDevice) {
|
||||||
// Service has been discovered. My app?
|
// Service has been discovered. My app?
|
||||||
if ( instanceName.equalsIgnoreCase( SERVICE_NAME ) ) {
|
if ( instanceName.equalsIgnoreCase( SERVICE_NAME ) ) {
|
||||||
Log.d( TAG, "onBonjourServiceAvailable "
|
Log.d( TAG, "onDnsSdServiceAvailable: %s with name %s",
|
||||||
+ instanceName + " with name "
|
instanceName, srcDevice.deviceName );
|
||||||
+ srcDevice.deviceName );
|
|
||||||
tryConnect( srcDevice );
|
tryConnect( srcDevice );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -737,8 +736,7 @@ public class WiDirService extends XWService {
|
||||||
macAddress );
|
macAddress );
|
||||||
|
|
||||||
GameUtils.resendAllIf( XWApp.getContext(),
|
GameUtils.resendAllIf( XWApp.getContext(),
|
||||||
CommsConnType.COMMS_CONN_P2P,
|
CommsConnType.COMMS_CONN_P2P );
|
||||||
false, false );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,14 +1076,16 @@ public class WiDirService extends XWService {
|
||||||
private WifiP2pManager mManager;
|
private WifiP2pManager mManager;
|
||||||
private Channel mChannel;
|
private Channel mChannel;
|
||||||
|
|
||||||
public WFDBroadcastReceiver( WifiP2pManager manager, Channel channel ) {
|
public WFDBroadcastReceiver( WifiP2pManager manager, Channel channel )
|
||||||
|
{
|
||||||
super();
|
super();
|
||||||
mManager = manager;
|
mManager = manager;
|
||||||
mChannel = channel;
|
mChannel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive( Context context, Intent intent ) {
|
public void onReceive( Context context, Intent intent )
|
||||||
|
{
|
||||||
if ( enabled() ) {
|
if ( enabled() ) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
Log.d( TAG, "got intent: " + intent.toString() );
|
Log.d( TAG, "got intent: " + intent.toString() );
|
||||||
|
@ -1141,8 +1141,8 @@ public class WiDirService extends XWService {
|
||||||
|
|
||||||
// WifiP2pManager.ConnectionInfoListener interface
|
// WifiP2pManager.ConnectionInfoListener interface
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionInfoAvailable( final WifiP2pInfo info ) {
|
public void onConnectionInfoAvailable( final WifiP2pInfo info )
|
||||||
|
{
|
||||||
// InetAddress from WifiP2pInfo struct.
|
// InetAddress from WifiP2pInfo struct.
|
||||||
InetAddress groupOwnerAddress = info.groupOwnerAddress;
|
InetAddress groupOwnerAddress = info.groupOwnerAddress;
|
||||||
String hostAddress = groupOwnerAddress.getHostAddress();
|
String hostAddress = groupOwnerAddress.getHostAddress();
|
||||||
|
@ -1166,12 +1166,13 @@ public class WiDirService extends XWService {
|
||||||
}
|
}
|
||||||
getMgr().requestGroupInfo( sChannel, sGroupListener );
|
getMgr().requestGroupInfo( sChannel, sGroupListener );
|
||||||
} else {
|
} else {
|
||||||
Assert.fail();
|
Assert.assertFalse( BuildConfig.DEBUG );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPeersAvailable( WifiP2pDeviceList peerList ) {
|
public void onPeersAvailable( WifiP2pDeviceList peerList )
|
||||||
|
{
|
||||||
Log.d( TAG, "got list of %d peers",
|
Log.d( TAG, "got list of %d peers",
|
||||||
peerList.getDeviceList().size() );
|
peerList.getDeviceList().size() );
|
||||||
|
|
||||||
|
@ -1197,14 +1198,6 @@ public class WiDirService extends XWService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class P2pMsgSink extends MultiMsgSink {
|
private class P2pMsgSink extends MultiMsgSink {
|
||||||
|
|
||||||
public P2pMsgSink() { super( WiDirService.this ); }
|
public P2pMsgSink() { super( WiDirService.this ); }
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public int sendViaP2P( byte[] buf, int gameID, CommsAddrRec addr )
|
|
||||||
// {
|
|
||||||
// return WiDirService
|
|
||||||
// .sendPacket( m_context, addr.p2p_addr, gameID, buf );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue