internal static BluetoothGattService CreateBluetoothGattService(BluetoothGattAttributeHandle handle, string uuid) { if (uuid == "") { int err = Interop.Bluetooth.BtGattGetUuid(handle, out uuid); GattUtil.ThrowForError(err, "Failed to get UUID"); } BluetoothGattServiceImpl impl = new BluetoothGattServiceImpl(handle); return(new BluetoothGattService(impl, uuid)); }
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); }
internal BluetoothGattService(BluetoothGattServiceImpl impl, string uuid) { Uuid = uuid; _impl = impl; }
/// <summary> /// The constructor. /// </summary> /// <param name="uuid">The UUID of the service.</param> /// <param name="type">The type of service.</param> /// <exception cref="InvalidOperationException">Thrown when the create GATT service procedure fails.</exception> /// <since_tizen> 3 </since_tizen> public BluetoothGattService(string uuid, BluetoothGattServiceType type) { Uuid = uuid; _impl = new BluetoothGattServiceImpl(uuid, type); }