コード例 #1
0
        /// <summary>
        /// Creates and initialises a new GattDevice
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        private static GattService Create(GattDeviceService service)
        {
            GattService s = new GattService(service);

            s.characteristics = GattCharacteristic.GetCharacteristics(s);
            return(s);
        }
コード例 #2
0
        /// <summary>
        /// Creates and initialises a new GattDevice
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        internal static GattDevice Create(BluetoothLEDevice device)
        {
            GattDevice d = new GattDevice(device);

            d.services = GattService.GetServices(d);
            return(d);
        }
コード例 #3
0
        /// <summary>
        /// Creates a list of services given a GattDevice
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public static List <GattCharacteristic> GetCharacteristics(GattService service)
        {
            List <GattCharacteristic> returnList = new List <GattCharacteristic>();

            foreach (Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic Char in service.service.GetAllCharacteristics())
            {
                GattCharacteristic s = new GattCharacteristic(Char);
                returnList.Add(s);
            }

            return(returnList);
        }
コード例 #4
0
        /// <summary>
        /// Creates a list of services given a GattDevice
        /// </summary>
        /// <param name="device"></param>
        /// <returns></returns>
        public static List <GattService> GetServices(GattDevice device)
        {
            List <GattService> returnList = new List <GattService>();

            foreach (GattDeviceService service in device.device.GattServices)
            {
                GattService s = GattService.Create(service);
                returnList.Add(s);
            }

            return(returnList);
        }