Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developer Data Field - Trouble Set Up for encoding Fields #23

Open
app4g opened this issue Dec 29, 2022 · 2 comments
Open

Developer Data Field - Trouble Set Up for encoding Fields #23

app4g opened this issue Dec 29, 2022 · 2 comments

Comments

@app4g
Copy link

app4g commented Dec 29, 2022

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 (

func testFieldDescriptionMessage() {
) and found some pointer to use the FieldDescriptionMessage but then got into trouble in getting the BaseTypeData

Screenshot 2022-12-30 at 7 09 03 AM

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).

@khoogheem
Copy link
Member

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.

@app4g
Copy link
Author

app4g commented Jan 2, 2023

I see.. thanks for the update. I'll see if I can figure it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants