SlideShare a Scribd company logo
1 of 27
Hexagonal
Architecture:
The Standard
for Qt
Embedded
HMIs
Burkhard Stubert
Good, Right and Successful Architectures
All architectures
Good architectures
Technically sound
Right architectures
Meeting stakeholder needs
Successful architectures
Delivering value
Hexagonal
Architecture
Start with de-facto standard
architecture and adapt it!
2021/07/08 (C) Burkhard Stubert 2
Ports-and-Adapters
Architecture
About the Importance of Architecture
2021/11/04 (C) Burkhard Stubert 3
2012
2021?
Architecture is like an iceberg. Only 1/10 is visible.
The Titanic disaster teaches us what happens
when we ignore the other 9/10.
Yours truly
Agenda
• Ports-and-Adapters Architecture
• Significant Requirements
• Machine Component
• Business Logic
• GUI Component
• Creating the Hexagon
• Conclusion
2021/11/04 (C) Burkhard Stubert 4
Ports-And-Adapters Architecture: Idea
USB
CAN
RS232
UART
(W)LAN
HDMI
PC
Port
Adapters
• Standardised USB Port
• Many USB-to-X adapters
• Different companies can build
different adapters
2021/11/04 (C) Burkhard Stubert 5
Ports-And-Adapters Architecture: Pattern
• Port = Interface between BL
(inside) and Adapters (outside)
• Adapter = Uses or implements
Port
• 1 Port has N Adapters
• Port same for all adapters
• Code from inside must not leak
to outside and vice versa
• Inside: models, connections
• Outside: Qt SerialBus, SQL, IPC
2021/11/04 (C) Burkhard Stubert 6
Business Logic
(BL)
GuiPort
MachinePort
GUI Test
Machine Simulator Mock
CLI
Product Versions over Time
2021/11/04 (C) Burkhard Stubert 7
Business
Logic
GUI
Machine
CAN
Business
Logic
GUI
Machine
Ethernet
Business
Logic
GUI
Machine
(IPC)
Product v0 Product v1 Product v2
• OTA Updates
• Ethernet instead of CAN
• Remote diagnostic
and support
• Message processing
in separate process
Development and Test Versions
2021/11/04 (C) Burkhard Stubert 8
Business
Logic
GUI
Test
Machine
Mock
Development Testing GUI
in system context
Business
Logic
GUI
Machine
Simulator
Business
Logic
GUI
Mock
Machine
Mock
Testing Updates
in system context
Agenda
• Ports-and-Adapters Architecture
• Significant Requirements
• Machine Component
• Business Logic
• GUI Component
• Creating the Hexagon
• Conclusion
2021/11/04 (C) Burkhard Stubert 9
Application Hexagon
Architecturally Significant Requirements
2021/11/04 (C) Burkhard Stubert 10
Engine
ECU
Machine
EngineTwin
BL
MainModel
GUI
MainView
Driver
CAN
Frame
Quantity
Object
Quantity 930 rpm
• Requirement
• GUI shows current engine speed.
• Constraints
• Neither GUI nor BL know that
Machine uses CAN
• BL provides C++ models for QML GUI
• GUI must not depend on Machine
Agenda
• Ports-and-Adapters Architecture
• Significant Requirements
• Machine Component
• Business Logic
• GUI Component
• Creating the Hexagon
• Conclusion
2021/11/04 (C) Burkhard Stubert 11
Machine Port with Product Adapter (CAN)
2021/11/04 (C) Burkhard Stubert 12
In product_machine.h:
QCanBusDevice *m_canBus{QCanBus::instance()
->createDevice("socketcan", "can0")};
CanBusRouter m_router{m_canBus};
EngineTwin m_engine;
In product_machine.cpp:
ProductMachine::ProductMachine()
: Machine{}
{
QObject::connect(
&m_router, &CanBusRouter::newEngineQuantities,
&m_engine, &EngineTwin::updateQuantities);
In BusinessLogic:
Machine::engine()
Engine ECU
QCanBusDevice
CanBusRouter
EngineTwin
Business Logic
can0
Machine
SocketCAN frame
QCanBusFrame
Quantity
Quantity
Quantity
Machine Port with Simulator Adapter
2021/11/04 (C) Burkhard Stubert 13
In simulator_machine.h:
CanBusSimulator m_simulator;
MockCanBusDevice m_canBus;
CanBusRouter m_router{&m_canBus};
EngineTwin m_engine;
In simulator_machine.cpp:
SimulatorMachine::SimulatorMachine()
: Machine{}
{
QObject::connect(
&m_simulator, &CanBusSimulator::newIncomingFrames,
&m_canBus, &EngineTwin::appendIncomingFrames);
QObject::connect(
&m_router, &CanBusRouter::newEngineQuantities,
&m_engine, &EngineTwin::updateQuantities);
In BusinessLogic:
Machine::engine()
CanBusSimulator
MockCanBusDevice
CanBusRouter
EngineTwin
Business Logic
Machine
QCanBusFrame
QCanBusFrame
Quantity
Quantity
Quantity
Test Adapter
2021/11/04 (C) Burkhard Stubert 14
In Machine Test:
Machine::engine()
MockCanBusDevice
CanBusRouter
EngineTwin
Machine Test
Machine
QCanBusFrame
QCanBusFrame
Quantity
Quantity
Quantity
Product Adapter (MQTT)
In BusinessLogic:
Machine::engine()
Engine ECU
QNetworkInterface
MqttRouter
EngineTwin
Business Logic
eth0
Machine
MQTT frame
QMqttMessage
Quantity
Quantity
Quantity
Creating the Machine Component
2021/11/04 (C) Burkhard Stubert 15
In machine_creator.cpp:
Machine *createMachine(Machine::Configuration conf)
{
switch (conf) {
case Machine::Configuration::Product:
return new ProductMachine{};
case Machine::Configuration::Simulator:
return new SimulatorMachine{};
...
Use createMachine in main()
Running Adapter in Thread, Process, MCU
Business Logic
MachinePort
Qt CanBus
can0 can1
Business Logic
MachinePort
Qt CanBus
can0 can1
Thread
CAN0
Thread
CAN1
Qt Signal-Slot Conn.
Business Logic
MachinePort
CAN Bus
can0 can1
Thread
CAN0
Thread
CAN1
Qt Remote
Objects
Task
CAN0
Task
CAN1
RPMsg
Process
1
on
A53
Process
1
on
A53
Process
2
on
A53
Process
1
on
A53
2
Tasks
on
M4
2021/11/04 (C) Burkhard Stubert 16
Agenda
• Ports-and-Adapters Architecture
• Significant Requirements
• Machine Component
• Business Logic
• GUI Component
• Creating the Hexagon
• Conclusion
2021/11/04 (C) Burkhard Stubert 17
Business Logic
2021/11/04 (C) Burkhard Stubert 18
In business_logic.h:
Q_PROPERTY(MainModel *mainModel READ mainModel CONSTANT)
BusinessLogic(std::shared_ptr<Machine> machine, ...
, m_machine{machine}
In business_logic.cpp:
MainModel *BusinessLogic::mainModel()
{
if (m_mainModel == nullptr) {
m_mainModel = new MainModel{this};
connect(m_machine->engine(), &EngineTwin::engineSpeed,
m_mainModel, &MainModel::setEngineSpeed);
}
return m_mainModel;
}
In MainView.qml:
BusinessLogic.mainModel
GUI
Business Logic
Machine
EngineTwin
MainModel
BusinessLogic available
as singleton in GUI
with models as properties
if (m_mainModel == nullptr) { m_mainModel = new MainModel{this}; connect(m_machine->engine(), &EngineTwin::engineSpeed, m_mainModel, &MainModel::setEngineSpeed); } return m_mainModel;
Agenda
• Ports-and-Adapters Architecture
• Significant Requirements
• Machine Component
• Business Logic
• GUI Component
• Creating the Hexagon
• Conclusion
2021/11/04 (C) Burkhard Stubert 19
GUI with Product Adapter (QML GUI)
2021/11/04 (C) Burkhard Stubert 20
In MainView.qml:
import EmUse.Models
Pane
{
property MainModel model: BusinessLogic.mainModel
Text
{
text: Number(model.engineSpeed.value).toFixed(0)
}
Text
{
text: model.engineSpeed.unit
}
MainView
Business Logic
Machine
EngineTwin
MainModel
GUI Port with Test Adapter
2021/11/04 (C) Burkhard Stubert 21
void TestMainView::init()
{
m_machine = std::make_shared<Machine>(
createMachine(Machine::Configuration::Mock));
m_businessLogic = new BusinessLogic{m_machine};
m_model = m_businessLogic->mainModel();
}
void TestMainView::testEngineSpeed()
{
Quantity rpm{930.0, "rpm"};
emit m_machine->engine()->engineSpeed(rpm);
QCOMPARE(m_model->engineSpeed()->quantity(), rpm);
}
TestMainView
Business Logic
Machine
EngineTwin
MainModel
Testing GUI in system context
• with actual BusinessLogic
• with mocks for Machine objects
Mocks reused from unit tests of
Machine and EngineTwin
Agenda
• Ports-and-Adapters Architecture
• Significant Requirements
• Machine Component
• Business Logic
• GUI Component
• Creating the Hexagon
• Conclusion
2021/11/04 (C) Burkhard Stubert 22
Composition Root main()
2021/11/04 (C) Burkhard Stubert 23
int main(int argc, char *argv[])
{
std::shared_ptr<Machine> machine{
createMachine(Machine::Configuration::Product);
};
std::shared_ptr<BusinessLogic> businessLogic{
new BusinessLogic{machine}
};
QQmlApplicationEngine appEngine;
appEngine.load(u"qrc:/main.qml"_qs);
return app.exec();
}
Agenda
• Ports-and-Adapters Architecture
• Significant Requirements
• Machine Component
• Business Logic
• GUI Component
• Creating the Hexagon
• Conclusion
2021/11/04 (C) Burkhard Stubert 24
Pros and Cons of Hexagonal Architecture
• High testability
• High modularity
• High modifiability
• High maintainability
2021/11/04 (C) Burkhard Stubert 25
Pros
• Additional complexity
Cons
Succesful architecture for Qt embedded HMIs:
Hexagonal Architecture
Resources
• Alistair Cockburn: Hexagonal Architecture. Original description of the
Hexagonal Architecture pattern.
• Juan Manuel Garrido de Paz: Ports and Adapters Pattern (Hexagonal
Architecture). Detailed explanation of the pattern.
• Burkhard Stubert: A Successful Architecture for Qt Embedded
Systems. My talk at QtDay Italy 2021.
• Burkhard Stubert: Source code for this talk.
2021/11/04 (C) Burkhard Stubert 26
🙏 Thank You 🙏
Mail: burkhard.stubert@embeddeduse.com
Web: https://embeddeduse.com
Newsletter: http://eepurl.com/gOMQoX

More Related Content

What's hot

Introduction Linux Device Drivers
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device DriversNEEVEE Technologies
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Linaro
 
Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기iFunFactory Inc.
 
はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...
はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...
はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...Netwalker lab kapper
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Writing a fast HTTP parser
Writing a fast HTTP parserWriting a fast HTTP parser
Writing a fast HTTP parserfukamachi
 
Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)fefe7270
 
LAS16-406: Android Widevine on OP-TEE
LAS16-406: Android Widevine on OP-TEELAS16-406: Android Widevine on OP-TEE
LAS16-406: Android Widevine on OP-TEELinaro
 
初學者都該了解的 HTTP 通訊協定基礎
初學者都該了解的 HTTP 通訊協定基礎初學者都該了解的 HTTP 通訊協定基礎
初學者都該了解的 HTTP 通訊協定基礎Will Huang
 
[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들NHN FORWARD
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go langAmal Mohan N
 
LCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLinaro
 
Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)fefe7270
 
Openwrt startup
Openwrt startupOpenwrt startup
Openwrt startup晓东 杜
 
Linux Porting
Linux PortingLinux Porting
Linux PortingChamp Yen
 
BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE Linaro
 
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareHKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareLinaro
 

What's hot (20)

GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Introduction Linux Device Drivers
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device Drivers
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기
 
はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...
はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...
はじめての超格安2,500円 Nexus7 2012改造と Android7.1.2 AOSP、postmarketOS in 2020 Beginner...
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Writing a fast HTTP parser
Writing a fast HTTP parserWriting a fast HTTP parser
Writing a fast HTTP parser
 
Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)
 
LAS16-406: Android Widevine on OP-TEE
LAS16-406: Android Widevine on OP-TEELAS16-406: Android Widevine on OP-TEE
LAS16-406: Android Widevine on OP-TEE
 
初學者都該了解的 HTTP 通訊協定基礎
初學者都該了解的 HTTP 通訊協定基礎初學者都該了解的 HTTP 通訊協定基礎
初學者都該了解的 HTTP 通訊協定基礎
 
[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
LCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted FirmwareLCU14 500 ARM Trusted Firmware
LCU14 500 ARM Trusted Firmware
 
Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)Android audio system(오디오 플링거 서비스 초기화)
Android audio system(오디오 플링거 서비스 초기화)
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
Openwrt startup
Openwrt startupOpenwrt startup
Openwrt startup
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE
 
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareHKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
 

Similar to Hexagonal Architecture: The Standard for Qt Embedded HMIs

Ports-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIBurkhard Stubert
 
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with QtICS
 
CURRICULUM VITAE_Balu
CURRICULUM VITAE_BaluCURRICULUM VITAE_Balu
CURRICULUM VITAE_Balubalakrishna H
 
CADISON world Issue-1-2013
CADISON world Issue-1-2013CADISON world Issue-1-2013
CADISON world Issue-1-2013CADISON
 
Bikram Jeet (Achievements from 2006 - 2013)
Bikram Jeet (Achievements from 2006 - 2013)Bikram Jeet (Achievements from 2006 - 2013)
Bikram Jeet (Achievements from 2006 - 2013)Bikram Jeet
 
Cadison world-issue-01-2013
Cadison world-issue-01-2013Cadison world-issue-01-2013
Cadison world-issue-01-2013CADISON
 
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfOpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfssuser866937
 
ECAD-MCAD Presentation 2011
ECAD-MCAD Presentation 2011ECAD-MCAD Presentation 2011
ECAD-MCAD Presentation 2011Altium
 
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...Igalia
 
Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt UsersICS
 
Modeling presentation
Modeling presentationModeling presentation
Modeling presentationAditya Dahal
 
Cad automation of electrical busbar
Cad automation of electrical busbarCad automation of electrical busbar
Cad automation of electrical busbarParthiban Kannan
 
Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...
Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...
Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...Intland Software GmbH
 
Sprint 140
Sprint 140Sprint 140
Sprint 140ManageIQ
 
Realize 2022 MINO 7 year of implementation v0.1.pptx
Realize 2022 MINO 7 year of implementation v0.1.pptxRealize 2022 MINO 7 year of implementation v0.1.pptx
Realize 2022 MINO 7 year of implementation v0.1.pptxjakobkuhn
 

Similar to Hexagonal Architecture: The Standard for Qt Embedded HMIs (20)

Ports-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
 
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
 
CURRICULUM VITAE_Balu
CURRICULUM VITAE_BaluCURRICULUM VITAE_Balu
CURRICULUM VITAE_Balu
 
UNIT 1.pdf
UNIT 1.pdfUNIT 1.pdf
UNIT 1.pdf
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
CADISON world Issue-1-2013
CADISON world Issue-1-2013CADISON world Issue-1-2013
CADISON world Issue-1-2013
 
Bikram Jeet (Achievements from 2006 - 2013)
Bikram Jeet (Achievements from 2006 - 2013)Bikram Jeet (Achievements from 2006 - 2013)
Bikram Jeet (Achievements from 2006 - 2013)
 
Mechatronics engineer
Mechatronics engineerMechatronics engineer
Mechatronics engineer
 
Cadison world-issue-01-2013
Cadison world-issue-01-2013Cadison world-issue-01-2013
Cadison world-issue-01-2013
 
GPGPU using CUDA Thrust
GPGPU using CUDA ThrustGPGPU using CUDA Thrust
GPGPU using CUDA Thrust
 
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfOpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
 
ECAD-MCAD Presentation 2011
ECAD-MCAD Presentation 2011ECAD-MCAD Presentation 2011
ECAD-MCAD Presentation 2011
 
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
 
Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt Users
 
JAYACHANDRA RESUME
JAYACHANDRA RESUMEJAYACHANDRA RESUME
JAYACHANDRA RESUME
 
Modeling presentation
Modeling presentationModeling presentation
Modeling presentation
 
Cad automation of electrical busbar
Cad automation of electrical busbarCad automation of electrical busbar
Cad automation of electrical busbar
 
Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...
Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...
Bertrandt | Automotive Best Practice: How to Design, Review, Approve, and Eff...
 
Sprint 140
Sprint 140Sprint 140
Sprint 140
 
Realize 2022 MINO 7 year of implementation v0.1.pptx
Realize 2022 MINO 7 year of implementation v0.1.pptxRealize 2022 MINO 7 year of implementation v0.1.pptx
Realize 2022 MINO 7 year of implementation v0.1.pptx
 

Recently uploaded

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Recently uploaded (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

Hexagonal Architecture: The Standard for Qt Embedded HMIs

  • 2. Good, Right and Successful Architectures All architectures Good architectures Technically sound Right architectures Meeting stakeholder needs Successful architectures Delivering value Hexagonal Architecture Start with de-facto standard architecture and adapt it! 2021/07/08 (C) Burkhard Stubert 2 Ports-and-Adapters Architecture
  • 3. About the Importance of Architecture 2021/11/04 (C) Burkhard Stubert 3 2012 2021? Architecture is like an iceberg. Only 1/10 is visible. The Titanic disaster teaches us what happens when we ignore the other 9/10. Yours truly
  • 4. Agenda • Ports-and-Adapters Architecture • Significant Requirements • Machine Component • Business Logic • GUI Component • Creating the Hexagon • Conclusion 2021/11/04 (C) Burkhard Stubert 4
  • 5. Ports-And-Adapters Architecture: Idea USB CAN RS232 UART (W)LAN HDMI PC Port Adapters • Standardised USB Port • Many USB-to-X adapters • Different companies can build different adapters 2021/11/04 (C) Burkhard Stubert 5
  • 6. Ports-And-Adapters Architecture: Pattern • Port = Interface between BL (inside) and Adapters (outside) • Adapter = Uses or implements Port • 1 Port has N Adapters • Port same for all adapters • Code from inside must not leak to outside and vice versa • Inside: models, connections • Outside: Qt SerialBus, SQL, IPC 2021/11/04 (C) Burkhard Stubert 6 Business Logic (BL) GuiPort MachinePort GUI Test Machine Simulator Mock CLI
  • 7. Product Versions over Time 2021/11/04 (C) Burkhard Stubert 7 Business Logic GUI Machine CAN Business Logic GUI Machine Ethernet Business Logic GUI Machine (IPC) Product v0 Product v1 Product v2 • OTA Updates • Ethernet instead of CAN • Remote diagnostic and support • Message processing in separate process
  • 8. Development and Test Versions 2021/11/04 (C) Burkhard Stubert 8 Business Logic GUI Test Machine Mock Development Testing GUI in system context Business Logic GUI Machine Simulator Business Logic GUI Mock Machine Mock Testing Updates in system context
  • 9. Agenda • Ports-and-Adapters Architecture • Significant Requirements • Machine Component • Business Logic • GUI Component • Creating the Hexagon • Conclusion 2021/11/04 (C) Burkhard Stubert 9
  • 10. Application Hexagon Architecturally Significant Requirements 2021/11/04 (C) Burkhard Stubert 10 Engine ECU Machine EngineTwin BL MainModel GUI MainView Driver CAN Frame Quantity Object Quantity 930 rpm • Requirement • GUI shows current engine speed. • Constraints • Neither GUI nor BL know that Machine uses CAN • BL provides C++ models for QML GUI • GUI must not depend on Machine
  • 11. Agenda • Ports-and-Adapters Architecture • Significant Requirements • Machine Component • Business Logic • GUI Component • Creating the Hexagon • Conclusion 2021/11/04 (C) Burkhard Stubert 11
  • 12. Machine Port with Product Adapter (CAN) 2021/11/04 (C) Burkhard Stubert 12 In product_machine.h: QCanBusDevice *m_canBus{QCanBus::instance() ->createDevice("socketcan", "can0")}; CanBusRouter m_router{m_canBus}; EngineTwin m_engine; In product_machine.cpp: ProductMachine::ProductMachine() : Machine{} { QObject::connect( &m_router, &CanBusRouter::newEngineQuantities, &m_engine, &EngineTwin::updateQuantities); In BusinessLogic: Machine::engine() Engine ECU QCanBusDevice CanBusRouter EngineTwin Business Logic can0 Machine SocketCAN frame QCanBusFrame Quantity Quantity Quantity
  • 13. Machine Port with Simulator Adapter 2021/11/04 (C) Burkhard Stubert 13 In simulator_machine.h: CanBusSimulator m_simulator; MockCanBusDevice m_canBus; CanBusRouter m_router{&m_canBus}; EngineTwin m_engine; In simulator_machine.cpp: SimulatorMachine::SimulatorMachine() : Machine{} { QObject::connect( &m_simulator, &CanBusSimulator::newIncomingFrames, &m_canBus, &EngineTwin::appendIncomingFrames); QObject::connect( &m_router, &CanBusRouter::newEngineQuantities, &m_engine, &EngineTwin::updateQuantities); In BusinessLogic: Machine::engine() CanBusSimulator MockCanBusDevice CanBusRouter EngineTwin Business Logic Machine QCanBusFrame QCanBusFrame Quantity Quantity Quantity
  • 14. Test Adapter 2021/11/04 (C) Burkhard Stubert 14 In Machine Test: Machine::engine() MockCanBusDevice CanBusRouter EngineTwin Machine Test Machine QCanBusFrame QCanBusFrame Quantity Quantity Quantity Product Adapter (MQTT) In BusinessLogic: Machine::engine() Engine ECU QNetworkInterface MqttRouter EngineTwin Business Logic eth0 Machine MQTT frame QMqttMessage Quantity Quantity Quantity
  • 15. Creating the Machine Component 2021/11/04 (C) Burkhard Stubert 15 In machine_creator.cpp: Machine *createMachine(Machine::Configuration conf) { switch (conf) { case Machine::Configuration::Product: return new ProductMachine{}; case Machine::Configuration::Simulator: return new SimulatorMachine{}; ... Use createMachine in main()
  • 16. Running Adapter in Thread, Process, MCU Business Logic MachinePort Qt CanBus can0 can1 Business Logic MachinePort Qt CanBus can0 can1 Thread CAN0 Thread CAN1 Qt Signal-Slot Conn. Business Logic MachinePort CAN Bus can0 can1 Thread CAN0 Thread CAN1 Qt Remote Objects Task CAN0 Task CAN1 RPMsg Process 1 on A53 Process 1 on A53 Process 2 on A53 Process 1 on A53 2 Tasks on M4 2021/11/04 (C) Burkhard Stubert 16
  • 17. Agenda • Ports-and-Adapters Architecture • Significant Requirements • Machine Component • Business Logic • GUI Component • Creating the Hexagon • Conclusion 2021/11/04 (C) Burkhard Stubert 17
  • 18. Business Logic 2021/11/04 (C) Burkhard Stubert 18 In business_logic.h: Q_PROPERTY(MainModel *mainModel READ mainModel CONSTANT) BusinessLogic(std::shared_ptr<Machine> machine, ... , m_machine{machine} In business_logic.cpp: MainModel *BusinessLogic::mainModel() { if (m_mainModel == nullptr) { m_mainModel = new MainModel{this}; connect(m_machine->engine(), &EngineTwin::engineSpeed, m_mainModel, &MainModel::setEngineSpeed); } return m_mainModel; } In MainView.qml: BusinessLogic.mainModel GUI Business Logic Machine EngineTwin MainModel BusinessLogic available as singleton in GUI with models as properties if (m_mainModel == nullptr) { m_mainModel = new MainModel{this}; connect(m_machine->engine(), &EngineTwin::engineSpeed, m_mainModel, &MainModel::setEngineSpeed); } return m_mainModel;
  • 19. Agenda • Ports-and-Adapters Architecture • Significant Requirements • Machine Component • Business Logic • GUI Component • Creating the Hexagon • Conclusion 2021/11/04 (C) Burkhard Stubert 19
  • 20. GUI with Product Adapter (QML GUI) 2021/11/04 (C) Burkhard Stubert 20 In MainView.qml: import EmUse.Models Pane { property MainModel model: BusinessLogic.mainModel Text { text: Number(model.engineSpeed.value).toFixed(0) } Text { text: model.engineSpeed.unit } MainView Business Logic Machine EngineTwin MainModel
  • 21. GUI Port with Test Adapter 2021/11/04 (C) Burkhard Stubert 21 void TestMainView::init() { m_machine = std::make_shared<Machine>( createMachine(Machine::Configuration::Mock)); m_businessLogic = new BusinessLogic{m_machine}; m_model = m_businessLogic->mainModel(); } void TestMainView::testEngineSpeed() { Quantity rpm{930.0, "rpm"}; emit m_machine->engine()->engineSpeed(rpm); QCOMPARE(m_model->engineSpeed()->quantity(), rpm); } TestMainView Business Logic Machine EngineTwin MainModel Testing GUI in system context • with actual BusinessLogic • with mocks for Machine objects Mocks reused from unit tests of Machine and EngineTwin
  • 22. Agenda • Ports-and-Adapters Architecture • Significant Requirements • Machine Component • Business Logic • GUI Component • Creating the Hexagon • Conclusion 2021/11/04 (C) Burkhard Stubert 22
  • 23. Composition Root main() 2021/11/04 (C) Burkhard Stubert 23 int main(int argc, char *argv[]) { std::shared_ptr<Machine> machine{ createMachine(Machine::Configuration::Product); }; std::shared_ptr<BusinessLogic> businessLogic{ new BusinessLogic{machine} }; QQmlApplicationEngine appEngine; appEngine.load(u"qrc:/main.qml"_qs); return app.exec(); }
  • 24. Agenda • Ports-and-Adapters Architecture • Significant Requirements • Machine Component • Business Logic • GUI Component • Creating the Hexagon • Conclusion 2021/11/04 (C) Burkhard Stubert 24
  • 25. Pros and Cons of Hexagonal Architecture • High testability • High modularity • High modifiability • High maintainability 2021/11/04 (C) Burkhard Stubert 25 Pros • Additional complexity Cons Succesful architecture for Qt embedded HMIs: Hexagonal Architecture
  • 26. Resources • Alistair Cockburn: Hexagonal Architecture. Original description of the Hexagonal Architecture pattern. • Juan Manuel Garrido de Paz: Ports and Adapters Pattern (Hexagonal Architecture). Detailed explanation of the pattern. • Burkhard Stubert: A Successful Architecture for Qt Embedded Systems. My talk at QtDay Italy 2021. • Burkhard Stubert: Source code for this talk. 2021/11/04 (C) Burkhard Stubert 26
  • 27. 🙏 Thank You 🙏 Mail: burkhard.stubert@embeddeduse.com Web: https://embeddeduse.com Newsletter: http://eepurl.com/gOMQoX

Editor's Notes

  1. Fairbanks: “Presumptive architectures are usually successful.” Good = efficient Right = effective Successful = valuable
  2. Lets transfer the hardware idea into software
  3. The PC with its USB ports becomes the business logic with several APIs or ports If we unfold the adapter-BL-adapter paths of the hexagon, we get multiple instances of 3-layer architecture
  4. The rest of the application does not notice that different ways of communications are used with machine. Remote Diagnostic/Support is just a remote GUI. Remote diagnostic could be mirrored on-board (in the GUI).
  5. This single requirement drives the architecture. Abstraction increases from left to right.
  6. ProductMachine implements the Machine interface CanBusRouter - routes messages to correct ECU twins - decodes/encodes CAN frames to/from Quantities
  7. SimulatorMachine implements the Machine interface Can be used for playing back recorded CAN traces
  8. Use #ifdef’s to get non-product relevant code out the application binary.
  9. Motivation: Avoid GUI freezes & stuttering, avoid buffer overflows How and where CAN adapters run does not matter! MachineAPI is always the same!
  10. The dependency Machine is injected in the constructor. Remove dependency on Machine, if we create ALL models in advance (none on the fly). Performance penalty!
  11. If we start reimplementing parts of MainView.qml in the test, we are violating the model-view pattern!!! Create CLI in similar way!
  12. High testability: “built-in” system and component tests based on unit tests Everything else follows from this!!! High modularity: Different teams develop different components High modifiability: Change adapters without rest of system knowing. Follows open-closed principle High maintainability: Bugs are local to component.