spiegel-keyman/linux/keyman-system-service/tests/KeyboardDeviceMock.cpp
Eberhard Beilharz 603c1d6ea0
feat(linux): Add system service to toggle capslock LED
This implements the server side.
2023-05-15 09:13:58 +02:00

45 lines
793 B
C++

// A KeyboardDevice mock.
#include <dirent.h>
#include <fcntl.h>
#include <iostream>
#include <string.h>
#include <string>
#include <unistd.h>
#ifndef KeyboardDevice
#define KeyboardDevice KeyboardDeviceMock
#endif
#include "KeyboardDevice.h"
using namespace std;
KeyboardDeviceMock::KeyboardDeviceMock() {
this->dev = nullptr;
this->fd = -1;
this->hasCapsLockLed = 1;
this->debug = false;
}
KeyboardDeviceMock::~KeyboardDeviceMock() {
}
bool
KeyboardDeviceMock::Initialize(const char* name) {
return true;
}
bool
KeyboardDeviceMock::HasCapsLockLed() {
return true;
}
void
KeyboardDeviceMock::SetCapsLockLed(bool on) {
this->hasCapsLockLed = on ? 1 : 0;
}
bool
KeyboardDeviceMock::GetCapsLockLed() {
return this->hasCapsLockLed == 1;
}