internal IEnumerable <BluetoothGattService> GetServices(BluetoothGattServer server) { List <BluetoothGattService> attribututeList = new List <BluetoothGattService>(); Interop.Bluetooth.BtGattForeachCallback cb = (total, index, attributeHandle, userData) => { BluetoothGattAttributeHandle handle = new BluetoothGattAttributeHandle(attributeHandle, false); BluetoothGattService service = BluetoothGattServiceImpl.CreateBluetoothGattService(handle, "");; if (service != null) { service.SetParent(server); attribututeList.Add(service); } return(true); }; int err = Interop.Bluetooth.BtGattServerForeachServices(_handle, cb, IntPtr.Zero); GattUtil.Error(err, "Failed to get all services"); return(attribututeList); }
internal IEnumerable <BluetoothGattService> GetIncludeServices(BluetoothGattService parentService) { List <BluetoothGattService> attribututeList = new List <BluetoothGattService>(); _includedServiceForeachCallback = (total, index, attributeHandle, userData) => { BluetoothGattAttributeHandle handle = new BluetoothGattAttributeHandle(attributeHandle, false); BluetoothGattService service = BluetoothGattServiceImpl.CreateBluetoothGattService(handle, ""); if (service != null) { service.SetParent(parentService); attribututeList.Add(service); } return(true); }; int err = Interop.Bluetooth.BtGattServiceForeachIncludedServices(parentService.GetHandle(), _includedServiceForeachCallback, IntPtr.Zero); GattUtil.Error(err, "Failed to get all services"); return(attribututeList); }