# class rpcs

Remote procedure call services via PLP More...

Contains pure virtuals
Definition | `#include <rpcs.h>`
Inherited by | rpcs16, rpcs32
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum machs { PSI_MACH_UNKNOWN = 0, PSI_MACH_PC = 1, PSI_MACH_MC = 2, PSI_MACH_HC = 3, PSI_MACH_S3 = 4, PSI_MACH_S3A = 5, PSI_MACH_WORKABOUT = 6, PSI_MACH_SIENNA = 7, PSI_MACH_S3C = 8, PSI_MACH_S5 = 32, PSI_MACH_WINC = 33 }
- enum languages { PSI_LANG_TEST = 0, PSI_LANG_en_GB = 1, PSI_LANG_fr_FR = 2, PSI_LANG_de_DE = 3, PSI_LANG_es_ES = 4, PSI_LANG_it_IT = 5, PSI_LANG_sv_SE = 6, PSI_LANG_da_DK = 7, PSI_LANG_no_NO = 8, PSI_LANG_fi_FI = 9, PSI_LANG_en_US = 10, PSI_LANG_fr_CH = 11, PSI_LANG_de_CH = 12, PSI_LANG_pt_PT = 13, PSI_LANG_tr_TR = 14, PSI_LANG_is_IS = 15, PSI_LANG_ru_RU = 16, PSI_LANG_hu_HU = 17, PSI_LANG_nl_NL = 18, PSI_LANG_nl_BE = 19, PSI_LANG_en_AU = 20, PSI_LANG_fr_BE = 21, PSI_LANG_de_AT = 22, PSI_LANG_en_NZ = 23, PSI_LANG_fr_CA = 24, PSI_LANG_cs_CZ = 25, PSI_LANG_sk_SK = 26, PSI_LANG_pl_PL = 27, PSI_LANG_sl_SI = 28 }
- enum batterystates { PSI_BATT_DEAD = 0, PSI_BATT_VERYLOW = 1, PSI_BATT_LOW = 2, PSI_BATT_GOOD = 3 }
- typedef struct machineInfo_t

#### Public Methods

- virtual ~rpcs ()
- void reset ()
- void reconnect ()
- Enum<rfsv::errs> getStatus ()
- Enum<rfsv::errs> getNCPversion (int &major, int &minor)
- Enum<rfsv::errs> execProgram (const char *program, const char *args)
- Enum<rfsv::errs> stopProgram (const char *)
- Enum<rfsv::errs> queryProgram (const char *)
- Enum<rfsv::errs> formatOpen (const char drive, int &handle, int &count)
- Enum<rfsv::errs> formatRead (int handle)
- Enum<rfsv::errs> getUniqueID (const char *, long &)
- Enum<rfsv::errs> getOwnerInfo (bufferArray &)
- Enum<rfsv::errs> getMachineType (Enum<machs> &type)
- Enum<rfsv::errs> fuser (const char *name, char *buf, int maxlen)
- Enum<rfsv::errs> quitServer (void)
- Enum<rfsv::errs> queryPrograms (processList &ret)
- virtual Enum<rfsv::errs> getCmdLine (const char *process, std::string &ret)
- virtual Enum<rfsv::errs> getMachineInfo (machineInfo &)
- virtual Enum<rfsv::errs> closeHandle (u_int32_t handle)
- virtual Enum<rfsv::errs> regOpenIter (u_int32_t, char *, u_int16_t &)
- virtual Enum<rfsv::errs> regReadIter (u_int16_t)
- virtual Enum<rfsv::errs> regWrite (void)
- virtual Enum<rfsv::errs> regRead (void)
- virtual Enum<rfsv::errs> regDelete (void)
- virtual Enum<rfsv::errs> setTime (time_t time)
- virtual Enum<rfsv::errs> configRead (u_int32_t size, bufferStore &data)
- virtual Enum<rfsv::errs> configWrite (bufferStore data)
- virtual Enum<rfsv::errs> queryOpen (void)
- virtual Enum<rfsv::errs> queryRead (void)

#### Protected Types

