25package trial.org.direct_bt;
27import java.lang.reflect.InvocationTargetException;
28import java.util.Arrays;
31import org.direct_bt.BTMode;
32import org.direct_bt.BTRole;
33import org.direct_bt.BTSecurityLevel;
34import org.direct_bt.BTAdapter;
35import org.direct_bt.BTException;
36import org.direct_bt.BTFactory;
37import org.direct_bt.BTManager;
38import org.direct_bt.DirectBTVersion;
39import org.jau.io.PrintUtil;
40import org.jau.net.EUI48;
41import org.junit.Assert;
42import org.junit.FixMethodOrder;
44import org.junit.runners.MethodSorters;
53@FixMethodOrder(MethodSorters.NAME_ASCENDING)
55 static final boolean DEBUG =
false;
64 public final
void test01_ManagerBringup() {
70 }
catch (
BTException | NoSuchMethodException | SecurityException
71 | IllegalAccessException | IllegalArgumentException
72 | InvocationTargetException | ClassNotFoundException e) {
74 Assert.assertNull(
"Unable to instantiate Direct-BT BluetoothManager: "+e.getMessage(), e);
76 if(
null == manager ) {
79 final List<BTAdapter> adapters = manager.
getAdapters();
80 PrintUtil.println(System.err,
"Adapter: Count "+adapters.size());
81 for(
int i=0; i<adapters.size(); i++) {
82 PrintUtil.println(System.err, i+
": "+adapters.get(i).toString());
84 Assert.assertTrue(
"Adapter count not >= 1 but "+adapters.size(), adapters.size() >= 1);
87 Assert.assertFalse( a.isInitialized() );
88 Assert.assertFalse( a.isPowered() );
90 Assert.assertTrue( 4 <= a.getBTMajorVersion() );
95 public final
void test10_ServerStartStop_and_ToggleDiscovery() {
99 }
catch (
BTException | NoSuchMethodException | SecurityException
100 | IllegalAccessException | IllegalArgumentException
101 | InvocationTargetException | ClassNotFoundException e) {
103 Assert.assertNull(
"Unable to instantiate Direct-BT BluetoothManager: "+e.getMessage(), e);
105 if(
null == manager ) {
109 final String serverName =
"TestDBTCS00-S-T10";
113 final DBTEndpoint.ChangedAdapterSetListener myChangedAdapterSetListener =
142 PrintUtil.println(System.err,
"****** EOL Removed ChangedAdapterSetCallback " + count);
145 public static void main(
final String args[]) {
One stop BTManager API entry point.
static synchronized BTManager getDirectBTManager()
Returns an initialized BluetoothManager instance using the DirectBT implementation.
This jaulib derived version info class is only usable when having jaulib available,...
static final void printVersionInfo(final PrintStream out)
Print full Direct-BT version information.
This peripheral BTRole::Slave test participant works with DBTClient00.
BTAdapter getAdapter()
Return the adapter for this endpoint.
void setProtocolSessionsLeft(final int v)
Basic client and server Bluetooth tests using non-fat Direct-BT Jar, requiring one BT adapter:
static void main(final String args[])
Bluetooth adapter operating mode.
DUAL
Dual Bluetooth mode, i.e.
Bluetooth roles from the perspective of the link layer (connection initiator).
Master
Master or central role, discovering remote devices and initiating connection.
Bluetooth Security Level.
NONE
No encryption and no authentication.
BTAdapter represents one local Bluetooth Controller.
int removeAllStatusListener()
Remove all AdapterStatusListener from the list.
A thread safe singleton handler of the BTAdapter manager, e.g.
List< BTAdapter > getAdapters()
Returns a list of BluetoothAdapters available in the system.
int removeChangedAdapterSetListener(final ChangedAdapterSetListener l)
Remove the given ChangedAdapterSetListener from this manager.
static void startDiscovery(final BTAdapter adapter, final boolean current_exp_discovering_state)
static void checkInitializedState(final DBTEndpoint endp)
static void stopDiscovery(final BTAdapter adapter, final boolean current_exp_discovering_state)
static ChangedAdapterSetListener initChangedAdapterSetListener(final BTManager manager, final List< DBTEndpoint > endpts)
HCIStatusCode startAdvertising(String msg)
static void stop(final DBTServerTest server, final String msg)