Forums

Software Architectures/Standards for embedded Sensor menues?

Started by Johannes Eble August 5, 2005
Hello,

I am a software engineer coming from a more higher layer background
(OOP, GUI-development), but now I will probably face an embedded
software project.

I would like to know if there exist software architectures, standards,
guidelines etc. for the menue software in a sensor device. That is,
the device consists of 3 or more keys to walk through a menu tree. The
sensor device has a display that is connected to the processor (via a
controller). I guess that devices like this one abound, so there could
be something like a standard for this.

Note that I don't mean the menu / menu tree itsself. It is more or
less fixed. What the guys here want me to do is to develop the
software handling the menue, but in a very clean and modular way. The
software should be adopted to other sensors (same processor / os, but
different menu) with minimized effort. Also, documentation, life-cycle
models (V-Model) and so on are very important in this company. They
want another guy to join a similar project with a different menue
structure. I should also lead this guy and concentrate on architecture
and design.

From what I have seen, the menue tree doesn't seem too complex.

I have first thought on something like the GoF State-Pattern or the
Command Pattern, but the programming language is c. I am not sure if
it is worth to do object oriented c, and if other programmers are used
to it.
On the other hand, I don't like (non object oriented) finite state
machines. You end up with a huge while loop that nobody will ever
understand.

Sure, there should probably be a menue part, a process part, and a
display part (something like model-view-controller).

It would be nice if there are already (defacto) standards or if
somebody of you experts could give me some advice.

The protocol between the Display controller and the Processor isn't
specified either, well, it's SPI, but this is just the hardware. I am
looking for the higher layers. Maybe there is some kind of standard
API for this as well.

The Processor is PowerPC and the OS is (embedded) Linux if that
matters. I don't seem to have run-time or space constraints.



Best regards


Johannes







Johannes Eble wrote:
> Hello, > > I am a software engineer coming from a more higher layer background > (OOP, GUI-development), but now I will probably face an embedded > software project. > > I would like to know if there exist software architectures, standards, > guidelines etc. for the menue software in a sensor device. That is, > the device consists of 3 or more keys to walk through a menu tree.
I am afraid you might have to consider the KISS design pattern;) You can described your menu with a state machine, it is perfectly understandable. menu = [state [ key; action; new state ] ] This is easily extensible and also commonly used.
Why don't you use C++ to implement the GoF state pattern?

I am pretty sure the Linux compiler does support C++.

--
EventStudio 2.5 - http://www.EventHelix.com/EventStudio
Real-time and Embedded System Modeling with Sequence Diagrams

Hi Lanarcam,

thank very much for your answer.

On 5 Aug 2005 11:36:44 -0700, "Lanarcam" <lanarcam1@yahoo.fr> wrote:

...

>I am afraid you might have to consider the KISS design pattern;)
You mean "Keep it simple", right?
> >You can described your menu with a state machine, it is >perfectly understandable. > >menu = [state [ key; action; new state ] ]
What notation do you use here and how does it translate to c? I have thought about something like: struct state { int key; void (*action)(); struct state *nextState; }; That is, a structure representing a state. The state consists of a key, a pointer to a function (i.e. action) and the next state. Then, in the main while loop: struct state *ptr_currState; ... while(...) { (*action)(); switch(ptr_currState->key) { case ....: ptr_currState->nextState = ....; break; ... } } The while loop and the main control logic will still get too complex for my taste. But at least the work is split somewhat in smaller pieces. Regards Johannes
Hi,

thanks very much for your advice.

The compiler surely supports C++, it's the standard GNU toolchain.
I'll check if I am allowed to use C++. On the other hand, I am new
here, and I don't have an overview over what part(s) of the system are
already there and in C. I don't want to mix C and C++ without a
serious reason.

I have some other ideas, e.g. to use some kind of configuration file
for the menu tree, but this is probably overkill too.


Johannes


On Mon, 08 Aug 2005 14:56:36 +0200, Johannes Eble
<skywalkerpackage@hotmail.com> wrote:

...

>while(...) { > (*action)();
sorry, I meant (ptr_currState->action)(); Johannes