mavlink/qgroundcontrol — pull request #1080 by DonLakeFlyer (2014-12-08 04:02:21+00:00)
Title: New FactSystem

The components of the FactSystem are a Fact which holds an individual value. FactMetaData holds additional meta data associated with a Fact such as description, min/max ranges and so forth. The FactValidator object is a QML validator which validates input according to the FactMetaData settings. Client code can then use this system to expose sets of Facts to QML code.

The first set of Facts exposed by the FactSystem are parameters. This can be seen in the PX4ParameterFacts object which is part of the PX4 AutoPilot plugin. It exposes the parameters to QML such that you can bind QML ui elements directly to parameters. At this point Parameter Facts sit to the side of the Parameter Manager and maintain a duplicate list of parameters. This is to initially cause the least impact to the codebase. There are no changes to the existing mechanism client code uses to access facts. Long term, the FactSystem will replace the Parameter Manager and provide the single set of parameters in the system and also handle comms with the board.

There is also a set of FactSystem QML components. The first of which is FactTextInput. This is a thin wrapper derived from TextInput. Here is an example usage:

FactTextInput {
text: parameterFacts.RC_MAP_THROTTLE.value
validator: FactValidator { fact: parameterFacts.RC_MAP_THROTTLE; }
}

As the RC_MAP_THROTTLE value changes, it will also change in the ui. When you change the value by typing in the control it will be validated according to the meta data associated with the Fact (type, min/max so far). Parameter FactMetaData comes from the parameters.xml file generated by the firmware. If it passes validation, hitting enter or tabbing out will set the value back into the parameter and be sent back to the board.

Coming:
- The next set of Facts to be implemented will expose mavlink telemetry values as Facts.
- More QML components
- Support for a Palette which allows the light/dark styling
- Safety Config will the first main screen that will be implemented using this new system