DeviceIdentifierToGuid() public static method

Gets the device identifier.
public static DeviceIdentifierToGuid ( NSUuid id ) : System.Guid
id NSUuid The device identifier as a NSUuid.
return System.Guid
Esempio n. 1
0
        private void DisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            var deviceId = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);
            //var device = _devices.FirstOrDefault (x => x.Id == deviceId);
            var device = new Device(e.Peripheral);

            DeviceDisconnected(this, new DeviceConnectionEventArgs(device));
        }
Esempio n. 2
0
        private void DisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            var deviceId        = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);
            var connectedDevice = ConnectedDevices.FirstOrDefault(x => x.Id == deviceId);

            if (connectedDevice != null)
            {
                ConnectedDevices.Remove(connectedDevice);
                DeviceDisconnected(this, new DeviceConnectionEventArgs(connectedDevice));
            }
        }
Esempio n. 3
0
        private void ConnectedPeripheral(object sender, CBPeripheralEventArgs e)
        {
            var deviceId = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);

            if (ConnectedDevices.All(x => x.Id != deviceId))
            {
                var device = new Device(e.Peripheral);
                ConnectedDevices.Add(device);
                DeviceConnected(this, new DeviceConnectionEventArgs(device));
            }
        }
Esempio n. 4
0
        private void DiscoveredPeripheral(object sender, CBDiscoveredPeripheralEventArgs e)
        {
            var deviceId = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);

            if (DiscoveredDevices.All(x => x.Id != deviceId))
            {
                var device = new Device(e.Peripheral);
                DiscoveredDevices.Add(device);
                DeviceDiscovered(this, new DeviceDiscoveredEventArgs(device));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the discovered devices.
        /// </summary>
        /// <value>The discovered devices.</value>
        //public IList<IDevice> DiscoveredDevices {
        //	get { return _devices.ToList(); }
        //}
        /// <summary>
        /// Gets the connected devices.
        /// </summary>
        /// <value>The connected devices.</value>
        //public IList<IDevice> ConnectedDevices {
        //	get {
        //		return _devices.Where(x => x.State == DeviceState.Connected).ToList();
        //	}
        //}

        #endregion

        #region CBCentralManager delegate methods
        private void DiscoveredPeripheral(object sender, CBDiscoveredPeripheralEventArgs e)
        {
            var deviceId = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);

            if (_discoveringDevices.All(x => x.Id != deviceId))
            {
                var device = new Device(e.Peripheral, e.RSSI);
                _discoveringDevices.Add(device);
                device.AdvertismentData       = ProcessData(e.AdvertisementData);
                device.AdvertisedServiceUuids = ProcessUuids(e.AdvertisementData);

                if (_devices.All(x => x.Id != device.Id))
                {
                    _devices.Add(device);
                }
                DeviceDiscovered(this, new DeviceDiscoveredEventArgs(device));
            }
        }