{"id":18686289,"url":"https://github.com/exendahal/dotnet_bluez_server","last_synced_at":"2025-06-13T10:34:52.630Z","repository":{"id":220629657,"uuid":"739748518","full_name":"exendahal/dotnet_bluez_server","owner":"exendahal","description":"A .NET Core library for creating BLE servers and managing clients on Linux using BlueZ D-Bus API and Tmds.DBus. Define and advertise custom GATT services and characteristics.","archived":false,"fork":false,"pushed_at":"2024-03-30T09:46:10.000Z","size":76045,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T00:25:36.548Z","etag":null,"topics":["ble","bluez","bluez-dbus","csharp","dotnet-core"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exendahal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-06T12:31:05.000Z","updated_at":"2025-01-25T00:58:40.000Z","dependencies_parsed_at":"2024-02-10T07:22:21.286Z","dependency_job_id":"3984d0e2-8d28-4efb-8f18-ef738265779b","html_url":"https://github.com/exendahal/dotnet_bluez_server","commit_stats":null,"previous_names":["exendahal/dotnet_bluez_server"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exendahal%2Fdotnet_bluez_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exendahal%2Fdotnet_bluez_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exendahal%2Fdotnet_bluez_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exendahal%2Fdotnet_bluez_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exendahal","download_url":"https://codeload.github.com/exendahal/dotnet_bluez_server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247999861,"owners_count":21031046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ble","bluez","bluez-dbus","csharp","dotnet-core"],"created_at":"2024-11-07T10:26:55.982Z","updated_at":"2025-04-12T04:54:31.600Z","avatar_url":"https://github.com/exendahal.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\n.NET BlueZ Server is a powerful library designed to facilitate the creation of Bluetooth Low Energy (BLE) peripherals and efficiently manage centrals on Linux using .NET Core. Leveraging the capabilities of BlueZ under the hood, this library offers a seamless API that preserves the object structure of BlueZ while streamlining D-Bus communication for a more developer-friendly experience.\n This library builds upon [.NET BLE Server](https://github.com/phylomeno/dotnet-ble-server), introducing specialized methods for handling connected centrals to BLE peripherals.\n \n[![Bluez.NET.Server](https://img.shields.io/nuget/v/Bluez.NET.Server)](https://www.nuget.org/packages/Bluez.NET.Server/)\n\n\n## Key features\n- BLE Peripheral Creation\n- Adapter Management\n- Central Management\n- Pair device\n- Remove Device\n- Get all paired devices\n- Get central object path on Read and Write request\n\n## Examples\n\n### Demo Example\nFind demo project under `/example` directory\n\nCreate BLE peripheral\n\n```\nServerContext _CurrentServerContext = new ServerContext();\nawait BleAdvertisement.RegisterAdvertisement(_CurrentServerContext);\nawait BleGattApplication.RegisterGattApplication(_CurrentServerContext);\nDeviceManager.SetDevicePropertyListenerAsync(_CurrentServerContext, OnDeviceConnectedAsync);\n```\n\nListen to Central property change\n\n```\nprivate async void OnDeviceConnectedAsync(IDevice1 device, PropertyChanges changes)\n{\n    foreach (var change in changes.Changed)\n    {\n        Console.WriteLine($\"{change.Key}:{change.Value}\");                  \n    }\n}\n```\n\nGet BLE Adapter \n\n```\nAdapterManager.GetAdapter(_CurrentServerContext);\n```\n\nTurn ON/OFF BLE Adapter\n\n```\nvar isAdapterOn = AdapterManager.SetAdapterPowerOn(_CurrentServerContext);\nvar isAdapterOff = AdapterManager.SetAdapterPowerOff(_CurrentServerContext);\n```\n\nGet paired devices\n\n```\nvar devices = await DeviceManager.GetDeviceListAsync(_CurrentServerContext);\n```\n\nRemove paired device\n\n```\nawait DeviceManager.RemoveDeviceAsync(_CurrentServerContext, iDevice);\n```\n\nGet Device from the Address\n\n```\n var device = await DeviceManager.GetDeviceAsync(_CurrentServerContext, address);\n```\n\nGet Device from the object path\n\n```\nvar device = await DeviceManager.GetDeviceByObject(_CurrentServerContext, address);\n```\n\nPair device\n\n```\nvar paired = await device.GetPairedAsync();\nif (!paired)\n{\n    var response = await DeviceManager.PairDeviceAsync(_CurrentServerContext,device);\n}\n```\n\n## Useful references\n| Resource                                | Link                                                                                           |\n|-----------------------------------------|------------------------------------------------------------------------------------------------|\n| BlueZ GATT API documentation            | [https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt](https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt) |\n| Presentation BLE on Linux               | [https://elinux.org/images/3/32/Doing_Bluetooth_Low_Energy_on_Linux.pdf](https://elinux.org/images/3/32/Doing_Bluetooth_Low_Energy_on_Linux.pdf)       |\n\n## Stats\n![Alt](https://repobeats.axiom.co/api/embed/0712cf34a1555e973399b47d67d3bfb7bd77fa72.svg \"Repobeats analytics image\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexendahal%2Fdotnet_bluez_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexendahal%2Fdotnet_bluez_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexendahal%2Fdotnet_bluez_server/lists"}