Skip to content

Commit de90d9a

Browse files
authored
Merge pull request #33 from flokli/no-application-id
records: allow developer_data_id messages without set application_id
2 parents 96cb3e5 + bb54ac8 commit de90d9a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

fitparse/records.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,10 @@ def parse_string(string):
363363
def add_dev_data_id(message):
364364
global DEV_TYPES
365365
dev_data_index = message.get('developer_data_index').raw_value
366-
application_id = message.get('application_id').raw_value
366+
if message.get('application_id'):
367+
application_id = message.get('application_id').raw_value
368+
else:
369+
application_id = None
367370

368371
# Note that nothing in the spec says overwriting an existing type is invalid
369372
DEV_TYPES[dev_data_index] = {'dev_data_index': dev_data_index, 'application_id': application_id, 'fields': {}}
Binary file not shown.

tests/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,11 @@ def test_fileish_types(self):
409409
with FitFile(io.BytesIO(open(testfile("Settings.fit"), 'rb').read())):
410410
pass
411411

412+
def test_elemnt_bolt_developer_data_id_without_application_id(self):
413+
"""Test that a file without application id set inside developer_data_id is parsed
414+
(as seen on ELEMNT BOLT with firmware version WB09-1507)"""
415+
FitFile(testfile('elemnt-bolt-no-application-id-inside-developer-data-id.fit')).parse()
416+
412417
# TODO:
413418
# * Test Processors:
414419
# - process_type_<>, process_field_<>, process_units_<>, process_message_<>

0 commit comments

Comments
 (0)