Re: BLE interface to Network Manager for IOT



Thanks for the advice Thomas & Alex. I'll probably do something in Python + libnm (NM 1.0+) and expose the same interfaces that libnm provides.

Still need to figure out the best way serialize the D-Bus data for transmission over BLE. I'm not super familiar with D-Bus, but maybe there are some encapsulation / serialization strategies I can re-use? Or I could use something like protobuf. Any thoughts / suggestions for this part?



On Fri, May 13, 2016 at 1:42 PM, Thomas Haller <thaller redhat com> wrote:
On Fri, 2016-05-13 at 11:23 -0700, John Boiles wrote:
> There's a problem I deal with that I bet a lot of other people deal
> with as well: getting headless machines (for me, usually Raspberry
> Pi) to connect to a wifi network. Usually this involves connecting
> the hardware to a wired connection, then configuring wifi over ssh.
> This is a pain, especially if the device is somewhere that's hard to
> get physical access to.
>
> I've been thinking about creating a daemon that runs alongside
> Network Manager that exposes an interface over BLE that can list and
> configure wireless connections in network manager. Then, I could
> create a simple mobile app that could remotely configure network
> manager over BLE. This would allow for much easier wifi configuration
> on headless devices. This could be especially useful now that the
> Raspberry Pi 3 has both bluetooth and wifi built-in.
>
> I'd be down to build the iOS app (free and oss) and potentially the
> part of the daemon that communicates over BLE, but could use some
> help building the part that interfaces with NM. At very least some
> architecture guidance would be helpful. Anyone interested in working
> on this project?
>

Hi John,


I don't know about BLE, but interfacing with NM works like this:


Your daemon would D-Bus with NM. All other clients (nm-applet to nmcli)
use the same interface.

https://developer.gnome.org/NetworkManager/unstable/index.html

D-Bus can be nicely implemented in most programming languages, so for
example for a Python daemon, it should be pretty comfortable.

NM core project also ships a glib-based client library that wraps the
D-Bus interface: libnm. libnm might be more comfortable to use from
python, via GObject introspection.
Downside is, that libnm only exists for NetworkManager >= 1.0

libnm is always available where NM is (so, it's not really an
additional dependency). 

I personally would start without using libnm. I think using plain D-Bus
tends to work nicely. But others might disagree here.


There exists libnm-glib, which is a deprecated version of libnm. That
one supports versions < 1.0 as well, but should not be used anymore
because it doesn't get new features.




NetworkManager generally thinks in terms of "connections" (aka
profiles). You create and modify them. Then you "activate" them on a
device, meaning to apply the configuration to a networking interface.


See https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples


best,
Thomas



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]