Third part manual example : Integration of a braille device

Global structure

First step, you must define your need.

BrailleSenderAgent

The BrailleSenderAgent send informations on keyboard input.

In function of your developpement choice, you can send informations on button pressure or on final "characters". I decide in this manual to show implementation of both method.

IN BRAI : key=115; //in case of final caracter input
IN BRAI : btn=1; evt=PRESSED

You have multiple choice to send these messages on the bus and it depand on your library possibility

In both case you need to send your message through the bus. We will supposed what you have you final character in a member value like "_finalChar". This sample code will send information on MicoleBus.

   MicoleStringStream s;
   s<< "IN BRAI : key="<< this._finalChar << ";";
   sendMessage(s.str());

BrailleInputAgent

You need in your consturctor to bind BrailleSenderAgent messages

bindMessage("^IN BRAI : key=(.*);$",BUS_CALLBACK_OF(BrailleOutputAgent,handleKey));
bindMessage("^IN BRAI : btn=(.*); evt=(.*)$",BUS_CALLBACK_OF(BrailleOutputAgent,handleButtonPress));

and let functions pure virtual or empty.

BrailleInputAgent is just an helper and don't need a lot of explanation.


BrailleOuputAgent

bindMessage("^OUT BRAI : string=(.*);$",BUS_CALLBACK_OF(BrailleOutputAgent,handleOutput));