Parlay Firmware design

Design Overview 

The Parlaytm firmware codebase uses a C++ object oriented, single threaded, event driven architecture.  It has a clear and repeated and extensible Active Object design pattern for easy project implementation and maintenance. This single threaded architecture prevents the threading and blocking perils that can cause intermittent instabilities. It also supports full software instrumentation - with external control and visibility throughout.

The Parlaytm instrumentation is accomplished by providing message based interface to the functions and variables of the C++ class. A preprocessor identifies those functions and variables that should be accessible, and generates the code to interface. In this manner, the internal member functions and variables can be called, set and streamed.

Main Elements

There are 4 main design elements:

  • Items - C++ object that can receive messages.  The codebase is comprised of items - from controllers to drivers.
  • Messages - a structure of data that is passed between items. Messages are of type order, response, and notification. Messages can be sent to/from remote or internal items.
  • Message Pump - A special singleton item that handles the message queue, and routes the messages to the proper recipient.  This item also manages timed events, and routing responses to callback functions.
  • Preprocessor - Scans the codebase to generate the discovery information of commands and properties of Items.

The Message Pump

Messages provide the intra-communications between items in the system. For example, a controller will send a message to a SPI based sensor driver to read an ADC. When the data is received a response message is sent back to the original caller with the data. 

Software Instrumentation Built In

Just as intra-communications uses messages, the same method is used for inter-communications between sub-systems, and the Parlay test tool. The functions and variables of each Item of each subsystem are "discovered", and made accessible as commands and properties respectively. This allows for external control of components, and monitoring of data - i.e. instrumentation. Command messages will result in the item function being called, and upon its completion, a response message is returned. Properties, which are member variables of the item, can be read, set, or streamed (as they get written or at a desired rate) . The Parlaytm UI allow the user to choose the item, and the item's commands or properties to control.

The items in a subsystem are hierarchical - generally each item controls the items of the next level. However from  Parlaytm test UI, all items can be accessed. For example,  a temperature control item can be started with a chosen target temperature. The subsequent thermister sensor response can be streamed and graphed live on the PC.

Communications

The embedded codebase communicates with the above described message which is the same over all communications links. The packaging of the message may change from protocol to protocol, but the content is always a messages. Unless the codebase is communicating to other embedded system, the communications on the other side will handle the discovery of items and translation of the message structure to a JSON message.  For example, a typical system would look like the following:

For Bluetooth BLE communications, the BLE characteristics are translated into the message protocol of the firmware, making simple, discoverable controls from a mobile device.

For multiple subsystems in a system, the following scheme could be applied:

No matter the complexity of the system, the commands and properties of all system Items are accessible and controllable from the Parlay UI and scripting.

About Promenade Software

Promenade Software, Inc. specializes in software development for medical devices and other safety-critical applications.

Contact

Promenade Software, Inc.
16 Technology Drive, Suite 100
Irvine, CA 92618, U.S.A.
info@promenadesoftware.com
(949) 333-4634
Contact Form

© 2018 Promenade Software, Inc.