Tactiliest/Boards/Simulator/Source/hal/SimulatorSdCard.h
Ken Van Hoeylandt 2345ba6d13
HAL renaming & relocation (#215)
Implemented more consistent naming:
- Moved all HAL devices into their own namespace (and related folder)
- Post-fixed all HAL device names with "Device"
2025-02-09 16:48:23 +01:00

46 lines
1.0 KiB
C++

#pragma once
#include "Tactility/hal/sdcard/SdCardDevice.h"
#include <Tactility/Mutex.h>
#include <memory>
using tt::hal::sdcard::SdCardDevice;
class SimulatorSdCard final : public SdCardDevice {
private:
State state;
std::shared_ptr<tt::Lockable> lockable;
std::string mountPath;
public:
SimulatorSdCard() : SdCardDevice(MountBehaviour::AtBoot),
state(State::Unmounted),
lockable(std::make_shared<tt::Mutex>())
{}
std::string getName() const final { return "Mock SD Card"; }
std::string getDescription() const final { return ""; }
bool mount(const std::string& newMountPath) final {
state = State::Mounted;
mountPath = newMountPath;
return true;
}
bool unmount() override {
state = State::Unmounted;
mountPath = "";
return true;
}
std::string getMountPath() const final { return mountPath; };
std::shared_ptr<tt::Lockable> getLockable() const final { return lockable; }
State getState() const override { return state; }
};