-
Notifications
You must be signed in to change notification settings - Fork 9
Generate Interfaces
Generating interfaces with Tmds.DBus v0.11.0.
Skip ahead to the Generate Interfaces section, if you already have it installed.
$ dotnet tool install -g Tmds.DBus.Tool
$ dotnet dbus codegen --bus system --service org.bluez
The following actions were tested against Ubuntu v20.04 LTS. Please note, NET Core 3.1 or NET 6 is required for this step.
Verify that .NET 3.1, 5.0, or 6.0 is installed.
$ dotnet --list-sdk
If the required SDK it's not installed, continue. Referenced by Install the SDK - Ubuntu v20.04 LTS
$ sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-6.0
After installation, validate it again.
$ dotnet --list-sdk
Open a new console application (create project space)
$ dotnet new console -o GenBluez
$ cd GenBluez
Add a reference to Tmds.DBus
in the GenBluez.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Tmds.DBus" Version="0.11.0" />
</ItemGroup>
</Project>
Restore dependencies
$ dotnet restore
$ dotnet tool install -g Tmds.DBus.Tool
Did you receive error, Tool 'tmds.dbus.tool' is already installed.
?
Simply, validate your version installed and upgrade if necessary.
- Go to your DotNet installation's
.store
folder -/.dotnet/tools/.store/tmds.dbus.tool
- Validate the version
- To update,
dotnet tool update -g Tmds.DBus.Tool
List available DBus services
dotnet dbus list services
BlueZ is a system service, which is referenced in /usr/share/dbus-1/system-service
as org.bluez.service
. To uncover all other system services you can execute one of the following:
dotnet dbus list services --bus system
To get moving on listing the objects and generating code for BlueZ over DBus, perform the following:
$ dotnet dbus list services --bus system | grep bluez
OUTPUT:
org.bluez
In the results you will find, org.bluez
if you have it installed (Raspberr PI 4B does).
To obtain the objects of org.bluez
input the following and you should get similar results.
$ dotnet dbus list objects --bus system --service org.bluez
OUTPUT:
/ : org.freedesktop.DBus.ObjectManager
/org/bluez : org.bluez.AgentManager1 org.bluez.HealthManager1 org.bluez.ProfileManager1
/org/bluez/hci0 : org.bluez.Adapter1 org.bluez.GattManager1 org.bluez.LEAdvertisingManager1 org.bluez.Media1 org.bluez.NetworkServer1
$ dotnet dbus codegen --bus system --service org.bluez
Generated: /home/.../bluez.DBus.cs