Qt HMIs - KDAB

10

Transcript of Qt HMIs - KDAB

Page 1: Qt HMIs - KDAB
Page 2: Qt HMIs - KDAB

p.2

WhatisQtAuto

QtIVI-ExtendableCrossPlatformAPIs

CodeGeneration

IntegrationwithGammaray

p.3

QtHMIseasytoimplementstunninguserinterfacewithseamlessintegrationof2Dand3DcontentscalestodifferenthardwareandcanleverageGPU-basedrenderingforsmooth60fpsexperienceevenonhigh-resolutionscreenseasytousedeclarativeUIdescriptionlanguagewithgraphicaltooling,aswellasC++APIsforfullnativepowerwhereneeded

QtAutomativeSuitemodularvehicledataandmultimediaAPIwithcomprehensivesimulationbackendsenabledevelopmentbeforehardwareisavailablemulti-processarchitecturewithapplifecyclemanagementandsecurityenablingamodernmodularHMIdesignandsafeintegrationof3rd-partyapplicationsreferenceHMIimplementation

p.4 p.5

Toolingsupportforemulatedoron-targetdevelopmentsupportforquicktargetdeploymentandlivedevelopmentanddebuggingontargethigh-levelandvisualdiagnostictoolsenablingeffectiveanalysisofcomplexbugsorperformanceissues

CustomSDKensureeveryoneusingexactlythesamesetuptoavoidintegrationproblemssingleinstallerwithonlineupdatesupporttoefficientlydeployyourdevelopmentsetupincludein-houseor3rdpartyframeworks

Page 3: Qt HMIs - KDAB

p.6 p.7

p.8 p.9

Page 4: Qt HMIs - KDAB

p.10

FeatureAbstractionProvidesupportformultiplefeatures:climatecontrol,mediaservices,...ConsistantfrontendAPIMultiplemanufacturerbackend

CoreLibraryAbstractfeatures,includingsupportforzoningFrontend/BackendsetupwithdynamicpluginloadingTargetmultipleconfigurationsfordeployment,simulation,testing,...

C++andQMLinterface

Referenceimplementations

p.11

p.12

AFeatureisanAPItoasubsetoffunctionalityderivedfromQIviAbstractFeatureandQIviAbstractZonedFeature

BackedbyaServicewhichimplementstherequiredinterfacederivedfromQIviFeatureInterfaceandQIviZonedFeatureInterface

FeaturesarehavedifferentbackendswhicharediscoveredatruntimeCallQIviAbstractFeature::startAutoDiscovery()PossibletosetthediscoverymodeusingQIviAbstractFeature::setDiscoveryMode(DiscoveryModediscoveryMode)SupportsAutoDiscovery,LoadOnlyProductionBackends,LoadOnlySimulationBackendsOruseQIviServiceManagertofindrequiredserviceobjectandtherightfeature

p.13

Featureshaveproperties,signals,slots

Dataandfunctionalityisimplementedinbackendservice

Backendservicemayperformvaliditiononincomingvalues

Willnotifyfrontendforstatechanges

1 intQIviClimateControl::fanSpeedLevel()const2 {3     Q_D(QIviClimateControl);4     returnd->m_fanSpeedLevel;5 }67 voidQIviClimateControl::setFanSpeedLevel(intfanSpeedLevel)8 {9     if(QIviClimateControlBackendInterface*backend=10             qobject_cast<QIviClimateControlBackendInterface*>(this->backend()))11         backend->setFanSpeedLevel(fanSpeedLevel,zone());12 }

Page 5: Qt HMIs - KDAB

p.14

Featureshaveproperties,signals,slots

Dataandfunctionalityisimplementedinbackendservice

Backendservicemayperformvaliditiononincomingvalues

Willnotifyfrontendforstatechanges

1 voidQIviClimateControlBackend::setFanSpeedLevel(intfanSpeedLevel)2 {3     if(m_fanSpeedLevel==fanSpeedLevel)4         return;5     if(fanSpeedLevel<=50)6         m_fanSpeedLevel=fanSpeedLevel;78     emitfanSpeedLevelChanged(m_fanSpeedLevel);9 }

p.15

Featureshaveproperties,signals,slots

Dataandfunctionalityisimplementedinbackendservice

Backendservicemayperformvaliditiononincomingvalues

Willnotifyfrontendforstatechanges

1 voidQIviClimateControlPrivate::onFanSpeedLevelChanged(intfanSpeedLevel)2 {3     Q_Q(QIviClimateControl);4     if(m_fanSpeedLevel!=fanSpeedLevel){5         m_fanSpeedLevel=fanSpeedLevel;6         emitq->fanSpeedLevelChanged(fanSpeedLevel);7     }8 }

p.16

Featuresandtheirpropertiescanbezoned

