aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/CMakeLists.txt3
-rw-r--r--client/cmd.cpp1
-rw-r--r--client/cmd.h14
-rw-r--r--client/readme.md22
4 files changed, 34 insertions, 6 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 73c703d..57a2447 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -3,7 +3,10 @@ cmake_minimum_required(VERSION 3.29)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
+
+# enable debug features
set(CMAKE_BUILD_TYPE Debug)
+add_compile_definitions(DEBUG)
project(puzzlebox_client C CXX)
diff --git a/client/cmd.cpp b/client/cmd.cpp
index a26de13..ab101e9 100644
--- a/client/cmd.cpp
+++ b/client/cmd.cpp
@@ -91,3 +91,4 @@ void cmd_ls(char*) {
};
i2c_send(BUSADDR_MAIN, msg, sizeof(msg));
}
+
diff --git a/client/cmd.h b/client/cmd.h
index 30bcbeb..932f3a2 100644
--- a/client/cmd.h
+++ b/client/cmd.h
@@ -14,10 +14,10 @@ struct cmd {
cmd_fn_t cmd_exit;
cmd_fn_t cmd_test;
cmd_fn_t cmd_help;
-cmd_fn_t cmd_send;
cmd_fn_t cmd_status;
cmd_fn_t cmd_reset;
cmd_fn_t cmd_ls;
+cmd_fn_t cmd_send;
static const struct cmd cmds[] = {
{
@@ -36,11 +36,6 @@ static const struct cmd cmds[] = {
.info = "show this help",
},
{
- .handle = cmd_send,
- .name = "send",
- .info = "[debug] send raw message",
- },
- {
.handle = cmd_status,
.name = "status",
.info = "show global puzzle box state (main controller state)",
@@ -55,6 +50,13 @@ static const struct cmd cmds[] = {
.name = "ls",
.info = "list connected puzzle modules",
},
+#ifdef DEBUG
+ {
+ .handle = cmd_send,
+ .name = "send",
+ .info = "[debug] send raw message",
+ },
+#endif
};
static const size_t cmds_length = sizeof(cmds) / sizeof(cmds[0]);
diff --git a/client/readme.md b/client/readme.md
index 1b4cc34..ea3e034 100644
--- a/client/readme.md
+++ b/client/readme.md
@@ -1,5 +1,27 @@
# puzzle box client
+This folder contains the source code for the puzzle box client (pbc). This is a
+desktop application that communicates with the main controller over TCP to
+send/receive I<sup>2</sup>C messages. This application is not only used by a
+game operator to control and monitor the state of a puzzle box, but is also a
+useful debugging tool when developing puzzle modules, as it allows you to send
+arbitrary data over the puzzle bus.
+
+## Features
+
+- List detected puzzle modules
+- Reset puzzle modules (individually or all to reset the box)
+- Skip puzzle modules (individually or all)
+- Request puzzle box state
+
+Debug only:
+- Send arbitrary messages
+
+## Building
+
+PBC is a standard CMake project, but a [makefile](./makefile) is provided for
+convenience (still requires CMake and Ninja are installed).
+
## Send data
```