Field | Size (in bits) | Description |
---|---|---|
magic | 32 | qiMessaging message magic number (0x42dead42) |
id | 32 | id of the message |
size | 32 | size of the payload |
version | 16 | protocol version |
type | 16 | type of the message |
service | 32 | id of the service |
object | 32 | id of the object |
action | 32 | id of the function or event |
payload | ... | ... |
The magic (0x42dead42) is used to verifiy the received buffer is a qiMessaging message.
Each message has an id. A reply or an error will have the same id as the corresponding call.
This field contains the size of the payload.
The version of the protocol.
This is the type of the message, as defined in the table below.
Type | Id | Description |
---|---|---|
Call | 1 | A function call |
Reply | 2 | A reply to a call |
Event | 3 | An event raised by a service |
Error | 4 | An error |
Invoke | 5 | Invoke an event slot |
The service id, as given by the Service Directory.
Service | Id | Description |
---|---|---|
Server | 0 | Used for control frames |
Service directory | 1 | Directory of all registered services |
This field refers to objects that are created internally to the module.
Object | Id | Description |
---|---|---|
Default | 0 | Default object of the service |
Function that should be performed, or event that is raised.
There are two different cases.
An event is emitted by the service itself, it is broadcast to all registered clients.
A slot can be triggered by the client, this is equivalent to a function call which return value we don’t wait for.
Type | Size | Description |
---|---|---|
void | 0 | void |
bool | 1 | boolean |
int8_t | 1 | signed byte |
int16_t | 2 | signed 16-bit integer |
int32_t | 4 | signed 32-bit integer |
int64_t | 8 | signed 64-bit integer |
uint8_t | 1 | unsigned byte |
uint16_t | 2 | unsigned 16-bit integer |
uint32_t | 4 | unsigned 32-bit integer |
uint64_t | 8 | unsigned 64-bit integer |
float | 4 | 32-bit floating point number |
double | 8 | 64-bit floating point number |
const char * | 4 + n |
|
Type | Size | Description |
---|---|---|
std::string | 4 + n |
|
std::list<T> | 4 + n * size(T) |
|
std::vector<T> | 4 + n * size(T) |
|
std::map<K, V> | 4 + n * (size(K) + size(V)) |
|