|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stollmann.terminalIO.TIOPeripheral
public class TIOPeripheral
TIOPeripheral instances represent remote devices that have been identified as TerminalIO servers during a TIOManager scan procedure.
The application retrieves TIOPeripheral instances by calling the TIOManager TIOManager.getPeripherals
property or via invocations of one of the peripheral relevant TIOManagerCallback
methods.
The application shall not create any TIOPeripheral instances of its own.
Method Summary | |
---|---|
void |
connect()
Initiates the establishing of a TerminalIO connection to the remote device. |
static TIOPeripheral |
createFromBluetoothDevice(BluetoothDevice device)
// * @deprecated (exclude for javadoc documentation generation) Internal method to be called by TIOManager only; do not call from application code. |
static TIOPeripheral |
createFromScanResult(BluetoothDevice device,
TIOAdvertisement advertisement)
// * @deprecated (exclude for javadoc documentation generation) Internal method to be called by TIOManager only; do not call from application code. |
void |
disconnect()
Requests the operating system to disconnect from the remote device. |
java.lang.String |
getAddress()
Gets the preripheral's Bluetooth address. |
TIOAdvertisement |
getAdvertisement()
Gets the TIOAdvertisement instance representing the latest advertisement received from the peripheral within a scan procedure. |
java.lang.String |
getAdvertisementDisplayString()
Gets a string representation of the current advertisement , see also TIOAdvertisement.getDisplayString() . |
int |
getLocalUARTCreditsCount()
Gets the current number of UART credits available on the local device. |
int |
getMaxLocalUARTCreditsCount()
Gets the maximum number of local credits that are granted to the remote device, see setMaxLocalUARTCreditsCount() . |
int |
getMinLocalUARTCreditsCount()
Gets the minimum number of local credits the remote device should have at its disposal, see setMinLocalUARTCreditsCount() . |
java.lang.String |
getName()
Gets the preripheral's Bluetooth GATT name. |
int |
getRemoteUARTCreditsCount()
Gets the current number of UART credits available on the remote device. |
java.lang.Object |
getTag()
Gets the tag object. |
boolean |
isConnected()
Gets the peripheral's TerminalIO connection state. |
boolean |
isConnecting()
Gets the peripheral's connecting state. |
void |
readRSSI()
Initiates the reading of the current RSSI value. |
void |
setListener(TIOPeripheralCallback listener)
Sets the listener object to receive TIOPeripheral events, see TIOPeripheralCallback . |
void |
setMaxLocalUARTCreditsCount(int maxLocalUARTCreditsCount)
Sets the maximum number of local credits that shall be granted to the remote device. |
void |
setMinLocalUARTCreditsCount(int minLocalUARTCreditsCount)
Sets the minimum number of local credits that shall be granted to the remote device. |
void |
setShallBeSaved(boolean shallBeSaved)
Determines whether the peripheral shall be persistently saved to file by the TIOManager.savePeripherals() method or not. |
void |
setTag(java.lang.Object tag)
Sets a tag object. |
boolean |
shallBeSaved()
Gets the information whether the peripheral shall be persistently saved to file by the TIOManager.savePeripherals() method or not. |
java.lang.String |
toString()
Gets a string representation of this instance consisting of Bluetooth name and Bluetooth address. |
boolean |
updateWithAdvertisement(TIOAdvertisement advertisement)
// * @deprecated (exclude for javadoc documentation generation) Internal method to be called by TIOManager only; do not call from application code. |
void |
writeUARTData(byte[] data)
Writes UART data to the remote device. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public void connect()
tioPeripheralDidConnect()
method is invoked;
otherwise tioPeripheralDidFailToConnect()
will be invoked.
Data exchange operations cannot be performed unless TIOPeripheralCallback.tioPeripheralDidConnect()
has been invoked; the application may also check for isConnected()
.
To cancel a pending connection request, call disconnect()
.
If the remote device is configured to require security and has not been paired before with the local device, a silently running Bluetooth pairing process will be initiated.
public static TIOPeripheral createFromBluetoothDevice(BluetoothDevice device)
public static TIOPeripheral createFromScanResult(BluetoothDevice device, TIOAdvertisement advertisement)
public void disconnect()
tioPeripheralDidDisconnect()
.
public java.lang.String getAddress()
public TIOAdvertisement getAdvertisement()
TIOManager.loadPeripherals()
method
and no subsequent scan has been performed yet.
public java.lang.String getAdvertisementDisplayString()
advertisement
, see also TIOAdvertisement.getDisplayString()
.
advertisement
, or an empty String if the advertisement is null.public int getLocalUARTCreditsCount()
public int getMaxLocalUARTCreditsCount()
setMaxLocalUARTCreditsCount()
.
public int getMinLocalUARTCreditsCount()
setMinLocalUARTCreditsCount()
.
public java.lang.String getName()
public int getRemoteUARTCreditsCount()
public java.lang.Object getTag()
public boolean isConnected()
true
if the TIOPeripheral instance is TerminalIO connected to the remote device, false
otherwise.public boolean isConnecting()
true
if the TIOPeripheral instance is in the process of establishing a TerminalIO connection to the remote device, false
otherwise.public void readRSSI()
tioPeripheralDidUpdateRSSI()
.
public void setListener(TIOPeripheralCallback listener)
TIOPeripheralCallback
.
If listener
extends Activity, the event methods will be invoked on the UI thread.
listener
- TIOPeripheralCallback implementor receiving TIOPeripheralCallback
events.public void setMaxLocalUARTCreditsCount(int maxLocalUARTCreditsCount)
maxLocalUARTCreditsCount
- Maximum number of local credits that shall be granted to the remote device.public void setMinLocalUARTCreditsCount(int minLocalUARTCreditsCount)
minLocalUARTCreditsCount
- Minimum number of local credits that shall be granted to the remote device.public void setShallBeSaved(boolean shallBeSaved)
TIOManager.savePeripherals()
method or not.
public void setTag(java.lang.Object tag)
tag
- An Object instance to tag to this TIOPeripheral instance.public boolean shallBeSaved()
TIOManager.savePeripherals()
method or not.
true
if the peripheral shall be persistently saved to file by the TIOManager.savePeripherals()
method, false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object
public boolean updateWithAdvertisement(TIOAdvertisement advertisement)
public void writeUARTData(byte[] data)
tioPeripheralDidWriteNumberOfUARTBytes()
will be invoked reporting the number of bytes written.
If there are no more data to be written, the TIOPeripheralDelegate method tioPeripheralUARTWriteBufferEmpty()
will be invoked.
data
- Data to be written.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |