Bridging the chasm between HTML5 and the hardware with PPS messaging
Writing specific interfaces to communicate between the HMI and each low-level service is a costly—and likely unsustainable—proposal. A better approach is to use an HMI-agnostic, asynchronous messaging model such as Persistent Publish/Subscribe (PPS). A service for pushing out changes and receiving notifications, PPS provides a simple and effective way for the HMI to communicate with low-level componentst and the vehicle hardware.
Drawing on our experience building in-vehicle systems, we will describe how a PPS messaging model facilitates communication between an HTML5 HMI and low-level components.The problem
With HTML5 becoming the HMI technology of choice, the problem facing system architects, then, is finding or devising a light-weight messaging model that bridges the gap between the HTML5 layer and disparate low-level components. Further, since a) many systems must be able to expand to include new devices and technologies, and b) many HMIs must accommodate applications using different HMI technologies, such as Elektrobit GUIDE and Qt, this messaging model must be open. That is, it must be able to integrate these new components and technologies, easily and efficiently.Persistent Publish/Subsribe
To understand how PPS can simplify the design of embedded applications that must support a wide range of devices and software components, as well as communicate with a sophisticated HMI, we need to look at some of the details of how PPS works.An Object-based System
The QNX implementation of PPS is an object-based service with publishers and subscribers in a loosely coupled messaging architecture. Any PPS client can be a publisher only, a subscriber only, or both a publisher and a subscriber, as required by the implementation.
PPS objects are integrated into the file system pathname space, and publishing is asynchronous. Publishers modify objects and their attributes, and write them to the filesystem. When any publisher changes an object, the PPS service informs clients subscribed to that object of the change. PPS clients can subscribe to multiple objects, and PPS objects can have multiple publishers as well as multiple subscribers. Thus, publishers with access to data that applies to different object attributes can use one object to communicate their information to all that object's subscribers.
PPS clients must know which PPS objects are of interest. If they are publishers, they must know what to publish and when; if they are subscribers, they must know to which objects they must subscribe, and which object attributes interest them. PPS clients do not have to manage errors, or buffers beyond what they need for open(), read() and write() POSIX API calls, confirming that they can make sense of what they read, and determining if they want their reads to be blocking or non-blocking.
Since PPS leverages the services of standard POSIX file systems, it can work with any programming language or application environment. A component written in one language can communicate with components written in any other language. No special knowledge of the other components is required.Persistence
A Persistent Publish/Subscribe service can maintain data across reboots. Persistence is a characteristic determined by the system designer, and is set for individual attributes.
When PPS is running it maintains its objects in memory, but saves persistent objects to appropriate storage, either on demand or at shutdown. It restores these objects on startup, either immediately, or on first access. Of course, the underlying persistent storage depends on a reliable file system and on storage media, such as a hard disk, NAND or NOR flash.
As well as ensuring data persistence across reboots, PPS can simplify startups. With many other messaging models, if a client comes up after the server, it must request up-to-date data from the server, in case something changed between the times the server and the client started up. This is also true if a client loses contact with a server, and it is true for each and every client on the system. With PPS, however, the service restores its persistent objects on startup and maintains them as they change. No matter when a client starts or reconnects it needs only to read these objects to acquire current data.System Scalability
With PPS, publisher and subscriber do not know each other; their only connection is an object that has a meaning and purpose for both of them. This messaging model gives developers great flexibility when designing a system: they can, if necessary, delay decisions on module connection points and data flow until runtime. Because such decisions are neither hardcoded nor directly linked, they can be adapted as situations or requirements evolve; they can even change dynamically as the system runs.
The loosely-coupled PPS messaging model also simplifies the integration of new software components. Since publisher and subscriber do not have to know each other, developers adding components need only to determine what these new components should publish, and what data they need other PPS clients to publish. No fine-tuning of APIs is required, and system complexity does not increase as components are added.QNX CAR 2 application platform
The QNX CAR 2 application platform offers an ideal use-case for the Persistent Publish/Subscribe messaging model. From the user's perspective, key capabilities of this platform include:
- HMI: HTML5-based HMI designed to support easy branding, reskinning and personalization
- Information and entertainment: multimedia (audio and video); AM, FM and HD radio; streaming Pandora and TuneIn internet radio; Weather Network integrated weather reporting; Apple and DLNA support for phone- and home-based media
- Automotive interfaces: climate control and virtual mechanic
- Navigation, handsfree, speech, social networking
As can be seen from the above list, and not surprisingly for an automotive infotainment platform, the QNX CAR 2 platform supports myriad applications and a wide range of low-level software components directly connected to hardware devices. It thus requires a simple and scalable messaging model to handle communications between many disparate components.
The QNX CAR 2 application platform runs on automotive reference boards that use the following CPUs: Freescale i.MX6x and the Texas Instruments Jacinto 5 and OMAP 4 and OMAP 5. Under the hood it uses a version of the QNX Neutrino realtime operation system (RTOS), which also powers RIM’s BlackBerry 10 OS and BlackBerry PlayBook tablet. The QNX Neutrino RTOS’s microkernel architecture enables the design of modular, upgradeable systems.
The PPS messaging handles communications between most system components and the HMI. Since PPS messaging is technology- and language-agnostic, only a small number of APIs is needed to provide the interfaces between the HTML5 HMI and the underlying components. Specifically:
- a PPS API handles communications between the HMI and the PPS service
- an SQL API interfaces with local media databases
- UI core APIs handle communications between the HTML5 layer and a user-interface core component, and between this component and other HMI technologies, such as Adobe AIR and Elektrobit GUIDE
As the diagram below shows, the overall architecture for the QNX CAR 2 application platform is both simple and flexible. Because the PPS messaging model is loosely coupled the system architecture is very flexible. If a new component or device is added, very little work is required; the new component must publish relevant data, and subscribe to the relevant PPS objects, while existing components must do the same for this new component if they need to communicate with it. Similarly, even changing the HMI technology would not cause great disruption in the underlying layers. All that would be required would be a change to the relevant API.
HTML5 is fast becoming not just a popular HMI technology, but the preferred environment for delivering rich, flexible user interfaces. Our experience with the QNX CAR 2 application platform has shown us that HTML is no longer just the standard for presenting web content, but a viable technology for HMIs for all sorts of applications—connected and not connected, using browser-based or HTML5 engine-only environments. We have also seen how a PPS messaging model facilitates communication between the many QNX CAR platform components, technologies and devices. Equally important, PPS enables a flexible architecture that requires relatively little work to integrate new devices and technologies.
About the author:
Andy Gryc is Senior Product Marketing Manager, Automotive for QNX Software Systems Limited. He can be reached via email@example.com
- No news
- Volvo evaluates flywheel hybrid drive - fuel savings of up to 25%
- Bosch tests automatic driving on the Autobahn
- In Formula One, Freescale is in the pole position
- Bosch highlights radar technology for safety-relevant driver assistant systems
- Toyota utilizes SPARK Pro programming language in ultra-low-defect software
- Bosch stresses high costs for lower fuel consumption
- Universal charger connects plug-in hybrids globally to the grid - as long as it is a Porsche
- TRW succeeds with electrical power steering system in China market
- Students build electric racing car
- MOST Forum sheds light on the future of automotive optical data communications