SHIPBridge:Class:Platform

From Serious Documentation
Jump to: navigation, search

The SHIPBridge Platform Class enables access to platform-related capabilities, such as setting/getting the current time/date, getting the SIM's serial number, etc. Within this class is the ability to access files on the platform including fixed and removable media

Details are available under NDA from Serious.

File Open Modes

When opening files in SHIPBridge, the following file access modes are available:

Mode Flag Description
SHIP_FSMODE_RD Open the file for reading. If it does not exist, the call will fail unless the SHIP_FSMODE_NEW flag is also set. The file pointer will be set to the beginning of the file unless the SHIP_FSMODE_APPEND flag is set.
SHIP_FSMODE_WR Open the file for writing. If it does not exist, the call will fail unless the SHIP_FSMODE_NEW flag is also set. The file pointer will be set to the beginning of the file unless the SHIP_FSMODE_APPEND flag is set.
SHIP_FSMODE_CREATE When opening the file for read or write, if the file does not exist it will be created.
SHIP_FSMODE_NOPREEXIST When opening the file for read or write with SHIP_FSMODE_CREATE, only open and create the file if it does not already exist.
SHIP_FSMODE_APPEND When opening the file for read or write, start the file pointer at the end of the file.
SHIP_FSMODE_TRUNC If the file exists when opening the file for write, truncate its length to 0.

To map these to the equivalent Posix modes used in the familiar fopen() API:

Posix Mode Flags Description
“r” or “rb” SHIP_FSMODE_RD Open for reading. Fails if file does not exist. File pointer starts at the beginning of the file.
“w” or “wb” SHIP_FSMODE_WR

SHIP_FSMODE_CREATE

SHIP_FSMODE_TRUNC

Open for writing. File is created if it does not exist, otherwise it is truncated to zero length. File pointer starts at the beginning of the file.
“a” or “ab” SHIP_FSMODE_WR

SHIP_FSMODE_CREATE

SHIP_FSMODE_APPEND

Open for writing. Create file if it does not exist. File pointer starts at the end of the file.
“r+” or “rb+” or “r+b” SHIP_FSMODE_RD

SHIP_FSMODE_WR

Open for reading/writing. Fails if file does not exist. File pointer starts at the beginning of the file.
“w+” or “wb+” or “w+b” SHIP_FSMODE_RD

SHIP_FSMODE_WR

SHIP_FSMODE_CREATE

SHIP_FSMODE_TRUNC

Open for reading/writing. File is created if it does not exist, otherwise it is truncated to zero length. File pointer starts at the beginning of the file.
“a+” or “ab+” or “a+b” SHIP_FSMODE_RD

SHIP_FSMODE_WR

SHIP_FSMODE_CREATE

SHIP_FSMODE_APPEND

Open for reading/writing. Create file if it does not exist. File pointer starts at the end of the file.

See Also