Usedforfeaturesthatareavailableinmultiplezonesofthevehicle

ListofzonesareaccessibleviaQIviAbstractZonedFeature::availableZones()

ZoneobjectsareaccessibleviaQIviAbstractZonedFeature::zoneAt()

1 QIviClimateControl*climateControl=newQIviClimateControl(QString(),this);2 climateControl->startAutoDiscovery();3 QIviClimateControl*frontLeftControl=climateControl->zoneAt("FrontLeft");

Allzoneobjectstalktothesamebackendserviceinstances

Somepropertiesmaybezoned,somenot

p.17

PropertiesarestoredasQIviPropertyobjects,valuesarestoredinQVariant

UseQIviProperty::value()togetthecurrentvalue,QIviProperty::setValue()tosetit

PossibletodefineminimumandmaximumvaluesviavirtualfunctionsQIviProperty::minimumValue()andQIviProperty::maximumValue()

QIviProperty::availableValues()returntheacceptedvalues

QIviProperty::isAvailable()givesinformationaboutthepropertybeingavailableinthebackend

PropertyattributesareaccessibleasQMLgroupedproperties,likemyProperty.available,myProperty.value,etc.

DeprecatedNottypesafeLotsofoverheadValidrangesonlyapplytosmallsubsetofpropertiesAvailabilitytendstobestatic

Page 6: Qt HMIs - KDAB

p.18

LotsofcodetowriteFrontend,alltheproperties,listeningtobackendchangesOneormorebackendsProductionbackendtalkingtotheactualvehicleSimulationbackendhandlingmockdataHandlingperzonevalues,validranges,etc

Repeatforeachinterface

Couldthisbeautomated?

p.19

DefineinterfaceName,properties,signals,slotsAssociatedenumsandstructuresMetadataaboutranges,validvalues,defaultvalues,zones...

UsegeneratorsFrontendgeneratorforthefeatureAPIandabstractbackendinterfaceBackendsimulatorgeneratorsupportingdefaultvalues,validitychecks,etc

p.20

QFace-https://github.com/Pelagicore/qface

IDLdesignedtosupportQtrelatedfeaturessuchasproperties,signals,slots,models...basicdatatypes,structs,enumsandflagsannotationtoprovidemeta-dataaboutmodules,interfaces,properties...structuredcomments

GeneratorPython3+ANTLRbasedparserJinja2basedtemplatesWalkthedomainmodelandproducetherequiredoutputusingthetemplates

TemplatesFrontendandbackendtemplatestogeneratecode

p.21

1 moduleorg.example1.023 interfaceEcho{4     stringmessage;5     readonlyStatusstatus;6     voidecho(stringmessage);7     signalbroadcast(stringmessage);8 }910 enumStatus{11     Null,Loading,Ready,Error12 }

1 classEcho:publicQObject2 {3     Q_OBJECT4     Q_PROPERTY(QStringmessageREADmessageWRITEsetMessageNOTIFYmessageChanged)5     Q_PROPERTY(Example::StatusstatusREADstatusNOTIFYmessageChanged)6 public:7     QStringmessage()const;8     voidsetMessage(constQString&message);9     ...10     Q_INVOKABLEvoidecho(QStringmessage);11 signals:12     voidmessageChanged(constQString&message);13     voidbroadcast(QStringmessage);14 };

Page 7: Qt HMIs - KDAB

p.22

1 module<module><version>2 import<module><version>34 interface<Identifier>{5     [const][readonly]<type><identifier>6     <type><operation>(<parameter>*)[const]7     signal<signal>(<parameter>*)8 }910 struct<Identifier>{11     <type><identifier>;12 }1314 enum<Identifier>{15     <name>[=<value>],16 }1718 flag<Identifier>{19     <name>[=<value>],20 }

Builtintypes:bool,int,real,string,var

Models(andlists)

Structured(JavaDoc)comments

p.23

Allelementscanbeannoted1 @singleton:true2 @config:{port:1234}3 interfaceEcho{4 }

Singlevalueorcompound

CompountvaluesuseYAMLsyntax

Externalannotations(.yamlfile)1 org.example.Echo:2     service:3         port:12345

Onlyrelevanttothegenerator

p.24

EntiremoduledefinedinsingleQFacefile

