Before I explain more, here’s my current working version:
I started by trying to use the Device Preferences, since it seemed like the intuitive place to go in the UI. It didn’t work out. There is no way to pre-populate the UI controls with values from the current configuration. Actually, there is no way to pre-populate the controls with values at all. The defaultValue attribute has no effect; no matter the value provided, radio buttons all start unselected and value fields empty.
On top of the defaultValue issue, the settings property map that backs the inputs is not writable from the context of the command or handler methods, so that route was out.
Then there’s the fact that even though the settings map is updated when selections are made in the preferences, no event is generated nor update method called that would allow for those values to be read and sent to the lock as ConfigurationSet commands. I tried the refreshAfterSelection attribute with no success.
None of this is documented. Much printf debugging. No reflection allowed.
Can’t set settings values from code, UI doesn’t provide the opportunity to do anything with the settings updated through the UI. Not well documented, and can’t cheat by looking at the classes to see what methods and properties they expose.
I added all of the configuration state changes as commands, a handler to parse ConfigurationReport commands and made tiles to control toggling, cycling through, and setting values.
Initially used slider controls. So, yeah, here’s the thing: they have a fixed range of 0-100. That’s still useful if you’re setting a relative value like a dimmer, since you can convert the number to a proportional number in the range you actually use, but when you are trying to set specific numbers…no. I’m sure this will be remedied shortly, as this implementation was only intended as a stopgap measure. A year and a half ago.
Is there an option to directly enter a value like you can in preferences? I’m guessing not; guessing because the documentation on the different Tile types is incomplete.
So, on to using two arrow (standard) Tiles and a Value Tile to increment/decrement the value displayed by the Value Tile. This works, but is painfully slow since additional change commands are ignored until the current one has been processed. This requires more care with the layout, since you want all three Tiles on the same row. I made a blank tile to help force this, since I couldn’t find any reference to ways of controlling layout other than the ordering of the elements in the list.
For configurations with more than two, non-numeric states, I started with a Tile for each state, but ended up switching to a single Tile that cycles through the states. Purely a matter of taste. Though, it did make layout easier.
- Don’t count on using the simulator to view your labels, outside of perhaps a gross check to see if they exist.
- If you have enough Tiles that the simulator detail view extends off the bottom of the screen, you can zoom out to fit more in. However, past a certain point, the layout compresses into two columns.
- The font size makes things more difficult to read and do not improve the aesthetic appeal of my gorgeous UI design. (Android phone)
- How can I included icons with a url, as is possible for the main icon? I think the answer is that you can do so from the UI on the phone if the icons are set to be replaceable, but you cannot in the metadata.
I’m beginning to think that the UI defined via metadata is a good-enough kludge intended for crude development efforts, and that independent front-ends for the web-service are the direction in which things are being encouraged. Or not discouraged.
I’ve got more thoughts about how things fit together, but I’m out of time…