Skip to content

Commit 73e3b19

Browse files
authored
Merge pull request #66 from mikeller/update_libdivecomputer_20240725
2 parents 710fc40 + e5c6848 commit 73e3b19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1562
-363
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
CC: ${{ matrix.compiler }}
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Install dependencies
2424
run: sudo apt-get install libbluetooth-dev libusb-1.0-0-dev
2525
- run: autoreconf --install --force
@@ -30,7 +30,7 @@ jobs:
3030
run: |
3131
make install DESTDIR=$PWD/artifacts
3232
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr
33-
- uses: actions/upload-artifact@v3
33+
- uses: actions/upload-artifact@v4
3434
with:
3535
name: ${{ github.job }}-${{ matrix.compiler }}
3636
path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz
@@ -50,7 +50,7 @@ jobs:
5050
CC: ${{ matrix.compiler }}
5151

5252
steps:
53-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@v4
5454
- name: Install dependencies
5555
run: brew install autoconf automake libtool hidapi libusb
5656
- run: autoreconf --install --force
@@ -61,7 +61,7 @@ jobs:
6161
run: |
6262
make install DESTDIR=$PWD/artifacts
6363
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr
64-
- uses: actions/upload-artifact@v3
64+
- uses: actions/upload-artifact@v4
6565
with:
6666
name: ${{ github.job }}-${{ matrix.compiler }}
6767
path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz
@@ -78,7 +78,7 @@ jobs:
7878
arch: [i686, x86_64]
7979

8080
steps:
81-
- uses: actions/checkout@v3
81+
- uses: actions/checkout@v4
8282
- name: Install dependencies
8383
run: sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 mingw-w64-tools
8484
- name: Install libusb
@@ -118,7 +118,7 @@ jobs:
118118
run: |
119119
make install DESTDIR=$PWD/artifacts
120120
tar -czf ${{ github.job }}-${{ matrix.arch }}.tar.gz -C artifacts usr
121-
- uses: actions/upload-artifact@v3
121+
- uses: actions/upload-artifact@v4
122122
with:
123123
name: ${{ github.job }}-${{ matrix.arch }}
124124
path: ${{ github.job }}-${{ matrix.arch }}.tar.gz
@@ -161,13 +161,13 @@ jobs:
161161
runs-on: ubuntu-latest
162162

163163
steps:
164-
- uses: actions/checkout@v3
164+
- uses: actions/checkout@v4
165165
- run: |
166166
autoreconf --install --force
167167
./configure --prefix=/usr
168168
make -C src revision.h
169169
- run: $ANDROID_NDK/ndk-build -C contrib/android NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk
170-
- uses: actions/upload-artifact@v3
170+
- uses: actions/upload-artifact@v4
171171
with:
172172
name: ${{ github.job }}
173173
path: contrib/android/libs

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: Release
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313

1414
- name: Version number
1515
id: version

contrib/android/Android.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ LOCAL_SRC_FILES := \
7171
src/oceans_s1_parser.c \
7272
src/packet.c \
7373
src/parser.c \
74+
src/pelagic_i330r.c \
7475
src/platform.c \
7576
src/rbstream.c \
7677
src/reefnet_sensus.c \

contrib/msvc/libdivecomputer.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
<ClCompile Include="..\..\src\oceans_s1_parser.c" />
240240
<ClCompile Include="..\..\src\packet.c" />
241241
<ClCompile Include="..\..\src\parser.c" />
242+
<ClCompile Include="..\..\src\pelagic_i330r.c" />
242243
<ClCompile Include="..\..\src\platform.c" />
243244
<ClCompile Include="..\..\src\rbstream.c" />
244245
<ClCompile Include="..\..\src\reefnet_sensus.c" />
@@ -357,6 +358,7 @@
357358
<ClInclude Include="..\..\src\oceans_s1_common.h" />
358359
<ClInclude Include="..\..\src\packet.h" />
359360
<ClInclude Include="..\..\src\parser-private.h" />
361+
<ClInclude Include="..\..\src\pelagic_i330r.h" />
360362
<ClInclude Include="..\..\src\platform.h" />
361363
<ClInclude Include="..\..\src\rbstream.h" />
362364
<ClInclude Include="..\..\src\reefnet_sensus.h" />

