wip: Executor -> Simulator

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/851/head
Gergely Nagy 4 years ago
parent 8bd2efb9c7
commit 59aa18aca8
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -19,6 +19,6 @@
#pragma once
#include "kaleidoscope/simulator/Executor.h"
#include "kaleidoscope/simulator/Simulator.h"
#include "kaleidoscope/simulator/macros.h"
#include "kaleidoscope/simulator/LogProtocolInterface.h"

@ -18,7 +18,7 @@
#ifdef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/simulator/Executor.h"
#include "kaleidoscope/simulator/Simulator.h"
#include "kaleidoscope/simulator/SimulatorCore.h"
#include "kaleidoscope/simulator/reports/KeyboardReport.h"
#include "kaleidoscope/simulator/reports/BootKeyboardReport.h"
@ -33,26 +33,26 @@
namespace kaleidoscope {
namespace simulator {
Executor::Executor(std::ostream &out) : interface::Simulator_{out} {
Simulator::Simulator(std::ostream &out) : interface::Simulator_{out} {
this->setCore(
std::shared_ptr<SimulatorCore> {
new SimulatorCore{}
}
);
HIDReportObserver::resetHook(&Executor::processHIDReport);
HIDReportObserver::resetHook(&Simulator::processHIDReport);
Kaleidoscope.device().keyScanner().setEnableReadMatrix(false);
}
Executor &Executor::getInstance() {
static Executor sim{std::cout};
Simulator &Simulator::getInstance() {
static Simulator sim{std::cout};
return sim;
}
void Executor::processHIDReport(uint8_t id, const void* data,
void Simulator::processHIDReport(uint8_t id, const void* data,
int len, int result) {
auto &simulator = Executor::getInstance();
auto &simulator = Simulator::getInstance();
switch (id) {
// TODO: React appropriately on the following

@ -32,16 +32,16 @@ namespace simulator {
/// @brief A Kaleidoscope specific simulator class.
///
class Executor : public interface::Simulator_ {
class Simulator: public interface::Simulator_ {
public:
/// @brief Access the global simulator singleton.
///
static Executor &getInstance();
static Simulator &getInstance();
private:
Executor(std::ostream &out);
Simulator(std::ostream &out);
static void processHIDReport(uint8_t id, const void* data,
int len, int result);

@ -40,7 +40,7 @@ uint8_t toKeycode(Key key) {
} // namespace kaleidoscope
#include "kaleidoscope/simulator/Interface.h"
#include "kaleidoscope/simulator/Executor.h"
#include "kaleidoscope/simulator/Simulator.h"
#include "kaleidoscope/simulator/LogProtocolInterface.h"
#include "kaleidoscope/simulator/interface/Visualization.h"
@ -61,7 +61,7 @@ extern void executeTestFunction();
namespace kaleidoscope { \
namespace simulator { \
/* Forward declare the actual test function */ \
void runSimulator(Executor &simulator); \
void runSimulator(Simulator &simulator); \
} /* namespace simulator */ \
} /* namespace kaleidoscope */ \
\
@ -71,5 +71,5 @@ extern void executeTestFunction();
void executeTestFunction() { \
setup(); /* setup Kaleidoscope */ \
using namespace kaleidoscope::simulator; \
runSimulator(Executor::getInstance()); \
runSimulator(Simulator::getInstance()); \
}

@ -23,7 +23,7 @@ KALEIDOSCOPE_SIMULATOR_INIT
namespace kaleidoscope {
namespace simulator {
void runSimulator(Executor &simulator) {
void runSimulator(Simulator &simulator) {
using namespace actions;
using namespace interface;

@ -28,7 +28,7 @@ namespace simulator {
extern const char aglais_test_recording[];
void runSimulator(Executor &simulator) {
void runSimulator(Simulator &simulator) {
using namespace actions;

Loading…
Cancel
Save