/// <summary> /// Tries to get hexoskin data. /// </summary> /// <returns><c>true</c>, if to get hexoskin data was tryed, <c>false</c> otherwise.</returns> bool TryToGetHexoskinData() { if (_hexoskinManager.CanGetData()) // we have data { NSUuid nKey = new NSUuid(); BluetoothSensorMonitor m = new BluetoothSensorMonitor(_hexoskinManager.HexoskinName, nKey); AddToConnectedSensors(nKey, m); // trigger event OnSensorConnectionsChanged(new BluetoothConnectionChangedEventArgs { Peripheral = null, UpdatedConnectedDevicesString = GetConnectedDevicesString() }); // now start the loop to refresh hexoskin data at regular intervals _hexoskinManager.StartGettingData(); } else { _hexoskinManager.StopGettingData(); } return(_hexoskinManager.bConnectedToData); }
public void ConnectToSensor(CBPeripheral p) { BluetoothSensorMonitor connectedMonitor = new BluetoothSensorMonitor(_cbCentralManager, p); connectedMonitor.Connect(); AddToConnectedSensors(p.Identifier, connectedMonitor); }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { var cell = (SensorCell)collectionView.DequeueReusableCell(SensorCell.CellID, indexPath); BluetoothSensorMonitor sensorMonitor = _sensorManager.ConnectedSensorsSorted[indexPath.Row]; //SensorCellData cellData = Rows[indexPath.Row]; cell.UpdateCell(sensorMonitor.GetConnectedSensorUIString(), sensorMonitor.PresentButDisconnected); return(cell); }
/// <summary> /// Clean-up when disconnecting from sensor /// </summary> /// <param name="sensorIdentifier">Sensor identifier.</param> void DisposeSensorMonitor(NSUuid sensorIdentifier) { BluetoothSensorMonitor connectedMonitor = null; if (_connectedSensorDictionary.TryGetValue(sensorIdentifier, out connectedMonitor)) { if (connectedMonitor != null) { connectedMonitor.Dispose(); connectedMonitor = null; RemoveFromConnectedSensors(sensorIdentifier); } } }
List <BluetoothSensorMonitor> GetMonitorsForSelectedPeripherals() { List <BluetoothSensorMonitor> bluetoothMonitors = new List <BluetoothSensorMonitor>(); var selectedItems = _connectedDevicesCollectionView.GetIndexPathsForSelectedItems(); foreach (var selectedItem in selectedItems) { BluetoothSensorMonitor sensorMonitor = _sensorCollectionSource.GetConnectedMonitor(selectedItem.Row); bluetoothMonitors.Add(sensorMonitor); //if (sensorMonitor.bIsHexoskinMonitor) //{ //} //else //{ // peripherals.Add(sensorMonitor.Peripheral); //} } return(bluetoothMonitors); }
public SensorPeripheralDelegate(BluetoothSensorMonitor monitor) { this.monitor = monitor; }
/// <summary> /// Adds to connected sensors dictionary, and updates associated sorted list. Use this /// to add sensors to the _connectedSensorDictionary /// </summary> /// <param name="id">Identifier.</param> /// <param name="sensorMonitor">Sensor monitor.</param> public void AddToConnectedSensors(NSUuid id, BluetoothSensorMonitor sensorMonitor) { _connectedSensorDictionary.Add(id, sensorMonitor); UpdateSortedSensorMonitors(); }