puzzlebox
Loading...
Searching...
No Matches

Datatypes used within pbdrv. More...

Detailed Description

Classes

struct  pb_msg_t
 puzzle bus message header / container (shared by all commands) More...
 
struct  pb_cmd_prop_t
 PB_CMD_PROP data More...
 
struct  pb_cmd_state_t
 PB_CMD_STATE data More...
 
struct  pb_cmd_magic_t
 PB_CMD_MAGIC data More...
 

Typedefs

typedef uint16_t i2c_addr_t
 I²C address (10 or 7 bit)
 

Enumerations

enum  pb_cmd_id_t { PB_CMD_PROP , PB_CMD_STATE , PB_CMD_MAGIC }
 Puzzle bus command types. More...
 
enum  pb_action_t { PB_ACTION_REQ , PB_ACTION_RES , PB_ACTION_SET }
 Puzzle bus command action types. More...
 
enum  pb_global_state_t { PB_GS_NOINIT , PB_GS_IDLE , PB_GS_PLAYING , PB_GS_SOLVED }
 Puzzle module global states. More...
 

Variables

static const char pb_cmd_magic_req [] = {0x70, 0x75, 0x7a, 0x62, 0x75, 0x73}
 Magic sent from main controller to puzzle module (="puzbus")
 
static const char pb_cmd_magic_res [] = {0x67, 0x61, 0x6d, 0x69, 0x6e, 0x67}
 Magic reply from puzzle module back to main controller (="gaming")
 

Enumeration Type Documentation

◆ pb_action_t

Enumerator
PB_ACTION_REQ 

request

PB_ACTION_RES 

response

PB_ACTION_SET 

(over)write

◆ pb_cmd_id_t

Enumerator
PB_CMD_PROP 

puzzle module property (REQ, RES, SET)

The PROP command type is used for exchanging arbitrary data between puzzle modules and/or the puzzle box client (pbc) over the TCP bridge. These properties are not used by the puzzle framework.

PB_CMD_STATE 

puzzle module global state variable (REQ, RES, SET)

The STATE command is used by puzzle modules to inform the main controller about their global state. The main controller aggregates the states of all connected puzzle modules and exchanges this aggregated state with the puzzle modules to indicate when the entire puzzle box is solved.

PB_CMD_MAGIC 

magic (handshake) (REQ, RES)

The MAGIC command effectively serves as a 'secret handshake' (using a magic value) which is used to distinguish between puzzle modules and unrelated I²C devices.

◆ pb_global_state_t

Enumerator
PB_GS_NOINIT 

uninitialized (only used by puzzle modules)

PB_GS_IDLE 

puzzle not started yet

PB_GS_PLAYING 

puzzle actively being solved

PB_GS_SOLVED 

puzzle completed

Variable Documentation

◆ pb_cmd_magic_req

const char pb_cmd_magic_req[] = {0x70, 0x75, 0x7a, 0x62, 0x75, 0x73}
static

The size of this array can be obtained by sizeof(pb_cmd_magic_req).

◆ pb_cmd_magic_res

const char pb_cmd_magic_res[] = {0x67, 0x61, 0x6d, 0x69, 0x6e, 0x67}
static

The size of this array can be obtained by sizeof(pb_cmd_magic_res).