Closed stefanhp closed 5 years ago
I have not yet had the need for Developer Fields.. so I have not spent a lot of time trying to get at them. The problem is that Given they are Developer Specific It is hard to add it to the base lib
Option would be to use a Subclass of the RecordMessage and provide your own decodes for the dev data. and then decode the fieldData.developerFieldData
based on the definitions.
The other option is I need to look at a few fit files with Dev Data and try and provide back some dictionary of the decoded results.. I have one fit file right now with dev data but if you have some you are willing to share with me so I can work on a solution that would be great
I will be pushing up some updates into master.. I wait to tag and get a Pod update out.. but should have Dev data support...
Right now it is pretty manual but you can extract the dev data from the Messages. I will look into doing it more automagically later. Probably with the Swift5.1 Release as I have a bunch of changes that I want to do to reduce the amount of code overall.
try decoder.decode(data: fileData,
messages: FitFileDecoder.defaultMessages,
decoded: { (message: FitMessage) in
if let message = message as? RecordMessage {
if let dev = self.fieldDescription {
if let devData = message.developerData {
for devtype in devData {
switch dev.decodeDouble(developerData: devtype) {
case .success(let value):
print("Value: \(value) \(dev.units)")
case .failure(let error):
print(error.localizedDescription)
}
}
}
}
self.records.append(message)
}
if let message = message as? FieldDescriptionMessage {
self.fieldDescription = message
print("mssage", message)
}
}
Hi @khoogheem,
Thank you for looking into this, and sorry I did not get back sooner: I had a few days off.
I now get FieldDescriptionMessage properly, but I'm not able to decode the values properly. I can send you an example file privately, I'd rather not share it publicly because there are user and position data in it. Can I use the your email address found in public commits?
Thanks, Stefan
yah.. you can send it over.. I will test it then destroy it.
Hi,
Changes in commit 37e38bdb2cdb02b7dbca066374a0d78114e4b37d work perfectly!
Thanks, Stefan
Good to hear.. I will tag it then
Hi,
I have FIT files that include some developer fields in RecordMessage messages. For example
developer_Power
,developer_Vertical Oscillation
ordeveloper_Form Power
.Since the RecordMessage is only holding values for keys in
FitCodingKeys
how could I access those entries?If not, what would be the best way to implement this?
Thanks, Stefan