mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-13 08:47:50 +01:00
update status more often (as old code did)
This commit is contained in:
parent
1a6b325722
commit
87a27e7630
1 changed files with 13 additions and 6 deletions
|
@ -626,6 +626,7 @@ public class BTService extends XWJIService {
|
||||||
// hack: will close if nobody ref'd it inside dispatchAll()
|
// hack: will close if nobody ref'd it inside dispatchAll()
|
||||||
closeForRef( makeRefFor( socket ) );
|
closeForRef( makeRefFor( socket ) );
|
||||||
socket = null;
|
socket = null;
|
||||||
|
updateStatusIn( true );
|
||||||
} else {
|
} else {
|
||||||
writeBack( socket, BTCmd.BAD_PROTO );
|
writeBack( socket, BTCmd.BAD_PROTO );
|
||||||
socket.close();
|
socket.close();
|
||||||
|
@ -793,6 +794,7 @@ public class BTService extends XWJIService {
|
||||||
DataOutputStream dos = connect( socket );
|
DataOutputStream dos = connect( socket );
|
||||||
if ( null == dos ) {
|
if ( null == dos ) {
|
||||||
pa.setNoHost();
|
pa.setNoHost();
|
||||||
|
updateStatusOut( false );
|
||||||
} else {
|
} else {
|
||||||
Log.d( TAG, "%s.thread.run(): connect(%s) => %s",
|
Log.d( TAG, "%s.thread.run(): connect(%s) => %s",
|
||||||
className, pa.getName(), dos );
|
className, pa.getName(), dos );
|
||||||
|
@ -915,8 +917,8 @@ public class BTService extends XWJIService {
|
||||||
Log.e( TAG, "sendPing() failure; %s", ioe.getMessage() );
|
Log.e( TAG, "sendPing() failure; %s", ioe.getMessage() );
|
||||||
DbgUtils.printStack( TAG, ioe );
|
DbgUtils.printStack( TAG, ioe );
|
||||||
}
|
}
|
||||||
mService.updateStatusOut( sendWorking );
|
updateStatusOut( sendWorking );
|
||||||
mService.updateStatusIn( receiveWorking );
|
updateStatusIn( receiveWorking );
|
||||||
// Log.d( TAG, "sendPing(%s) => %b", dev.getName(), gotReply );
|
// Log.d( TAG, "sendPing(%s) => %b", dev.getName(), gotReply );
|
||||||
return gotReply;
|
return gotReply;
|
||||||
} // sendPing
|
} // sendPing
|
||||||
|
@ -1055,16 +1057,18 @@ public class BTService extends XWJIService {
|
||||||
DbgUtils.printStack( TAG );
|
DbgUtils.printStack( TAG );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStatusOut( boolean success )
|
private static void updateStatusOut( boolean success )
|
||||||
{
|
{
|
||||||
|
Context context = XWApp.getContext();
|
||||||
ConnStatusHandler
|
ConnStatusHandler
|
||||||
.updateStatusOut( this, null, CommsConnType.COMMS_CONN_BT, success );
|
.updateStatusOut( context, null, CommsConnType.COMMS_CONN_BT, success );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStatusIn( boolean success )
|
private static void updateStatusIn( boolean success )
|
||||||
{
|
{
|
||||||
|
Context context = XWApp.getContext();
|
||||||
ConnStatusHandler
|
ConnStatusHandler
|
||||||
.updateStatusIn( this, null, CommsConnType.COMMS_CONN_BT, success );
|
.updateStatusIn( context, null, CommsConnType.COMMS_CONN_BT, success );
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BTMsgSink extends MultiMsgSink {
|
private class BTMsgSink extends MultiMsgSink {
|
||||||
|
@ -1288,6 +1292,9 @@ public class BTService extends XWJIService {
|
||||||
}
|
}
|
||||||
unappend( nDone );
|
unappend( nDone );
|
||||||
Log.d( TAG, "writeAndCheck() => %d", nDone );
|
Log.d( TAG, "writeAndCheck() => %d", nDone );
|
||||||
|
if ( nDone > 0 ) {
|
||||||
|
updateStatusOut( true );
|
||||||
|
}
|
||||||
return nDone;
|
return nDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue