Project directory structure

Dirk Hohndel dirk at hohndel.org
Wed Apr 3 11:29:35 PDT 2013


Alberto Mardegan <mardy at users.sourceforge.net> writes:

> On 04/03/2013 08:54 PM, Dirk Hohndel wrote:
>> 
>> That takes a very broad view of what it means to be "interface specific".
>> 
>> But I guess one could argue "core-lib" offers an API
>> 
>> file_needs_saving();
>> 
>> and the UI knows to call this before quitting…
>
> Sharing data between the UI and the core-lib is easy: we can have
> structures defined by the core-lib (like "struct dive"), which the UI
> can update directly or (better) via setter methods (like: dive_set_name()).
> The hardest thing, since we are not sharing the GLib mainloop, is
> sharing events. This can be done using C callbacks, which can be
> registered to the core-lib when it's initialized (think of how Linux
> kernel modules register their methods) or when a specific object is
> initialized.

I don't know which events you mean.

We have "events" which are things that happen during a dive that we
handle (for example, "diver changed tanks" or "diver violated deco
ceiling"). But I think the only asynchronous callbacks that we have in
our code are for the divecomputer download (where we want to update the
UI while a different thread talks to the divecomputer) and things that
are triggered from the UI (so those would be signals/slots).

Am I missing something? 

> However, for what I've seen so far in Subsurface, we'll need very little
> of the latter: most of the actions are initiated in the UI (by the
> end-user), which can therefore simply call the core-lib functions, catch
> their result and behave accordingly.

Yep

> I saw you talk about bluetooth devices in G+ some days ago; was that
> about Subsurface? Is Subsurface directly dealing with USB/bluetooth devices?

Not at the moment. All this is done in libdivecomputer. This is one area
that Jef (the libdivecomputer maintainer who is also on this list) and I
have been talking about over the past month or so. Today it's really
awkward to set up some divecomputer for download - we try to detect the
correct device names in linux.c / macos.c / windows.c - but we can't do
that for Bluetooth right now and a few very strange steps are required
for people to download for example from a Shearwater Petrel via
Bluetooth (details in
http://subsurface.hohndel.org/documentation/user-manual/#S_HowFindBluetoothDeviceName
)

/D


More information about the subsurface mailing list