mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
Rewrite BT proto to batch messages
Lots of changes. Old BT proto is no longer compatible. New one batches messages per device and sends all on a single connection. The queue (now a single buffer) is now a static global and the thread that services it doesn't die (but gloms onto whatever Service instance is most recent.) Code to pack and unpack the protocol can probably be reused for wifi-direct or any other pass-through transport.
This commit is contained in:
parent
e13d90409c
commit
5cb2be33d2
4 changed files with 724 additions and 552 deletions
File diff suppressed because it is too large
Load diff
|
@ -430,7 +430,7 @@ public class CommsTransport implements TransportProcs,
|
|||
gameID, buf );
|
||||
break;
|
||||
case COMMS_CONN_BT:
|
||||
nSent = BTService.enqueueFor( context, buf, addr, gameID );
|
||||
nSent = BTService.sendPacket( context, buf, addr, gameID );
|
||||
break;
|
||||
case COMMS_CONN_P2P:
|
||||
nSent = WiDirService
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MultiMsgSink implements TransportProcs {
|
|||
|
||||
public int sendViaBluetooth( byte[] buf, int gameID, CommsAddrRec addr )
|
||||
{
|
||||
return BTService.enqueueFor( m_context, buf, addr, gameID );
|
||||
return BTService.sendPacket( m_context, buf, addr, gameID );
|
||||
}
|
||||
|
||||
public int sendViaSMS( byte[] buf, int gameID, CommsAddrRec addr )
|
||||
|
|
|
@ -609,7 +609,9 @@ public class NetLaunchInfo implements Serializable {
|
|||
|
||||
public boolean isValid()
|
||||
{
|
||||
// DbgUtils.logf( "NetLaunchInfo(%s).isValid() => %b", toString(), m_valid );
|
||||
calcValid(); // this isn't always called. Likely should
|
||||
// remove it as it's a stupid optimization
|
||||
// Log.d( TAG, "NetLaunchInfo(%s).isValid() => %b", this, m_valid );
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue