41 stringRep.
add(
RFSV::E_PSI_GEN_ARG,
N_("bad argument"));
43 stringRep.
add(
RFSV::E_PSI_GEN_NSUP,
N_("not supported"));
44 stringRep.
add(
RFSV::E_PSI_GEN_UNDER,
N_("numeric underflow"));
45 stringRep.
add(
RFSV::E_PSI_GEN_OVER,
N_("numeric overflow"));
46 stringRep.
add(
RFSV::E_PSI_GEN_RANGE,
N_("numeric exception"));
48 stringRep.
add(
RFSV::E_PSI_GEN_NOMEMORY,
N_("out of memory"));
49 stringRep.
add(
RFSV::E_PSI_GEN_NOSEGMENTS,
N_("out of segments"));
50 stringRep.
add(
RFSV::E_PSI_GEN_NOSEM,
N_("out of semaphores"));
51 stringRep.
add(
RFSV::E_PSI_GEN_NOPROC,
N_("out of processes"));
52 stringRep.
add(
RFSV::E_PSI_GEN_OPEN,
N_("already open"));
53 stringRep.
add(
RFSV::E_PSI_GEN_NOTOPEN,
N_("not open"));
54 stringRep.
add(
RFSV::E_PSI_GEN_IMAGE,
N_("bad image"));
57 stringRep.
add(
RFSV::E_PSI_GEN_FSYS,
N_("no filesystem"));
58 stringRep.
add(
RFSV::E_PSI_GEN_START,
N_("not ready"));
59 stringRep.
add(
RFSV::E_PSI_GEN_NOFONT,
N_("no font"));
60 stringRep.
add(
RFSV::E_PSI_GEN_TOOWIDE,
N_("too wide"));
61 stringRep.
add(
RFSV::E_PSI_GEN_TOOMANY,
N_("too many"));
62 stringRep.
add(
RFSV::E_PSI_FILE_EXIST,
N_("file already exists"));
63 stringRep.
add(
RFSV::E_PSI_FILE_NXIST,
N_("no such file"));
66 stringRep.
add(
RFSV::E_PSI_FILE_EOF,
N_("end of file"));
67 stringRep.
add(
RFSV::E_PSI_FILE_FULL,
N_("disk/serial read buffer full"));
68 stringRep.
add(
RFSV::E_PSI_FILE_NAME,
N_("invalid name"));
69 stringRep.
add(
RFSV::E_PSI_FILE_ACCESS,
N_("access denied"));
70 stringRep.
add(
RFSV::E_PSI_FILE_LOCKED,
N_("resource locked"));
72 stringRep.
add(
RFSV::E_PSI_FILE_DIR,
N_("no such directory"));
73 stringRep.
add(
RFSV::E_PSI_FILE_RECORD,
N_("no such record"));
74 stringRep.
add(
RFSV::E_PSI_FILE_RDONLY,
N_("file is read-only"));
75 stringRep.
add(
RFSV::E_PSI_FILE_INV,
N_("invalid I/O operation"));
76 stringRep.
add(
RFSV::E_PSI_FILE_PENDING,
N_("I/O pending (not yet completed)"));
77 stringRep.
add(
RFSV::E_PSI_FILE_VOLUME,
N_("invalid volume name"));
78 stringRep.
add(
RFSV::E_PSI_FILE_CANCEL,
N_("cancelled"));
79 stringRep.
add(
RFSV::E_PSI_FILE_ALLOC,
N_("no memory for control block"));
80 stringRep.
add(
RFSV::E_PSI_FILE_DISC,
N_("unit disconnected"));
81 stringRep.
add(
RFSV::E_PSI_FILE_CONNECT,
N_("already connected"));
82 stringRep.
add(
RFSV::E_PSI_FILE_RETRAN,
N_("retransmission threshold exceeded"));
83 stringRep.
add(
RFSV::E_PSI_FILE_LINE,
N_("physical link failure"));
84 stringRep.
add(
RFSV::E_PSI_FILE_INACT,
N_("inactivity timer expired"));
88 stringRep.
add(
RFSV::E_PSI_MDM_CONFAIL,
N_("modem cannot connect to remote modem"));
89 stringRep.
add(
RFSV::E_PSI_MDM_BUSY,
N_("remote modem busy"));
90 stringRep.
add(
RFSV::E_PSI_MDM_NOANS,
N_("remote modem did not answer"));
91 stringRep.
add(
RFSV::E_PSI_MDM_BLACKLIST,
N_("number blacklisted by the modem"));
92 stringRep.
add(
RFSV::E_PSI_FILE_NOTREADY,
N_("drive not ready"));
93 stringRep.
add(
RFSV::E_PSI_FILE_UNKNOWN,
N_("unknown media"));
94 stringRep.
add(
RFSV::E_PSI_FILE_DIRFULL,
N_("directory full"));
95 stringRep.
add(
RFSV::E_PSI_FILE_PROTECT,
N_("write-protected"));
96 stringRep.
add(
RFSV::E_PSI_FILE_CORRUPT,
N_("media corrupt"));
97 stringRep.
add(
RFSV::E_PSI_FILE_ABORT,
N_("aborted operation"));
98 stringRep.
add(
RFSV::E_PSI_FILE_ERASE,
N_("failed to erase flash media"));
99 stringRep.
add(
RFSV::E_PSI_FILE_INVALID,
N_("invalid file for DBF system"));
100 stringRep.
add(
RFSV::E_PSI_GEN_POWER,
N_("power failure"));
102 stringRep.
add(
RFSV::E_PSI_GEN_DESCR,
N_("bad descriptor"));
103 stringRep.
add(
RFSV::E_PSI_GEN_LIB,
N_("bad entry point"));
104 stringRep.
add(
RFSV::E_PSI_FILE_NDISC,
N_("could not diconnect"));
105 stringRep.
add(
RFSV::E_PSI_FILE_DRIVER,
N_("bad driver"));
106 stringRep.
add(
RFSV::E_PSI_FILE_COMPLETION,
N_("operation not completed"));
108 stringRep.
add(
RFSV::E_PSI_GEN_TERMINATED,
N_("terminated"));
110 stringRep.
add(
RFSV::E_PSI_FILE_HANDLE,
N_("bad handle"));
116 return ncp_client::connect<RFSV, RFSV16, RFSV32>(host, port,
false,
error);
138 if (
socket_->getBufferStore(
a) == 1) {
139 if (!strcmp(
a.getString(0),
"Ok"))
151 for (
const char *p = name.c_str(); *p; p++)
152 tmp += (*p ==
'/') ?
'\\' : *p;
171 tmp[7] = ((attr &
PSI_A_EXEC) ?
'x' : tmp[7]);
173 tmp[9] = ((attr &
PSI_A_TEXT) ?
't' : tmp[9]);
179 a.addStringT(
"NCP$GSPD");
182 if (
socket_->getBufferStore(
a) != 1)
188 return a.getDWord(1);
193 std::vector<PlpDirent> &_files) {
198 result =
dir(path.c_str(), entries);
204 std::vector<PlpDirent> files;
206 files.push_back(entry);
207 if (recursive && entry.isDirectory()) {
208 std::vector<PlpDirent> directoryFiles;
209 result =
dir(entry.getPath(), recursive, directoryFiles);
213 files.insert(files.end(), directoryFiles.begin(), directoryFiles.end());
224 uint32_t driveBits = 0;
231 std::vector<char> driveLetters;
232 for (
int i = 0; i < 26; i++) {
233 if (driveBits & (1 << i)) {
234 driveLetters.push_back(
'A' + i);
239 std::vector<Drive>
drives;
240 for (
const auto &driveLetter : driveLetters) {
242 result =
devinfo(driveLetter, drive);
#define ENUM_DEFINITION_END(EnumName)
#define ENUM_DEFINITION_BEGIN(EnumName, initWith)
Helper macro to construct an enumeration wrapper Enum<E> for a specific enum type.
A generic container for an array of bytes.
A class representing information about a Disk drive on the psion.
Wrapper class featuring range-checking and string representation of enumerated values.
A class, representing a directory entry of the Psion.
This is the implementation of the RFSV protocol for Psion series 3 (SIBO) variant.
Access remote file services of a Psion.
const char * getConnectName()
Retrieves the PLP protocol name.
Enum< errs > drives(std::vector< Drive > &drives)
std::string attr2String(const uint32_t attr)
Converts a file attribute RFSV::file_attribs to human readable format, usable for showing them in dir...
Enum< errs > getStatus()
Retrieves the current connection status.
virtual Enum< errs > dir(const char *const name, PlpDir &ret)=0
Reads a directory on the Psion.
std::unique_ptr< TCPSocket > socket_
virtual Enum< errs > devlist(uint32_t &devbits)=0
Retrieves available drives on the Psion.
virtual Enum< errs > devinfo(const char drive, Drive &dinfo)=0
Retrieves details about a drive.
static std::string convertSlash(const std::string &name)
Utility method, converts '/' to '\'.
int getSpeed()
Retrieve speed of serial link.
errs
The known error codes.
@ PSI_A_NORMAL
Attributes, valid on EPOC only.
@ PSI_A_READ
Attributes, valid on SIBO only.
@ PSI_A_RDONLY
Attributes, valid on both EPOC and SIBO.
ConnectionError
Errors that can occur when connecting to a PLP server.
stringRep add(RFSV::E_PSI_GEN_NONE, N_("no error"))
std::deque< class PlpDirent > PlpDir
static void error(int line)
Description of a Psion-Device.