|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stollmann.terminalIO.TIOManager
public class TIOManager
The TIOManager is the fundamental class to provide TerminalIO functionality towards the application. It exists as one instance only per application (singleton),
encapsulating the TerminalIO Bluetooth Low Energy functionality and supplying its listener TIOManagerCallback
with TerminalIO relevant events.
Method Summary | |
---|---|
TIOPeripheral |
findPeripheralByAddress(java.lang.String address)
Retrieves the TIOPeripheral instance with the specified address. |
Context |
getApplicationContext()
Gets the application context passed to TIOManager in the call to initialize() . |
TIOPeripheral[] |
getPeripherals()
Gets all TIOPeripheral instances representing the currently known TerminalIO peripherals. |
static void |
initialize(Context applicationContext)
Create the singleton TIOManager instance - including the tying up to the Android BluetoothAdapter - and loads the list of know peripherals. |
boolean |
isBluetoothEnabled()
Gets the current Bluetooth enabled state. |
void |
loadPeripherals()
Loads TIOPeripherals previously saved with savePeripherals() . |
void |
removeAllPeripherals()
Removes all peripherals from the TIOManager's peripheral list. |
void |
removePeripheral(TIOPeripheral peripheral)
Removes the specified peripheral from the TIOManager's peripheral list. |
void |
savePeripherals()
Serializes a list of known peripheral Bluetooth addresses to a persistent file in the application directory. |
void |
setListener(TIOManagerCallback listener)
Sets the listener for TerminalIO scan events. |
static TIOManager |
sharedInstance()
Returns the singleton TIOManager instance. |
void |
startScan()
Starts a Bluetooth Low Energy scan procedure. |
void |
stopScan()
Stops a currently running scan procedure. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public TIOPeripheral findPeripheralByAddress(java.lang.String address)
address
- A Bluetooth address string to retrieve a TIOPeripheral instance for; format is [00:11:22:AA:BB:CC].
public Context getApplicationContext()
initialize()
.
initialize()
.public TIOPeripheral[] getPeripherals()
public static void initialize(Context applicationContext)
public boolean isBluetoothEnabled()
true
if Bluetooth is enabled on the Smart Phone, false
otherwise.public void loadPeripherals()
savePeripherals()
.
Populates the TIOManager's peripherals list with TIOPeripheral instances created from a serialized list of Bluetooth addresses.
This method is called implicitly during initialization via initialize()
.
The reconstructed TIOPeripheral instances do not contain any advertisement information.
If Bluetooth has been switched off, also the name information will be lost.
If any advertisement information (e.g. local name, TIOPeripheralOperationMode) or name information is required,
call startScan()
in order to refresh the advertisement information of peripherals within radio range.
public void removeAllPeripherals()
public void removePeripheral(TIOPeripheral peripheral)
public void savePeripherals()
public void setListener(TIOManagerCallback listener)
listener
extends Activity, TIOManager invokes all TIOManagerCallback methods on the UI thread.
listener
- The listener to receive TIOManagerCallback events.public static final TIOManager sharedInstance()
public void startScan()
TIOManager.Callback#tioManagerDidDiscoverPeripheral())
method.
Call stopScan to stop the scan procedure and save battery power.
public void stopScan()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |