A couple of suggestions for your attribute printing functions

The current printAttribute() function has no default case for the switch statement, so if an unhandled attribute ID is passed to it, nothing gets printed out. I recommend adding a default case, such as the following:

        printAttr8(label, "UNKNOWN ATTRIBUTE", attributeId, valueLen, value);

After I added this to my code I discovered that I had forgotten to include a case block for an attribute I had added.

Also, I noticed that the getPrintAttrHeader() function does nothing with the attributeId parameter that is passed to it. I modified the function so it includes the following:

snprintf(attr_print_buffer, ATTR_PRINT_BUFFER_LEN, 
         "%s id: %s (%05d) len: %05d value: ", sourceLabel, attrLabel, attributeId, valueLen);

The benefit of this is that if (assuming the default case has been added to printAttribute()) an unknown attribute is printed, the ID code gets printed out to help you figure out what the attribute is.



Hey Dave,

Those are good tips! We actually kind of intentionally drop unknown attributes on the floor in that demo app, when the ASR boots it will send notifications to the MCU of all of it’s attributes and their default values, and then when the ASR connects it’ll send updated values if any of them are changed by the Cloud. This can be a little spammy for users who are first starting out with the platform, so we limit the attribute updates the app shows to the ones it cares about.

I have another app that I’m working on that will be included in afLib eventually that actually processes and dumps all the attributes the MCU can get from the Cloud, with a little added bonus code that will parse the attributes for actual values if they’re something other than just numeric values (like parsimg timestamps and GPIO config bits, and junk like that). I’m hoping to get it into the next update to afLib.