52template<
typename Client,
typename Client16,
typename Client32>
59 auto socket = std::make_unique<TCPSocket>();
60 if (!socket->connect(host.c_str(), port)) {
75 if (!socket->sendBufferStore(bufferStore)) {
81 socket->closeSocket();
89 if (socket->getBufferStore(bufferStore) == 1) {
90 if (bufferStore.
getLen() > 8 && !strncmp(bufferStore.
getString(),
"Series 3", 8)) {
91 return new Client16(std::move(socket));
93 else if (bufferStore.
getLen() > 8 && !strncmp(bufferStore.
getString(),
"Series 5", 8)) {
94 return new Client32(std::move(socket));
96 if ((bufferStore.
getLen() > 8) && !strncmp(bufferStore.
getString(),
"No Psion", 8)) {
97 socket->closeSocket();
A generic container for an array of bytes.
const char * getString(long pos=0) const
Retrieves the characters at index pos.
void addStringT(const char *s)
Appends a string to the content of this instance.
unsigned long getLen() const
Retrieves the length of a BufferStore.
Wrapper class featuring range-checking and string representation of enumerated values.
@ FACERR_CONNECTION_FAILURE
Client * connect(const std::string &host, int port, bool waitForDevice, Enum< ConnectionError > *error)
Create a new NCP client instance, selecting the appropriate subclass based on the device type reporte...
static void error(int line)