/** * if the node is connected enable the gui otherwise attach a listener for do it when the node * connects */ @Override protected void onResume() { super.onResume(); if (mNode.isConnected()) { setUpConsoleService(mNode.getDebug()); } else mNode.addNodeStateListener(mNodeStateChangeListener); }//onResume
/** * if the node is connected enable the gui, otherwise set a listener that will do that */ @Override protected void onResume() { super.onResume(); if (mNode.isConnected()) { populateFeatureList(); invalidateOptionsMenu(); //enable/disable the settings options } else mNode.addNodeStateListener(mNodeStatusListener); }//onResume
/** * if not already connected, show the dialog and stat the connection with the node */ @Override public void onResume() { super.onResume(); if (mNode != null && !mNode.isConnected()) { mConnectionWait.show(); //show the dialog and set the listener for hide it mNode.addNodeStateListener(mNodeStateListener); mNode.connect(getActivity()); }//if }//onResume
/** * create a new node * @param device android ble device * @param rssi rssi of the advertise message * @param advertise advertise message for this node * @throws InvalidBleAdvertiseFormat if the advertise is not well formed */ public Node(BluetoothDevice device,int rssi,byte advertise[]) throws InvalidBleAdvertiseFormat{ mAdvertise = new BleAdvertiseParser(advertise); mDevice = device; mExternalCharFeatures= new HashMap<>(); updateRssi(rssi); updateNodeStatus(State.Idle); initHandler(); addNodeStateListener(mNotifyCommandChange); Log.i(TAG, mAdvertise.toString()); }
/** * create a new node from the advertise, the advertise have to contain the mac address * @param advertise advertise message for this node * @throws InvalidBleAdvertiseFormat if the advertise is not well formed, for this method is * mandatory that the advertise contains also the mac address */ public Node(byte advertise[]) throws InvalidBleAdvertiseFormat{ mAdvertise = new BleAdvertiseParser(advertise); String bleAddress = mAdvertise.getAddress(); if(bleAddress==null){ throw new InvalidBleAdvertiseFormat("Device Address non present in the advertise"); } mDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(bleAddress); mExternalCharFeatures= new HashMap<>(); updateNodeStatus(State.Idle); initHandler(); addNodeStateListener(mNotifyCommandChange); Log.i(TAG, mAdvertise.toString()); }
newNode.addNodeStateListener(mDebugNodeStatus); addNode(newNode); } catch (InvalidBleAdvertiseFormat e) {
initializeConfigService(mNode); else mNode.addNodeStateListener(mNodeStatusListener);