Hi David, thanks for the pointers, very helpful to be able to see the code. I 
could not find the code for TechnologyModel. Is that closed source as well? Is 
it C++ or QML?

That is the component that interests me the most at this point. Thanks

David
________________________________________
From: David Llewellyn-Jones [da...@flypig.co.uk]
Sent: Tuesday, July 23, 2019 1:20 AM
To: Sailfish OS Developers
Cc: David Weidenkopf
Subject: Re: [SailfishDevel] libconnman-qt application examples

On 22/07/2019 23:57, David Weidenkopf wrote:
> Sorry, I forgot to mention an assumption on my part. Given the API
> design, it looks like it is usable from QML, and no C++ would be
> necessary. Is that an incorrect assumption?

Hi David,

I'm struggling a bit with your negatives, but... no, this is a *correct*
assumption! You can use libconnman-qt as a C++ library, but it also
works as a QML plugin by adding "import MeeGo.Connman 0.2" at the top of
your QML file.

> Hi, we are interested in adopting libconnman-qt as our interface to
> connman. Where can I find examples of usage? For example, I would like
> to see how the library could be used to present a list of SSIDs to a
> user. It is not clear from the API how to do this.

If you're interested in the QML side of things, then the Settings app is
a good place to start (jolla-settings-networking). It's not open source,
but you can find the relevant QML files directly on a Sailfish device
(or the emulator).

For example, this file provides the UI for the main WLAN settings page:

/usr/share/jolla-settings/pages/wlan/mainpage.qml

This lists your saved WLAN networks. It does this using the
SavedServiceModel model, which is a QAbstractListModel, and so can be
plugged straight in to a ListView (or any of the related Qt repeaters).

Look out for TechnologyModel, SavedServiceModel, NetworkTechnology and
NetworkManager around lines 225-253 of the file, which are all from
libconnman-qt.

If you want to manipulate things more specifically, the NetworkManager
provides access to NetworkService objects, and each NetworkService
object provides details of a network (e.g. its name, its domain, whether
it's connected, etc.). NetworkManager and NetworkService are basically
wrappers around their respective connman dbus interfaces:

https://urldefense.proofpoint.com/v2/url?u=https-3A__git.merproject.org_mer-2Dcore_connman_blob_master_connman_doc_manager-2Dapi.txt&d=DwID-g&c=DerLBi25kwTldccx5BE8Yg&r=2EEPhN2n4EOk5Bc2u6g97c4a9NaIyf_MMwxLgRis7kg&m=lLheUeyrbH_9_wmX76cvuWMzIFNtkyJnP-dRDkGOnGg&s=lV9SJ1UM5N8Q_lYbg1EeTVYKXpsyjlAzg80PGYNT3wE&e=

https://urldefense.proofpoint.com/v2/url?u=https-3A__git.merproject.org_mer-2Dcore_connman_blob_master_connman_doc_service-2Dapi.txt&d=DwID-g&c=DerLBi25kwTldccx5BE8Yg&r=2EEPhN2n4EOk5Bc2u6g97c4a9NaIyf_MMwxLgRis7kg&m=lLheUeyrbH_9_wmX76cvuWMzIFNtkyJnP-dRDkGOnGg&s=7vgR68QEcFsgU3FlL-XRnzx9tfcW23lrv8_TeYj56D0&e=

Another place to look would be in this file from lipstick-jolla-home,
which provides the Wifi connection selector dialogue:

/usr/share/lipstick-jolla-home-qt5/connectivity/ConnectionSelector.qml

Somewhere around line 918 you can see the TechnologyModel which is used
to populate the list shown to the user.

There may be other better or open source examples, but these are the two
that spring to mind. Getting a simple QML interface that shows saved
Wifi connections should be relatively straightforward using these models.

David
--
Website: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.flypig.co.uk&d=DwID-g&c=DerLBi25kwTldccx5BE8Yg&r=2EEPhN2n4EOk5Bc2u6g97c4a9NaIyf_MMwxLgRis7kg&m=lLheUeyrbH_9_wmX76cvuWMzIFNtkyJnP-dRDkGOnGg&s=OP746bPtu0FRRmMkgS7hJ5pafqC0gPHOHnvE0Ilh3Pc&e=
This e-mail and any files transmitted with it are the property of Arthrex, Inc. 
and/or its affiliates, are confidential, and are intended solely for the use of 
the individual or entity to whom this e-mail is addressed. If you are not one 
of the named recipient(s) or otherwise have reason to believe that you have 
received this message in error, please notify the sender at 239-643-5553 and 
delete this message immediately from your computer. Any other use, retention, 
dissemination forwarding, printing or copying of this e-mail is strictly 
prohibited. Please note that any views or opinions presented in this email are 
solely those of the author and do not necessarily represent those of the 
company. Finally, while Arthrex uses virus protection, the recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to