//handles the Selected event public void OnSelected(BLEmanager bm) { //populate the list if (_bleDevice == null) { //first time the button is clicked if (TextName.text.ToUpper().Contains("BLUNO")) { _bleDevice = new BlunoDevice(bm); } else if (TextName.text.ToUpper().Contains("BEAN")) { _bleDevice = new BeanDevice(bm); } else { BluetoothLEHardwareInterface.Log("Selected an unrecognized BLE device"); } } if (_bleDevice != null) {//connect if the BLE device is recognized _bleDevice.OnConnect(TextName.text, TextAddress.text); } }
//constructor public BlunoDevice(BLEmanager bm) { _bleManager = bm; }
private BLEmanager _bleManager; //reference to the BLE manager object for calls //constructor public BeanDevice(BLEmanager bm) { _bleManager = bm; }