- enum commands { QUERY_NCP = 0x00, EXEC_PROG = 0x01, QUERY_DRIVE = 0x02, STOP_PROG = 0x03, QUERY_PROG = 0x04, FORMAT_OPEN = 0x05, FORMAT_READ = 0x06, GET_UNIQUEID = 0x07, GET_OWNERINFO = 0x08, GET_MACHINETYPE = 0x09, GET_CMDLINE = 0x0a, FUSER = 0x0b, GET_MACHINE_INFO = 0x64, CLOSE_HANDLE = 0x65, REG_OPEN_ITER = 0x66, REG_READ_ITER = 0x67, REG_WRITE = 0x68, REG_READ = 0x69, REG_DELETE = 0x6a, SET_TIME = 0x6b, CONFIG_OPEN = 0x6c, CONFIG_READ = 0x6d, CONFIG_WRITE = 0x6e, QUERY_OPEN = 0x6f, QUERY_READ = 0x70, QUIT_SERVER = 0xff }

#### Protected Methods

- virtual Enum<rfsv::errs> configOpen (u_int16_t &handle, u_int32_t size)
- bool sendCommand (enum commands cc, bufferStore &data)
- Enum<rfsv::errs> getResponse (bufferStore &data, bool statusIsFirstByte)
- const char * getConnectName ()

#### Protected Members

- ppsocket *skt
- Enum<rfsv::errs> status
- int mtCacheS5mx

## Detailed Description

Remote procedure call services via PLP

rpcs provides an interface for communicating with the Psion's remote procedure call service. The generic facilities for both, EPOC and SIBO are implemented here, while the facilities, unique to each of those variants are implemented in rpcs32 or rpcs16 respectively. These normally are instantiated by using rpcsfactory .

enum machs { PSI_MACH_UNKNOWN = 0, PSI_MACH_PC = 1, PSI_MACH_MC = 2, PSI_MACH_HC = 3, PSI_MACH_S3 = 4, PSI_MACH_S3A = 5, PSI_MACH_WORKABOUT = 6, PSI_MACH_SIENNA = 7, PSI_MACH_S3C = 8, PSI_MACH_S5 = 32, PSI_MACH_WINC = 33 }

### machs

The known machine types.

enum languages { PSI_LANG_TEST = 0, PSI_LANG_en_GB = 1, PSI_LANG_fr_FR = 2, PSI_LANG_de_DE = 3, PSI_LANG_es_ES = 4, PSI_LANG_it_IT = 5, PSI_LANG_sv_SE = 6, PSI_LANG_da_DK = 7, PSI_LANG_no_NO = 8, PSI_LANG_fi_FI = 9, PSI_LANG_en_US = 10, PSI_LANG_fr_CH = 11, PSI_LANG_de_CH = 12, PSI_LANG_pt_PT = 13, PSI_LANG_tr_TR = 14, PSI_LANG_is_IS = 15, PSI_LANG_ru_RU = 16, PSI_LANG_hu_HU = 17, PSI_LANG_nl_NL = 18, PSI_LANG_nl_BE = 19, PSI_LANG_en_AU = 20, PSI_LANG_fr_BE = 21, PSI_LANG_de_AT = 22, PSI_LANG_en_NZ = 23, PSI_LANG_fr_CA = 24, PSI_LANG_cs_CZ = 25, PSI_LANG_sk_SK = 26, PSI_LANG_pl_PL = 27, PSI_LANG_sl_SI = 28 }

### languages

The known interface languages.

enum batterystates { PSI_BATT_DEAD = 0, PSI_BATT_VERYLOW = 1, PSI_BATT_LOW = 2, PSI_BATT_GOOD = 3 }

### batterystates

The known battery states.

typedef struct machineInfo_t

### machineInfo_t

This struct holds the data returned by rpcs::getMachineInfo.

~rpcs ()

### ~rpcs

[virtual]

Virtual destructor.

void reset ()

### reset

Initializes a connection to the remote machine.

void reconnect ()

### reconnect

Attempts to re-establish a remote connection by first closing the socket, then connecting again to the ncpd daemon and finally calling reset.

