plptools
Loading...
Searching...
No Matches
drive.h
Go to the documentation of this file.
1/*
2 * This file is part of plptools.
3 *
4 * Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com>
5 * Copyright (c) 2026 Jason Morley <hello@jbmorley.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * along with this program; if not, see <https://www.gnu.org/licenses/>.
19 *
20 */
21#pragma once
22
23#include <cstdint>
24#include <iostream>
25#include <string>
26#include <cstring>
27
28#include "psitime.h"
29#include "rfsv.h"
30
31enum class MediaType: uint32_t {
32 kNotPresent = 0,
33 kUnknown = 1,
34 kFloppy = 2,
35 kDisk = 3,
36 kCompactDisc = 4,
37 kRAM = 5,
38 kFlashDisk = 6,
39 kROM = 7,
40 kRemote = 8,
41};
42
51class Drive {
52 friend class RFSV32;
53 friend class RFSV16;
54
55public:
59 Drive();
60
61 Drive(MediaType mediaType,
62 uint32_t driveAttributes,
63 uint32_t mediaAttributes,
64 uint32_t uid,
65 uint64_t size,
66 uint64_t space,
67 char driveLetter,
68 std::string name);
69
73 Drive(const Drive &other) = default;
74
78 Drive &operator=(const Drive &other) = default;
79
100 MediaType getMediaType() const;
101
119 uint32_t getDriveAttributes() const;
120
136 uint32_t getMediaAttributes() const;
137
145 uint32_t getUID() const;
146
152 uint64_t getSize() const;
153
159 uint64_t getSpace() const;
160
166 std::string getName() const;
167
173 char getDriveLetter() const;
174
180 std::string getPath() const;
181
182private:
183 void setMediaType(MediaType type);
184 void setDriveAttributes(uint32_t driveAttribute);
185 void setMediaAttributes(uint32_t mediaAttribute);
186 void setUID(uint32_t uid);
187 void setSize(uint32_t sizeLo, uint32_t sizeHi);
188 void setSpace(uint32_t spaceLo, uint32_t spaceHi);
189 void setName(char drive, const char * const volname);
190
194 uint32_t uid_;
195 uint64_t size_;
196 uint64_t space_;
198 std::string name_;
199};
A class representing information about a Disk drive on the psion.
Definition: drive.h:51
uint32_t getDriveAttributes() const
Retrieve the attributes of the drive.
Definition: drive.cc:86
char getDriveLetter() const
Retrieve the drive letter of the drive.
Definition: drive.cc:110
uint64_t space_
Definition: drive.h:196
void setSpace(uint32_t spaceLo, uint32_t spaceHi)
Definition: drive.cc:72
Drive & operator=(const Drive &other)=default
Assignment operator.
uint32_t getUID() const
Retrieve the UID of the drive.
Definition: drive.cc:94
MediaType getMediaType() const
Retrieve the media type of the drive.
Definition: drive.cc:82
char driveLetter_
Definition: drive.h:197
void setName(char drive, const char *const volname)
Definition: drive.cc:76
void setUID(uint32_t uid)
Definition: drive.cc:64
MediaType mediaType_
Definition: drive.h:191
uint32_t driveAttributes_
Definition: drive.h:192
uint64_t getSpace() const
Retrieve the free capacity on the drive.
Definition: drive.cc:102
uint32_t uid_
Definition: drive.h:194
void setMediaType(MediaType type)
Definition: drive.cc:52
uint64_t getSize() const
Retrieve the total capacity of the drive.
Definition: drive.cc:98
Drive(const Drive &other)=default
Copy constructor.
std::string getName() const
Retrieve the volume name of the drive.
Definition: drive.cc:106
uint32_t getMediaAttributes() const
Retrieve the attributes of the media.
Definition: drive.cc:90
std::string getPath() const
Get the file system path given by the current drive.
Definition: drive.cc:114
void setDriveAttributes(uint32_t driveAttribute)
Definition: drive.cc:56
std::string name_
Definition: drive.h:198
uint32_t mediaAttributes_
Definition: drive.h:193
uint64_t size_
Definition: drive.h:195
void setMediaAttributes(uint32_t mediaAttribute)
Definition: drive.cc:60
Drive()
Default constructor.
Definition: drive.cc:31
void setSize(uint32_t sizeLo, uint32_t sizeHi)
Definition: drive.cc:68
This is the implementation of the RFSV protocol for Psion series 3 (SIBO) variant.
Definition: rfsv16.h:35
This is the implementation of the RFSV protocol for Psion series 5 (EPOC) variant.
Definition: rfsv32.h:37
MediaType
Definition: drive.h:31