Definescommonannotations1 @config:{qml_name:"QtIvi.VehicleFunctions",\2             interfaceBuilder:"vehicleFunctionsInterfaceBuilder"}3 moduleQtIviVehicleFunctions1.0;45 @config:{zoned:true,id:"org.qt-project.qtivi.ClimateControl/1.0",\6             qml_type:"ClimateControl"}7 interfaceQIviClimateControl{8     /**9      *Holdswhethertheairconditioningisenabled.10      */11     @config:{getter_name:"isAirConditioningEnabled"}12     boolairConditioningEnabled;1314 ...

ivivehiclefunctions.qface

ivivehiclefunctions.yaml

p.25

Traversethedocumentmodeltogeneratefiles1 formoduleinsytem.modules:2     #generatemodulerelatedfiles...34     forinterfacesinmodule.interfaces:5         #generateinterfacerelatedfiles...67     forstructinmodule.structs:8         #generateinterfacerelatedfiles...

JINJAbasedtemplatedocuments

YAMLfiletodescribewhichtemplatefiletouseforeachobjectinthedocumentmodel

generator.py--formatfoobar.qfaceout_dir

Predefinedformats:frontend,createsQIviAbstractFeatureandQIviAbstractZonedFeaturebasedclassesandhelperbackend_simulatorcreatesQIviFeatureInterfaceandQIviZonedFeatureInterfacebasedclasseswithalldataandoperationscontrol_panelcreatestestapp(morelater)

Page 8: Qt HMIs - KDAB

p.26

Annotationdefinevalidranges,minimum/maximumvalues,domains...1 interfaceQIviClimateControl{2     @config_simulator:{range:[0,50]}3     intfanSpeedLevel;4     @config_simulator:{minimum:0}5     intsteeringWheelHeater;6     @config_simulator:{maximum:30.0}7     realtargetTemperature;8     @config_simulator:{domain:["cold","mild","warm"]}9     stringoutsideTemperatureLabel;10 ...

Usedinbackend_simulatorgeneratortotestincomingvalues

InformationisstoredinclassmetadataasJSON1 classQIviClimateControl:publicQIviAbstractZonedFeature{2     Q_OBJECT3     Q_CLASSINFO("IviPropertyDomains","{\4             \"iviVersion\":2.0,\5             \"fanSpeedLevel\":{\"range\":[0,50]},\6             \"steeringWheelHeater\":{\"minimum\":0},\7             \"targetTemperature\":{\"maximum\":30.0},\8             \"outsideTemperatureLabel\":{\"domain\":[\"cold\",\"mild\",\"warm\"]}\9         }")10 public:11     ...

p.27

QMakehasbeenextendedtosupportQFacefilesanddrivethecodegeneration

Generatorcreatescodeand.prifiles,notoverallproject1 CONFIG+=ivigenerator23 QFACE_FORMAT=backend_simulator4 QFACE_SOURCES=ivivehiclefunctions.qface5 QFACE_MODULE_NAME=QtIviVehicleFunctions

p.28

Backendclassesonlycontaindefaultdatamembers

Operationsonlyhavedefaultimplementations

Fullfunctionalityneedsspecialisation

Canprovidegeneratorfunctiontocreatederivedinstances

Annotationappliedtomodule:@config:{interfaceBuilder:"vehicleFunctionsInterfaceBuilder"}

1 externQVector<QIviFeatureInterface*>2     vehicleFunctionsInterfaceBuilder(QtIviVehicleFunctionsPlugin*plugin)3 {4     constQStringListinterfaces=plugin->interfaces();5     QVector<QIviFeatureInterface*>res;6     Q_ASSERT(interfaces.size()==2);7     Q_ASSERT(interfaces.indexOf(QtIviVehicleFunctions_QIviClimateControl_iid)==0);8     Q_ASSERT(interfaces.indexOf(QtIviVehicleFunctions_QIviWindowControl_iid)==1);9     res<<newQIviClimateControlBackend(plugin);10     res<<newQIviConcreteWindowControlBackend(plugin);11     returnres;12 }

p.29

Canmorecodebegenerated?

Forbackend,canmorelowlevelintegrationcodebegenerated?

Addspecialannotationsandcustomizethetemplates!

QFACE_SOURCEScanbeapathtoatemplatefolder,requiresamatchingYAMLfile

Generatetests,sampleUIs,...

Page 9: Qt HMIs - KDAB

p.30

BasedonQtSimulatorPartofBoot2Qt(nottheoldsimulator-qt,notthenewqt-emulator)UsedbyvariousQtmodules(location,...)

control_paneltemplategeneratesapplicationMirrorsbackendbehaviourUsefulfortestingapplicationinabsenceoffullfeaturedbackend

p.31

p.32 p.33

Page 10: Qt HMIs - KDAB

p.34

Gammaray'sIVImoduleprovidesintrospection

ObserveandmodifypropertyvaluesfromQIviAbstractFeaturederivedclasses

AlsosupportoverridingChangevaluessentfromthebackendModifyvalueswithoutaffectingthebackend

Usefultotestapplicationbehaviourinisolationofanybackend

p.35

QtIVI,libraryandtoolsforintegratingvehiclefunctionsinQtapplications

IDLandcodegeneratormassivelysimplifythecreationofthegluecode

Toolingfortesting,debuggingandprofiling

Thankyou!

www.kdab.com

[email protected]