Enum<rfsv::errs> getStatus ()

### getStatus

Retrieves the current status of the connection.

Returns: The connection status.

Enum<rfsv::errs> getNCPversion (int &major, int &minor)

### getNCPversion

Retrieves the version of the NCP protocol on the remote side.

This function is working with both SIBO and EPOC devices.

Parameters:

major | The major part of the NCP version. Valid only if returned with no error.
minor | The minor part of the NCP version. Valid only if returned with no error.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> execProgram (const char *program, const char *args)

### execProgram

Starts execution of a program on the remote machine.

This function is working with both SIBO and EPOC devices.

Parameters:

program | The full path of the executable on the remote machine
args | The arguments for this program, separated by space.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> stopProgram (const char *)

### stopProgram

Requests termination of a program running on the remote machine.

This function is working with both SIBO and EPOC devices.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> queryProgram (const char *)

### queryProgram

Enum<rfsv::errs> formatOpen (const char drive, int &handle, int &count)

### formatOpen

Starts formatting a drive.

This function is working with both SIBO and EPOC devices. After calling formatOpen, formatRead should be called n times with the returned handle where n is the value of the returned parameter count.

Parameters:

drive | The drive character to format (e.g: 'C', 'D' etc).
handle | The handle for calling formatRead is returned here.
count | The number of required calls to formatRead is returned here.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> formatRead (int handle)

### formatRead

Continues a running format.

This function is working with both SIBO and EPOC devices. Call this function with the handle, returned by formatOpen.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> getUniqueID (const char *, long &)

### getUniqueID

Enum<rfsv::errs> getOwnerInfo (bufferArray &)

### getOwnerInfo

Retrieve owner information of the remote machine.

This function is working with both SIBO and EPOC devices.

Parameters:

owner | A bufferArray, containing the lines of the owner info upon return.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> getMachineType (Enum<machs> &type)

### getMachineType

Retrieves the type of machine on the remote side as defined in machs.

This function is working with both SIBO and EPOC devices

Parameters:

type | The code describing the type of machine on the remote side is stored here on return.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> fuser (const char *name, char *buf, int maxlen)

### fuser

Retrieves the name of a process, having a given file opened on the remote side.

This function is working with both SIBO and EPOC devices

Parameters:

name | The full path of a file to be checked for being used by a program.
buf | A buffer which gets filled with the program's name.
maxlen | The maximum capacity of the buffer.

Enum<rfsv::errs> quitServer (void)

### quitServer

Requests the remote server to terminate.

This function is working with both SIBO and EPOC devices. There is usually no need to call this function, because the remote server is automatically stopped on disconnect.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> queryPrograms (processList &ret)

### queryPrograms

Retrieves a list of all running Programs.

This function works with both SIBO and EPOC.

Parameters:

ret | The list of currently running processes is returned here.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> getCmdLine (const char *process, std::string &ret)

### getCmdLine

[pure virtual]

Retrieves the command line of a running process.

This function works with both SIBO and EPOC. Note: rfsv::getPrograms calls this method internally and sets the args member of PsiProcess , so you usually don't have to call this method yourself.

Parameters:

process | Name of process. Format: processname.$pid
ret | The program name and arguments are returned here.

Returns: Psion error code. 0 = Ok.

Enum<rfsv::errs> getMachineInfo (machineInfo &)

### getMachineInfo

[virtual]

Retrieve general Information about the connected machine.

This function works with EPOC only. Using it with SIBO machines, returns always an error code E_PSI_NOT_SIBO.

Parameters:

machineInfo | The struct holding all information on return.

Returns: Psion error code. 0 = Ok.

Enum<rfsv::errs> closeHandle (u_int32_t handle)

### closeHandle

[virtual]

Release an rpcs handle.

This function works with EPOC only. Using it with SIBO machines, returns always an error code E_PSI_NOT_SIBO. It releases a handle, obtained by a previous call to rpcs::configOpen .

Parameters:

handle | The handle to close.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> regOpenIter (u_int32_t, char *, u_int16_t &)

### regOpenIter

[virtual]