examples/common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static const backend_table_t g_backends[] = {
7272
{"vtpro", DC_FAMILY_OCEANIC_VTPRO, 0x4245},
7373
{"veo250", DC_FAMILY_OCEANIC_VEO250, 0x424C},
7474
{"atom2", DC_FAMILY_OCEANIC_ATOM2, 0x4342},
75+
{"i330r", DC_FAMILY_PELAGIC_I330R, 0x4744},
7576
{"nemo", DC_FAMILY_MARES_NEMO, 0},
7677
{"puck", DC_FAMILY_MARES_PUCK, 7},
7778
{"darwin", DC_FAMILY_MARES_DARWIN, 0},

examples/output_xml.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,27 @@ dctool_xml_output_write (dctool_output_t *abstract, dc_parser_t *parser, const u
489489
break;
490490
fprintf (output->ostream, "<extradata key='%s' value='%s' />\n",
491491
str.desc, str.value);
492+
}
492493

494+
// Parse the GPS location.
495+
message ("Parsing the GPS location.\n");
496+
dc_location_t location = {0};
497+
status = dc_parser_get_field (parser, DC_FIELD_LOCATION, 0, &location);
498+
if (status != DC_STATUS_SUCCESS && status != DC_STATUS_UNSUPPORTED) {
499+
ERROR ("Error parsing the GPS location.");
500+
goto cleanup;
501+
}
502+
503+
if (status != DC_STATUS_UNSUPPORTED) {
504+
fprintf (output->ostream,
505+
"<location>\n"
506+
" <latitude>%.6f<latitude>\n"
507+
" <longitude>%.6f</longitude>\n"
508+
" <altitude>%.2f<altitude>\n"
509+
"</location>\n",
510+
location.latitude,
511+
location.longitude,
512+
convert_depth(location.altitude, output->units));
493513
}
494514

495515
// Parse the sample data.

include/libdivecomputer/ble.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ extern "C" {
3333
*/
3434
#define DC_IOCTL_BLE_GET_NAME DC_IOCTL_IOR('b', 0, DC_IOCTL_SIZE_VARIABLE)
3535

36+
/**
37+
* Get the bluetooth authentication PIN code.
38+
*
39+
* The data format is a NULL terminated string.
40+
*/
41+
#define DC_IOCTL_BLE_GET_PINCODE DC_IOCTL_IOR('b', 1, DC_IOCTL_SIZE_VARIABLE)
42+
43+
/**
44+
* Get/set the bluetooth authentication access code.
45+
*
46+
* The data format is a variable sized byte array.
47+
*/
48+
#define DC_IOCTL_BLE_GET_ACCESSCODE DC_IOCTL_IOR('b', 2, DC_IOCTL_SIZE_VARIABLE)
49+
#define DC_IOCTL_BLE_SET_ACCESSCODE DC_IOCTL_IOW('b', 2, DC_IOCTL_SIZE_VARIABLE)
50+
3651
#ifdef __cplusplus
3752
}
3853
#endif /* __cplusplus */

include/libdivecomputer/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ typedef enum dc_family_t {
7878
DC_FAMILY_OCEANIC_VTPRO = (4 << 16),
7979
DC_FAMILY_OCEANIC_VEO250,
8080
DC_FAMILY_OCEANIC_ATOM2,
81+
DC_FAMILY_PELAGIC_I330R,
8182
/* Mares */
8283
DC_FAMILY_MARES_NEMO = (5 << 16),
8384
DC_FAMILY_MARES_PUCK,

include/libdivecomputer/parser.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ typedef enum dc_field_type_t {
6969
DC_FIELD_DIVEMODE,
7070
DC_FIELD_DECOMODEL,
7171
DC_FIELD_STRING,
72+
DC_FIELD_LOCATION,
7273
} dc_field_type_t;
7374

7475
// Make it easy to test support compile-time with "#ifdef DC_FIELD_STRING"
@@ -279,6 +280,18 @@ typedef struct dc_field_string_t {
279280
const char *value;
280281
} dc_field_string_t;
281282

283+
/*
284+
* GPS Location
285+
*
286+
* The latitude and longitude are in decimal degrees, and the (optional)
287+
* altitude in meters.
288+
*/
289+
typedef struct dc_location_t {
290+
double latitude;
291+
double longitude;
292+
double altitude;
293+
} dc_location_t;
294+
282295
typedef union dc_sample_value_t {
283296
unsigned int time; /* Milliseconds */
284297
double depth;

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ libdivecomputer_la_SOURCES = \
4343
oceanic_atom2.h oceanic_atom2.c oceanic_atom2_parser.c \
4444
oceanic_veo250.h oceanic_veo250.c oceanic_veo250_parser.c \
4545
oceanic_vtpro.h oceanic_vtpro.c oceanic_vtpro_parser.c \
46+
pelagic_i330r.h pelagic_i330r.c \
4647
mares_common.h mares_common.c \
4748
mares_nemo.h mares_nemo.c mares_nemo_parser.c \
4849
mares_puck.h mares_puck.c \

0 commit comments

Comments
 (0)