Developer Data Field - Trouble Set Up for encoding Fields
I would like to encode some fields/data into the developer data fields. I see that FitDataProtocol supports it.
I have been able to get the developerID to be encoded but am stuck in the fields.
var encodeableMessages = [FitMessage]()
let appUUID = "xxxxxxx-zzzzz-xxxx-xxxx-xxxxxxxxxx"
let appUUIDByte = Data(appUUID.utf8)
let devIdMsg = DeveloperDataIdMessage(developerId: nil,
applicationId: appUUIDByte,
applicationVersion: 110,
manufacturer: Manufacturer.unknown,
dataIndex: 0)
encodeableMessages.append(devIdMsg)
I looked at the XCTests (https://github.com/FitnessKit/FitDataProtocol/blob/7d62bfd0027decb50f2e95c801f3ea30a011fb61/Tests/FitDataProtocolTests/FitMessageTests.swift#L243) and found some pointer to use the FieldDescriptionMessage but then got into trouble in getting the BaseTypeData
Any help would be appreciated
This is what I found from Garmin's FitSDK CookBook
// Create the Developer Id message for the developer data fields.
let developerIdMesg = FITDeveloperDataIdMesg();
// It is a BEST PRACTICE to reuse the same Guid for all FIT files created by your platform
// "00010203-0405-0607-0809-0A0B0C0D0E0F"
let appId: [UInt8] = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f]
for byte in appId {
developerIdMesg.setApplicationId(byte, for: byte)
}
developerIdMesg.setDeveloperDataIndex(0);
developerIdMesg.setApplicationVersion(110);
messages.append(developerIdMesg);
// Create the Developer Data Field Descriptions
let doughnutsFieldDescMesg = FITFieldDescriptionMesg();
doughnutsFieldDescMesg.setDeveloperDataIndex(0);
doughnutsFieldDescMesg.setFieldDefinitionNumber(0);
doughnutsFieldDescMesg.setFitBaseTypeId(FITFitBaseTypeFloat32);
doughnutsFieldDescMesg.setFieldName("Doughnuts Earned", for:0);
doughnutsFieldDescMesg.setUnits("doughnuts", for:0);
doughnutsFieldDescMesg.setNativeMesgNum(FITMesgNumSession);
messages.append(doughnutsFieldDescMesg);
Do you have any samples of encoding any form of Developer Fields that you can share? I'm not even sure how to get the developer field record messages to be encoded as well. (based on Garmin CookBook, developer fields is just appended to the recordMessages).
It has minimal support for Developer data.. we do decode it if found.
The adding data to messages.. was never really completed.. as it was not needed in the projects that I built this originally for.
I see.. thanks for the update. I'll see if I can figure it out