org.bluez.Network(5)

🌐 org.bluez.Network β€” the BlueZ D-Bus Network API, explained πŸ’–

okay bestie, so this is a page from the BlueZ family of manual pages β€” section 5 of the manual, if you're keeping track β€” and it's literally the docs for org.bluez.Network, a.k.a. the BlueZ D-Bus Network API. no cap, that's the whole vibe: it's the D-Bus interface that lets you do Bluetooth networking stuff. let's get into it ✨


πŸŽ€ NAME

org.bluez.Network β€” BlueZ D-Bus Network API documentation. that's it, that's the name, she's iconic πŸ’…


πŸ¦‹ INTERFACE

okay so before we get to the fun methods, here's the identity card for this interface β€” the way it introduces itself on the bus:

  • Service β€” org.bluez
  • Interface β€” org.bluez.Network1
  • Object path β€” [variable prefix]/{hci0,hci1,...}/dev_{BDADDR}

like, the object path is giving "find me under the adapter directory, one per device" energy. the {hci0,hci1,...} bit is the adapter and the dev_{BDADDR} bit is the device address, iykyk 🫢


✨ METHODS

πŸ’œ string Connect(string uuid)

this one connects to the network device and hands you back the network interface name. literally returns a string, bestie β€” a whole interface name, slay.

and the uuid you pass in can be one of these cuties:

  • "panu", "00001115-0000-1000-8000-00805f9b34fb" β€” Personal Network User role 🌸
  • "nap", "00001116-0000-1000-8000-00805f9b34fb" β€” Network Access Point role πŸ‘‘
  • "gn", "00001117-0000-1000-8000-00805f9b34fb" β€” Group Network role 🌈

big important note: the connection gets closed and the network device released either when you call Disconnect() or when the client disappears from the message bus. so like, if your client just vanishes, the bus notices and cleans up. no ghost connections, we love that for us πŸ’–

possible errors it can throw at you: org.bluez.Error.InvalidArguments, org.bluez.Error.NotSupported, org.bluez.Error.InProgress, org.bluez.Error.Failed β€” so if something's off, one of these πŸ’€ will be the one telling you

🧚 void Disconnect()

disconnects from the network device. that's the whole job, and she does it well ✨

and here's a genuinely useful little detail: if your client hits errors or timeouts mid-connection-attempt and you need to abort the attempt, it's totally fine to just call this method. literally Disconnect() your way out of it, no drama πŸ™ˆ

possible errors here: org.bluez.Error.Failed, org.bluez.Error.NotConnected β€” the second one is very "bestie there was nothing to disconnect from" energy 😭

πŸ“ PROPERTIES

  • boolean Connected [readonly] β€” indicates if the device is connected. simple, honest, main character energy πŸ‘‘
  • string Interface [readonly, optional] β€” indicates the network interface name when available. key words: when available πŸ¦‹
  • string UUID [readonly, optional] β€” indicates the connection role when available. also when available, bestie, don't come for me πŸ’…

and that's the whole page, fr fr β€” every method, every uuid, every error, every property, all accounted for 🌟

so this lil doc came to you courtesy of BlueZ, dated October 2023, and it's filed under org.bluez.Network(5) β€” section 5 forever πŸŽ€ bye bestie, go connect some networks πŸ’–

πŸ“¦ where this page comes from