Add support for heartrate and bearing information in samples

libdivecomputer already supports this, but we didn't save it.

Tested-by: Oscar Isoz <jan.oscar.isoz@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clean up membuffer internal structure names, add strip function

The "size" member was confusing - it's the size of the allocation, not
the size of the current string.  The size of the current string is the
member called "used".

This naming makes perfect sense for the internal implementation, but
it's confusing to users who actually do want to get the size of the
resulting string at the end.

So rename the fields to "alloc" and "len" - which is pretty clear.

This also adds a helper function to strip whitespace from the end:
"strip_mb()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use 'struct membuffer' for profile info string generation

The profile info was generated using nasty string concatenation that the
membuffers are much better at anyway.  And membuffers don't need those
arbitrarily sized fixed buffers (500 bytes? Why 500 bytes?).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Profile2: Prevent a crash if no dives are present

But in general we should not show the profile of a dive that
was recently removed from the list - e.g. via File->Close.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Close search panel by button click

Connect Close button (X) to panel's hide() method.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
memory leak fix(that I created in some previous commits).

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix plot_info calculate_max_limits_new() function return value

The return value(structure) was not fully initialized, thus random data
returned for uninitialized members possibly causing random bahavior.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Improve sanity check for DivePlotDataModel::data()

Adds DivePlotDataModel row upper-boundary check (isValid method already
checks for negative values).

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix calloc parameter order.

* Set correct calloc parameters order(num, size)

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>