Enum<rfsv::errs> regReadIter (u_int16_t)

### regReadIter

[virtual]

Enum<rfsv::errs> regWrite (void)

### regWrite

[virtual]

Enum<rfsv::errs> regRead (void)

### regRead

[virtual]

Enum<rfsv::errs> regDelete (void)

### regDelete

[virtual]

Enum<rfsv::errs> setTime (time_t time)

### setTime

[virtual]

Enum<rfsv::errs> configRead (u_int32_t size, bufferStore &data)

### configRead

[virtual]

Read from Series 5 scratch RAM

This function works with EPOC only. Using it with SIBO machines, returns always an error code E_PSI_NOT_SIBO. It reads raw data from the scratch RAM of the Series 5.

Parameters:

size | The amount of data to be read.
data | The content of the scratch RAM is returned here.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> configWrite (bufferStore data)

### configWrite

[virtual]

Write to Series 5 scratch RAM

This function works with EPOC only. Using it with SIBO machines, returns always an error code E_PSI_NOT_SIBO. It writes raw data to the scatch RAM of the Series 5.

Parameters:

data | The data to be written to the scratch RAM.

Returns: A psion error code. 0 = Ok.

Enum<rfsv::errs> queryOpen (void)

### queryOpen

[virtual]

Enum<rfsv::errs> queryRead (void)

### queryRead

[virtual]

ppsocket * skt

### skt

[protected]

Enum<rfsv::errs> status

### status

[protected]

enum commands { QUERY_NCP = 0x00, EXEC_PROG = 0x01, QUERY_DRIVE = 0x02, STOP_PROG = 0x03, QUERY_PROG = 0x04, FORMAT_OPEN = 0x05, FORMAT_READ = 0x06, GET_UNIQUEID = 0x07, GET_OWNERINFO = 0x08, GET_MACHINETYPE = 0x09, GET_CMDLINE = 0x0a, FUSER = 0x0b, GET_MACHINE_INFO = 0x64, CLOSE_HANDLE = 0x65, REG_OPEN_ITER = 0x66, REG_READ_ITER = 0x67, REG_WRITE = 0x68, REG_READ = 0x69, REG_DELETE = 0x6a, SET_TIME = 0x6b, CONFIG_OPEN = 0x6c, CONFIG_READ = 0x6d, CONFIG_WRITE = 0x6e, QUERY_OPEN = 0x6f, QUERY_READ = 0x70, QUIT_SERVER = 0xff }

### commands

[protected]

The possible commands.

int mtCacheS5mx

### mtCacheS5mx

[protected]

Enum<rfsv::errs> configOpen (u_int16_t &handle, u_int32_t size)

### configOpen

[protected virtual]

Prepare scratch RAM in Series 5 for read/write

This function works with EPOC only. Using it with SIBO machines, returns always an error code E_PSI_NOT_SIBO. It prepares a scratch area on the EPOC machine for a following use from within rpcs::configRead or rpcs::configWrite . These functions call rpcs::closeHandle on exit. The contents of the scratch area is stored in RAM of the Series 5, therefore it gets lost when the Series 5 is switched off.

Parameters:

handle | The handle to be used in rpcs::configRead , rpcs::configWrite and rpcs::closeHandle is returned here.
size | The number of bytes you want to use.

Returns: A psion error code. 0 = Ok.

bool sendCommand (enum commands cc, bufferStore &data)

### sendCommand

[protected]

Sends a command to the remote side.

If communication fails, a reconnect is triggered and a second attempt to transmit the request is attempted. If that second attempt fails, the function returns an error and sets rpcs::status to E_PSI_FILE_DISC.

Parameters:

cc | The command to execute on the remote side.
data | Additional data for this command.

Returns: true on success, false on failure.

Enum<rfsv::errs> getResponse (bufferStore &data, bool statusIsFirstByte)

### getResponse

[protected]

const char * getConnectName ()

### getConnectName

[protected]

- Author: Fritz Elfert <felfert@to.com>
- Generated: rrt on drom on Mon Nov 26 16:06:15 2007, using kdoc 2.0a54.