Class IoAPI
#include <IoAPI.h >
This class is used by other apps to send messages to the io channel.
Use this interface instead of sending messages directly to ensure message keywords are spelled correctly, all parameters are specified, and error checked.
The receiving app defined this interface to ensure it receives the messages correctly.
const string& name |
the name of the registered I/O resource |
const string& mode |
like open(1), modes allowed are: r, rw, w, r+, w+, a; b is ignored - it is assumed |
const string& cbtag |
base callback keyword to handle various messages sent to app using the resource. Use the IoPort class to manage. Variously, "open", "eof", "tell" will be added to this cbtag. |
const XMLData& cbdata |
callback data sent to the app with every message sent to app using the resoruce |
Open the named resource in the mode specified. A named resource maps to a URL (see tioreg, which iogw uses to locate and open the resource. iogw then sends data and status messages back for the resource.
Return value: true if sent
int ioId |
the instance of the I/O resource |
int c |
the character to output |
const string& ioChannel |
name of channel to reach the spoke Default value: "io" |
Send a character (identified as c) to the device.
Return value: true if sent to iogw
int ioId |
the instance of the I/O resource |
const string& text |
the text string to output |
const string& ioChannel |
name of channel to reach the spoke Default value: "io" |
Send some text (identified as text) to the device. text is simply a series of characters. No implied newline.
Return value: true if sent to iogw
int ioId |
the instance of the I/O resource |
const RawData& data |
the block of data to output |
const string& ioChannel |
name of channel to reach the spoke Default value: "io" |
Send a block of data to the device.
Return value: true if sent to iogw
int ioId |
the instance of the I/O resource |
long offset |
the file position to seek |
const string& ioChannel |
name of channel to reach the spoke Default value: "io" |
Move to a specific file position in the resource.
This does not apply to streaming data sources.
Return value: true if sent to iogw
int ioId |
|
bool exclusive |
Flag: true if nothing else allowed to read or write to this resource, false if other apps can read this resource Default value: true |
bool wait |
Flag: true if app should wait until the lock has been released - this will block the app Default value: true |
const string& ioChannel |
Default value: "io" |
Attempt to lock access to this resource/file.
If an exclusive lock has already been obtained, then it can be switched to shared.
Return value: true if the lock was acquired, false if it was not acquired
int ioId |
|
bool exclusive |
Flag: true if nothing else allowed to read or write to this resource, false if other apps can read this resource Default value: true |
bool wait |
Flag: true if app should wait until the lock has been released - this will block the app Default value: true |
const string& ioChannel |
Default value: "io" |
Attempt to lock access to this resource/file.
If an exclusive lock has already been obtained, then it can be switched to shared.
Return value: true if the lock was acquired, false if it was not acquired
int ioId |
the instance of the I/O resource |
const string& ioChannel |
name of channel to reach the spoke Default value: "io" |
Tell iogw that the app no longer needs access to this resource.
Return value: true if sent
const FSNode& node |
the file/dir node to check for existance |
const string& ioChannel |
name of channel to reach the spoke Default value: "io" |
Internal iogw only; not for app use.
Reach out to iogw on a spoke to verify a file still exists.
The spoke is expected to reply with fsconfirm() or fsupdate().
Return value: true if sent
DbRecNum dirResourceId |
the IORegistry record id for the directory/file path |
const string& ioChannel |
name of channel to reach the spoke Default value: "io" |
Internal iogw only; not for app use.
Reach out to iogw on a spoke to verify directory contents of the resource id provided.
Reply with fsupdate() for each directory entry.
Return value: true if sent
const FSNode& node |
the file/dir node to check for existance |
long size |
for regular files, the file size |
Internal iogw only; not for app use.
A spoke is informing the hub iogw about a file that still exists.
Return value: true if sent
const FSNode& node |
the file/dir node to check for existance |
const string& change |
one of: deleted, newdir, newfile |
long size |
for regular files, the file size Default value: -1 |
Internal iogw only; not for app use.
A spoke is informing the hub iogw about a file that still exists.
Return value: true if sent
const string& maepath |
the MAE directory path |
Given a MAE directory path, return a list of all files under it.
A filename with a trailing / is a directory.
Return value: Resulting data from the call. Use RemoteService::getError(result) to get any error; if no error, then call worked.
const string& maepathandfilename |
the MAE full filename or directory to check |
MaeStat& statbuf |
(output) a structure to contain the various details about the pathname |
Given a MAE directory path, return details about it.
A filename must begin with /. If there's no leading /, then maepathandfilename is taken as an IORegistry name.
Return value: errno for the operation: 0 upon success ENOENT if file does not exist
const string& request |
the request keyword |
const XMLData& params |
the data (parameter payload) Default value: XMLData("") |
const string& channel |
override where message is sent (default: io) Default value: "io" |
Send an API message to channel io.