RASCSI/cpp/devices/mode_page_device.h
Daniel Markstedt 08194af424
Move C++ code into cpp/ dir (#941)
- 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
2022-10-25 12:59:30 -07:00

56 lines
1.4 KiB
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI Reloaded
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
//
//---------------------------------------------------------------------------
#pragma once
#include "primary_device.h"
#include <string>
#include <vector>
#include <map>
class ModePageDevice: public PrimaryDevice
{
public:
ModePageDevice(PbDeviceType, int);
~ModePageDevice() override = default;
bool Dispatch(scsi_command) override;
virtual void ModeSelect(scsi_defs::scsi_command, const vector<int>&, const vector<BYTE>&, int) const;
protected:
bool SupportsSaveParameters() const { return supports_save_parameters; }
void SupportsSaveParameters(bool b) { supports_save_parameters = b; }
int AddModePages(const vector<int>&, vector<BYTE>&, int, int, int) const;
virtual void SetUpModePages(map<int, vector<byte>>&, int, bool) const = 0;
virtual void AddVendorPage(map<int, vector<byte>>&, int, bool) const {
// Nothing to add by default
}
private:
using super = PrimaryDevice;
Dispatcher<ModePageDevice> dispatcher;
bool supports_save_parameters = false;
virtual int ModeSense6(const vector<int>&, vector<BYTE>&) const = 0;
virtual int ModeSense10(const vector<int>&, vector<BYTE>&) const = 0;
void ModeSense6();
void ModeSense10();
void ModeSelect6();
void ModeSelect10();
int SaveParametersCheck(int) const;
};