public Peripheral GetOrAdd(CBCentral central) { if (!this.peripherals.ContainsKey(central.Identifier)) { this.peripherals.Add(central.Identifier, new Peripheral(central)); } return(this.peripherals[central.Identifier]); }
public Peripheral GetOrAdd(CBCentral central) { if (!this.peripherals.ContainsKey(central.UUID)) { this.peripherals.Add(central.UUID, new Peripheral(central)); } return(this.peripherals[central.UUID]); }
private void OnReceivedMessage(string message, CBCentral central) { lock (central) { var user = _userStorage.GetUser(central.Identifier); if (user != null) { SaveMessageItem(new MessageItem(message, user, DateTime.Now)); } } }
IDevice Remove(CBCentral central) { lock (this.subscribers) { if (this.subscribers.ContainsKey(central.Identifier)) { var device = this.subscribers[central.Identifier]; this.subscribers.Remove(central.Identifier); return(device); } return(null); } }
public Peripheral SetSubscription(CBCentral central, bool subscribe) { var peripheral = this.GetOrAdd(central); if (subscribe) { this.subscribed.Add(central.Identifier, peripheral); } else { this.subscribed.Remove(central.Identifier); } return(peripheral); }
IDevice GetOrAdd(CBCentral central) { lock (this.subscribers) { if (this.subscribers.ContainsKey(central.Identifier)) { return(this.subscribers[central.Identifier]); } var device = new Device(central); this.subscribers.Add(central.Identifier, device); return(device); } }
public override void CharacteristicUnsubscribed(CBPeripheralManager peripheral, CBCentral central, CBCharacteristic characteristic) { SensusServiceHelper.Get().Logger.Log("Characteristic unsubscribed.", LoggingLevel.Normal, GetType()); }
public Peripheral(CBCentral central) { this.Central = central; this.Uuid = central.Identifier.ToString(); }
public Device(CBCentral central) { this.Central = central; this.Uuid = new Guid(central.Identifier.ToString()); }