mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-25 20:33:35 +00:00
08194af424
- Moved C++ code to cpp/ from src/raspberrypi - Related updates to Makefile, easyinstall.sh, and the github build rules - Removed the native X68k C code in src/x68k from the repo
52 lines
989 B
C++
52 lines
989 B
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "rascsi_interface.pb.h"
|
|
#include <functional>
|
|
#include <thread>
|
|
|
|
class CommandContext;
|
|
|
|
using namespace std;
|
|
using namespace rascsi_interface;
|
|
|
|
class RascsiService
|
|
{
|
|
using callback = function<bool(const CommandContext&, rascsi_interface::PbCommand&)>;
|
|
|
|
callback execute;
|
|
|
|
int service_socket = -1;
|
|
|
|
thread monthread;
|
|
|
|
static volatile bool running;
|
|
|
|
public:
|
|
|
|
RascsiService() = default;
|
|
~RascsiService() = default;
|
|
|
|
bool Init(const callback&, int);
|
|
void Cleanup() const;
|
|
|
|
bool IsRunning() const { return running; }
|
|
void SetRunning(bool b) const { running = b; }
|
|
|
|
private:
|
|
|
|
void Execute() const;
|
|
|
|
PbCommand ReadCommand(CommandContext&) const;
|
|
|
|
static void KillHandler(int) { running = false; }
|
|
};
|