puzzlebox
Loading...
Searching...
No Matches
Routing

Parsed message handler routing. More...

Detailed Description

These functions form a tree-shaped call graph, and are used to handle specific commands received from pb_i2c_recv().

Functions

void pb_route_msg (pb_msg_t *msg)
 Handle a message with type {PROP, STATE, MAGIC}.
 
void pb_route_cmd_prop (pb_msg_t *msg)
 Handle a PROP message with action {REQ, RES, SET}.
 
void pb_route_cmd_state (pb_msg_t *msg)
 Handle a STATE message with action {REQ, RES, SET}.
 
void pb_route_cmd_magic (pb_msg_t *msg)
 Handle a MAGIC message with action {REQ, RES}.
 
void pb_route_cmd_prop_req (pb_msg_t *msg)
 Handle a PROP message with action REQ.
 
void pb_route_cmd_prop_res (pb_msg_t *msg)
 Handle a PROP message with action RES.
 
void pb_route_cmd_prop_set (pb_msg_t *msg)
 Handle a PROP message with action SET.
 
void pb_route_cmd_state_req (pb_msg_t *msg)
 Handle a STATE message with action REQ.
 
void pb_route_cmd_state_res (pb_msg_t *msg)
 Handle a STATE message with action RES.
 
void pb_route_cmd_state_set (pb_msg_t *msg)
 Handle a STATE message with action SET.
 
void pb_route_cmd_magic_req (pb_msg_t *msg)
 Handle a MAGIC message with action REQ.
 
void pb_route_cmd_magic_res (pb_msg_t *msg)
 Handle a MAGIC message with action RES.
 

Function Documentation

◆ pb_route_cmd_magic()

void pb_route_cmd_magic ( pb_msg_t * msg)

Calls the next handler depending on msg->action.

Note
Messages with type MAGIC and action SET will be silently ignored, as there is no such command.
See also
pb_hook_route_cmd_magic()

◆ pb_route_cmd_magic_req()

void pb_route_cmd_magic_req ( pb_msg_t * msg)

The default implementation of this function does the following:

  • Verify the size of the magic string
  • Verify the content of the magic string
  • Reply with a MAGIC RES message.

◆ pb_route_cmd_magic_res()

void pb_route_cmd_magic_res ( pb_msg_t * msg)

The default implementation of this function is empty, as only the main controller handles this type of command. (link)

This function registers the I²C address of the puzzle module that replied to the MAGIC REQ command into a list of "known puzzle modules", which are then periodically updated during gameplay.

Note
Up to CFG_PB_MOD_MAX puzzle modules can be registered simultaniously.

◆ pb_route_cmd_prop()

void pb_route_cmd_prop ( pb_msg_t * msg)

Calls the next handler depending on msg->action.

See also
pb_hook_route_cmd_prop()

◆ pb_route_cmd_prop_req()

void pb_route_cmd_prop_req ( pb_msg_t * msg)

The default implementation of this function is empty, as puzzle module properties are user-defined.

◆ pb_route_cmd_prop_res()

void pb_route_cmd_prop_res ( pb_msg_t * msg)

The default implementation of this function is empty, as puzzle module properties are user-defined.

◆ pb_route_cmd_prop_set()

void pb_route_cmd_prop_set ( pb_msg_t * msg)

The default implementation of this function is empty, as puzzle module properties are user-defined.

◆ pb_route_cmd_state()

void pb_route_cmd_state ( pb_msg_t * msg)

Calls the next handler depending on msg->action.

See also
pb_hook_route_cmd_state()

◆ pb_route_cmd_state_req()

void pb_route_cmd_state_req ( pb_msg_t * msg)

The default implementation of this function does the following:

◆ pb_route_cmd_state_res()

void pb_route_cmd_state_res ( pb_msg_t * msg)

The default implementation of this function is empty, as only the main controller handles this type of command.

◆ pb_route_cmd_state_set()

void pb_route_cmd_state_set ( pb_msg_t * msg)

The default implementation of this function does the following:

◆ pb_route_msg()

void pb_route_msg ( pb_msg_t * msg)

Calls the next handler depending on msg->type.

See also
pb_hook_route_msg()