|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbluegammon.io.BackgammonBTConnection
Implementation of the interface BackgammonConnection
for
bluetooth bearer.
Constructor Summary | |
BackgammonBTConnection()
|
Method Summary | |
void |
close()
Closes all resources opened in this connection. |
boolean |
connectClient(java.lang.Object remote)
Connects a client to a server. |
javax.microedition.io.StreamConnection |
getConnection()
If server has got a client or client is connected to a server, this method returns the connection. |
java.io.DataInputStream |
getInput()
If server has got a client or client is connected to a server, this method returns the input stream. |
java.io.DataOutputStream |
getOutput()
If server has got a client or client is connected to a server, this method returns the output stream. |
boolean |
isAwaitingClient()
Returns true if this connection is awaiting a client already. |
boolean |
isClosed()
Returns if this connection has been closed or not. |
void |
pretendServerClose()
The BT server cannot be interrupted, so lets just pretend we close the server. |
void |
waitForClient()
Waits for a client, the method blocks until client arrives or IOException is thrown. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BackgammonBTConnection()
Method Detail |
public void waitForClient() throws java.io.IOException
Waits for a client, the method blocks until client arrives
or IOException is thrown. The BT server cannot be interrupted -
call pretendServerClose
to emulate this. Any client
that connects after a call to pretendServerClose
will
immediately be shutdown.
Disable this state by calling waitForClient
again, which
will make the client accepted when it connects. Any call to
waitForClient
during an already active client wait will
just set flags and return directly, as there must be another thread still
waiting a client generated by the first call to waitForClient
.
waitForClient
in interface BackgammonConnection
java.io.IOException
public boolean connectClient(java.lang.Object remote) throws java.io.IOException
BackgammonConnection
connectClient
in interface BackgammonConnection
remote
- Any info needed to connect to the server.
java.io.IOException
public javax.microedition.io.StreamConnection getConnection() throws java.io.IOException
BackgammonConnection
getConnection
in interface BackgammonConnection
java.io.IOException
public java.io.DataInputStream getInput()
BackgammonConnection
getInput
in interface BackgammonConnection
public java.io.DataOutputStream getOutput()
BackgammonConnection
getOutput
in interface BackgammonConnection
public void pretendServerClose()
public boolean isAwaitingClient()
BackgammonConnection
isAwaitingClient
in interface BackgammonConnection
public void close() throws java.io.IOException
BackgammonConnection
close
in interface BackgammonConnection
java.io.IOException
public boolean isClosed()
BackgammonConnection
isClosed
in interface BackgammonConnection
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |