AMICO can carrying some types of data:
- Asyncronous data: messages, alarm, asynchronous controls;
- Synchronous data: realtime streaming (audio, video), synchronous controls;
- Primitive remote call: call a primitive method on remote module and wait for response;
AMICO uses some low level transport classes:
- Network Socket: uses TCP sockets (AMICO_socket <----- AMICO_net);
- Unix Socket: uses TCP sockets (AMICO_socket <----- AMICO_unix);
- Router: uses an abstract layer to route data between all technology (socket net and unix)
AMICO is a connection oriented protocol. Every module can create connections (link) with others modules. Every connections can:
- One asynchronous sub-channel for messages, alarm;
- One asynchronous sub-channel for primitive calls (AMICO_primitivecall);
When
AMICO_link class is instantiated you have to define a string for unique name. When you have to connect to the other module, the alias is used to connect with remote module (process). The alias is specific for low level transport (IP:port for network socket, string (filename) unix socket).
To other module .--------------.
<------. .------------>| |-----------------.
| | | MODULE A | |
| | .---------| |-----------. |
| | | '--------------' | |
| | | /|\ | | |
| | | | | | |
| | | | | | |
| | \|/ | \|/ \|/ \|/
.--------------. .--------------. .--------------.
| | | | | |
| MODULE B | | MODULE C | | MODULE D |
| | | | | |
'--------------' '--------------' '--------------'
Every link between two modules has a single asynchronous channel using the class
AMICO_link. This class use STL
queue (
APQueueBase) to manage the type of message in
AMICO_packet:
- ALARM (highest)
- EVENT
- INFO (lowest)
Every message has a maximum size of 8192 bytes.
MODULE A Asynchronous link sub-channel MODULE B
ALARM queue <---|
|
EVENT queue <---|-------------------------------------------- SEND data
|
INFO queue <---| |---> ALARM queue
|
SEND data --------------------------------------------|---> EVENT queue
|
|---> INFO queue
Using link handle you can call a primitive on remote module. A primitive has a prototype as:
APBool Primitive(APUint32 size_in, APPointer in, APUint32& size_out, APPointer output)
In the remote module the input pointer point to the data field of incoming packet.
AMICO protocoll call the primitive and response with a packet with data field fill with memory copy from output pointer. The primitive must be pulished from remote module.
MODULE A MODULE B
Input data .--------------.
PRIMITIVE call ----------------------------------->| |
Output data | PRIMITIVE |---> ACTIONS
PRIMITIVE reply <-----------------------------------| |
'--------------'
- Todo:
- class AMICO_most (MOST wrapper, Media Oriented System Transport - http://www.mostcooperation.com )
- class AMICO_canbus (class for CAN bus drivers)
- class AMICO_router (routing between NET/UNIX)