RFC: New api for gas changes

Jef Driesen jef at libdivecomputer.org
Fri May 22 07:34:45 PDT 2015


Hi,

I have been working on a new api for gas changes. The idea is that old 
gas change events (SAMPLE_EVENT_GASCHANGE and SAMPLE_EVENT_GASCHANGE2) 
will be replaced with a new DC_SAMPLE_GASMIX sample. The corresponding 
sample data is an integer with the index of the gas mix. The actual 
oxygen and helium percentages can be retrieved with the DC_FIELD_GASMIX 
api. The main advantage over the old events, is that the gas mix index 
allows to distinguish two identical gas mixes.

I have attached two patches. The first patch contains the new api, and 
with the second patch all backends are ported to the new api.

Please note that applying these patches will break existing 
applications. They will still build, but they will no longer get any gas 
change events. In order to maintain backwards compatibility, I'm 
planning to introduce the new api as follows: The old events will get 
marked as deprecated, but not removed yet. That ensures existing 
applications will continue to work with no changes. In the meantime, 
applications can start to use the new api. And once v0.5 is out, the old 
events will be removed.

Comments are welcome!

PS: I'm leaving tonight for a diving trip, so I probably won't be able 
to respond to questions or comments during the next week.

Jef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-support-for-the-active-gas-mix.patch
Type: text/x-diff
Size: 1827 bytes
Desc: not available
URL: <http://libdivecomputer.org/pipermail/devel/attachments/20150522/e59aecea/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Port-the-backends-to-the-new-gasmix-sample.patch
Type: text/x-diff
Size: 15638 bytes
Desc: not available
URL: <http://libdivecomputer.org/pipermail/devel/attachments/20150522/e59aecea/attachment-0001.patch>


More information about the devel mailing list