1

I am trying to run a Bluetooth GATT server on raspberry pi 3 and raspbian OS. Based on this post, the BlueZ D-Bus api can be used in .Net Core by Tmds.DBus library and its C# interfaces can be generate using Tmds.DBus tool. I have read Bluez docs and most of the existing samples (based on python and c), but i can't understand how to define and advertise the GATT server in .Net Core.

Can anyone provide a .Net sample or any other solution?

Emad Feiz
  • 1,545
  • 1
  • 10
  • 17
  • What error are you getting? The links you provided already have sample code so you must have an error. – jdweng Aug 23 '20 at 15:13
  • @jdweng The sample in that post is about connecting to gatt service(its a gatt client), but i want to create and run a gatt server that expose a service (peripheral bluetooth mode). – Emad Feiz Aug 23 '20 at 20:13
  • the you want to develop you own cloud application that has two ports. 1) A client that connects to the gatt service 2) One that is a Cloud Server application that accepts clients. You are not creating a gatt service, just connecting to an exist service. – jdweng Aug 23 '20 at 21:56
  • What do you mean about cloud app? each device in bluetooth LE connection can have two roles, client or server. the server exposes some services and characteristics and the client device can connect and use those services. – Emad Feiz Aug 24 '20 at 03:24
  • Cloud App is a server. You want a webpage (server) that clients can connect and will communicate with the Tmds Library. – jdweng Aug 24 '20 at 08:10

1 Answers1

2

Creating a BLE peripheral is one of the more tricky things to do with BlueZ D-Bus API. You will need to create a GATT server and an advertisement. Unlike the GATT client, creating the server requires for objects to be registered on the dbus.

I am not familiar with .NET, but it is the ability to register objects in D-Bus is the key to getting a GATT server working. From this example I found the key word is : RegisterObjectAsync

Using that keyword, I then did a search and turned up this library as using it:

https://github.com/phylomeno/dotnet-ble-server

This looks like it should be of interest to you.

ukBaz
  • 6,985
  • 2
  • 8
  • 31