app/hardware_backend.h

IBoardBackend over the real gantry + hall-effect sensors.

A thin adapter over GameController. Built now for the unified game loop; it is first exercised on the Pi in Phase 5 (PLAN.md). Human moves are read from the sensors and the wait is interruptible via the cancellation token.

namespace kirin
class HardwareBackend : public kirin::IBoardBackend
#include <hardware_backend.h>

Public Functions

explicit HardwareBackend(std::string serialPort)
virtual bool prepareNewGame(bool engineWhite, ResetMode mode) override
bool prepareNewGameFromSnapshot(bool engineWhite, const BoardIdentity &snapshot) override
virtual bool resetToStart() override
virtual bool executeEngineMove(int engineMove) override
virtual bool undoMove(int engineMove, int capturedSlot) override
bool executeSetup(const SetupPlan &plan, const BoardIdentity &target) override
virtual HumanMoveResult waitForHumanMove(std::atomic<bool> &cancel) override
virtual bool verifyBoardState() override
virtual bool readBoardOccupancy(unsigned long long &expected, unsigned long long &actual) override
virtual bool redriveLastMove(int engineMove) override
virtual void syncWithEngine() override
virtual void updateTracker(int engineMove) override
inline virtual bool isSimulation() const override
inline virtual void setScannerObserver(const ScannerObserver &observer) override
inline virtual void setPlanObserver(const PlanObserver &observer) override
inline virtual void setGcodeObserver(const Gantry::GcodeObserver &observer) override

Private Functions

bool ensureConnected()
bool setUpPieces()

Private Members

std::string serialPort_
GameController controller_
bool connected_ = false