API
The RED Brick API is defined in the package github.com/Tinkerforge/go-api-bindings/red_brick
Nearly every function of the Go bindings can return an
ipconnection.DeviceError
, implementing the error interface. The error can have one of the following values:
- ipconnection.DeviceErrorSuccess = 0
- ipconnection.DeviceErrorInvalidParameter = 1
- ipconnection.DeviceErrorFunctionNotSupported = 2
- ipconnection.DeviceErrorUnknownError = 3
which correspond to the values returned from Bricks and Bricklets.
All functions listed below are thread-safe.
Note
The API documentation for the RED Brick is currently incomplete.
The RED Brick API is meant to be used by the Brick Viewer to implement the
offered functionality (getting status information, managing programs etc.).
Normal users will not need to use this API, it may only be interesting for
power users.
FIXME: explain sessions
The RED Brick API operates on reference counted objects (strings, lists, files,
directories, processes and programs) that are identified by their 16bit object
ID. Functions that allocate or return an object ID (e.g. AllocateString()
and GetNextDirectoryEntry()
) increase the reference count of the returned
object. If the object is no longer needed then ReleaseObject()
has to
be called to decrease the reference count of the object again. In contrast to
allocation and getter functions, the reference count for an object returned by
a callback is not increased and ReleaseObject()
must not be called for
such an object in response to a callback.
There are functions (e.g. GetFileInfo()
) that only return valid objects
under certain conditions. This conditions are documented for the specific
functions. For invalid objects ReleaseObject()
must not be called.
There are also function (e.g. SetProgramStdioRedirection()
) that have
conditionally unused object parameters. Under which conditions an object
parameter is unused is documented for the specific functions. For unused
object parameters 0 has to be passed as object ID.
The RED Brick API is more complex then the typical Brick API and requires more
elaborate error reporting than the TCP/IP protocol
can provide with its 2bit error code. Therefore, almost all functions of the
RED Brick API return an 8bit error code. Possible error codes are:
- Success = 0
- UnknownError = 1
- InvalidOperation = 2
- OperationAborted = 3
- InternalError = 4
- UnknownSessionID = 5
- NoFreeSessionID = 6
- UnknownObjectID = 7
- NoFreeObjectID = 8
- ObjectIsLocked = 9
- NoMoreData = 10
- WrongListItemType = 11
- ProgramIsPurged = 12
- InvalidParameter = 128 (EINVAL)
- NoFreeMemory = 129 (ENOMEM)
- NoFreeSpace = 130 (ENOSPC)
- AccessDenied = 131 (EACCES)
- AlreadyExists = 132 (EEXIST)
- DoesNotExist = 133 (ENOENT)
- Interrupted = 134 (EINTR)
- IsDirectory = 135 (EISDIR)
- NotADirectory = 136 (ENOTDIR)
- WouldBlock = 137 (EWOULDBLOCK)
- Overflow = 138 (EOVERFLOW)
- BadFileDescriptor = 139 (EBADF)
- OutOfRange = 140 (ERANGE)
- NameTooLong = 141 (ENAMETOOLONG)
- InvalidSeek = 142 (ESPIPE)
- NotSupported = 143 (ENOTSUP)
- TooManyOpenFiles = 144 (EMFILE)
If a function returns an error code other than Success then its other
return values (if any) are invalid and must not be used.
The error code InvalidOperation is returned if the requested operation cannot
be performed because the current state of the object does not allow it. For
example, trying to append an item to a full list object or trying to undefine
an already undefined program.
The error code NotSupported is returned if the requested operation can never
be performed. For example, trying to append a list object to itself, trying to
get the name of a file object with type Pipe or trying to create a directory
non-recursively with more than the last part of the directory name referring
to non-existing directories.
String objects store UTF-8 encoded data.
Advanced Functions
-
func
(*REDBrick)
CreateSession
(lifetime uint32) (errorCode uint8, sessionId uint16, err error)
Parameters: | - lifetime – Type: uint32, Range: [0 to 232 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- sessionId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
ExpireSession
(sessionId uint16) (errorCode uint8, err error)
Parameters: | - sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
ExpireSessionUnchecked
(sessionId uint16) (err error)
Parameters: | - sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | |
-
func
(*REDBrick)
KeepSessionAlive
(sessionId uint16, lifetime uint32) (errorCode uint8, err error)
Parameters: | - sessionId – Type: uint16, Range: [0 to 216 - 1]
- lifetime – Type: uint32, Range: [0 to 232 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
ReleaseObject
(objectId uint16, sessionId uint16) (errorCode uint8, err error)
Parameters: | - objectId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Decreases the reference count of an object by one and returns the resulting
error code. If the reference count reaches zero the object gets destroyed.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
ReleaseObjectUnchecked
(objectId uint16, sessionId uint16) (err error)
Parameters: | - objectId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | |
-
func
(*REDBrick)
AllocateString
(lengthToReserve uint32, buffer string, sessionId uint16) (errorCode uint8, stringId uint16, err error)
Parameters: | - lengthToReserve – Type: uint32, Unit: 1 B, Range: [0 to 232 - 1]
- buffer – Type: string, Length: up to 58
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- stringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Allocates a new string object, reserves length_to_reserve
bytes memory
for it and sets up to the first 60 bytes. Set length_to_reserve
to the
length of the string that should be stored in the string object.
Returns the object ID of the new string object and the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
TruncateString
(stringId uint16, length uint32) (errorCode uint8, err error)
Parameters: | - stringId – Type: uint16, Range: [0 to 216 - 1]
- length – Type: uint32, Unit: 1 B, Range: [0 to 232 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Truncates a string object to length
bytes and returns the resulting
error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetStringLength
(stringId uint16) (errorCode uint8, length uint32, err error)
Parameters: | - stringId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- length – Type: uint32, Unit: 1 B, Range: [0 to 232 - 1]
- err – Type: error
|
Returns the length of a string object and the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
SetStringChunk
(stringId uint16, offset uint32, buffer string) (errorCode uint8, err error)
Parameters: | - stringId – Type: uint16, Range: [0 to 216 - 1]
- offset – Type: uint32, Unit: 1 B, Range: [0 to 232 - 1]
- buffer – Type: string, Length: up to 58
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Sets a chunk of up to 58 bytes in a string object beginning at offset
.
Returns the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetStringChunk
(stringId uint16, offset uint32) (errorCode uint8, buffer string, err error)
Parameters: | - stringId – Type: uint16, Range: [0 to 216 - 1]
- offset – Type: uint32, Unit: 1 B, Range: [0 to 232 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- buffer – Type: string, Length: up to 63
- err – Type: error
|
Returns a chunk up to 63 bytes from a string object beginning at offset
and
returns the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
AllocateList
(lengthToReserve uint16, sessionId uint16) (errorCode uint8, listId uint16, err error)
Parameters: | - lengthToReserve – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- listId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Allocates a new list object and reserves memory for length_to_reserve
items. Set length_to_reserve
to the number of items that should be stored
in the list object.
Returns the object ID of the new list object and the resulting error code.
When a list object gets destroyed then the reference count of each object in
the list object is decreased by one.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetListLength
(listId uint16) (errorCode uint8, length uint16, err error)
Parameters: | - listId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- length – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Returns the length of a list object in items and the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetListItem
(listId uint16, index uint16, sessionId uint16) (errorCode uint8, itemObjectId uint16, type_ uint8, err error)
Parameters: | - listId – Type: uint16, Range: [0 to 216 - 1]
- index – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- itemObjectId – Type: uint16, Range: [0 to 216 - 1]
- type – Type: uint8, Range: See constants
- err – Type: error
|
Returns the object ID and type of the object stored at index
in a list
object and returns the resulting error code.
Possible object types are:
- String = 0
- List = 1
- File = 2
- Directory = 3
- Process = 4
- Program = 5
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For type:
- red_brick.ObjectTypeString = 0
- red_brick.ObjectTypeList = 1
- red_brick.ObjectTypeFile = 2
- red_brick.ObjectTypeDirectory = 3
- red_brick.ObjectTypeProcess = 4
- red_brick.ObjectTypeProgram = 5
-
func
(*REDBrick)
AppendToList
(listId uint16, itemObjectId uint16) (errorCode uint8, err error)
Parameters: | - listId – Type: uint16, Range: [0 to 216 - 1]
- itemObjectId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Appends an object to a list object and increases the reference count of the
appended object by one.
Returns the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
RemoveFromList
(listId uint16, index uint16) (errorCode uint8, err error)
Parameters: | - listId – Type: uint16, Range: [0 to 216 - 1]
- index – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Removes the object stored at index
from a list object and decreases the
reference count of the removed object by one.
Returns the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
OpenFile
(nameStringId uint16, flags uint32, permissions uint16, uid uint32, gid uint32, sessionId uint16) (errorCode uint8, fileId uint16, err error)
Parameters: | - nameStringId – Type: uint16, Range: [0 to 216 - 1]
- flags – Type: uint32, Range: See constants
- permissions – Type: uint16, Range: See constants
- uid – Type: uint32, Range: [0 to 232 - 1]
- gid – Type: uint32, Range: [0 to 232 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- fileId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Opens an existing file or creates a new file and allocates a new file object
for it.
FIXME: name has to be absolute
The reference count of the name string object is increased by one. When the
file object gets destroyed then the reference count of the name string object is
decreased by one. Also the name string object is locked and cannot be modified
while the file object holds a reference to it.
The flags
parameter takes a ORed combination of the following possible file
flags (in hexadecimal notation):
- ReadOnly = 0x0001 (O_RDONLY)
- WriteOnly = 0x0002 (O_WRONLY)
- ReadWrite = 0x0004 (O_RDWR)
- Append = 0x0008 (O_APPEND)
- Create = 0x0010 (O_CREAT)
- Exclusive = 0x0020 (O_EXCL)
- NonBlocking = 0x0040 (O_NONBLOCK)
- Truncate = 0x0080 (O_TRUNC)
- Temporary = 0x0100
- Replace = 0x0200
FIXME: explain Temporary and Replace flag
The permissions
parameter takes a ORed combination of the following
possible file permissions (in octal notation) that match the common UNIX
permission bits:
- UserRead = 00400
- UserWrite = 00200
- UserExecute = 00100
- GroupRead = 00040
- GroupWrite = 00020
- GroupExecute = 00010
- OthersRead = 00004
- OthersWrite = 00002
- OthersExecute = 00001
Returns the object ID of the new file object and the resulting error code.
The following constants are available for this function:
For flags:
- red_brick.FileFlagReadOnly = 1
- red_brick.FileFlagWriteOnly = 2
- red_brick.FileFlagReadWrite = 4
- red_brick.FileFlagAppend = 8
- red_brick.FileFlagCreate = 16
- red_brick.FileFlagExclusive = 32
- red_brick.FileFlagNonBlocking = 64
- red_brick.FileFlagTruncate = 128
- red_brick.FileFlagTemporary = 256
- red_brick.FileFlagReplace = 512
For permissions:
- red_brick.FilePermissionUserAll = 448
- red_brick.FilePermissionUserRead = 256
- red_brick.FilePermissionUserWrite = 128
- red_brick.FilePermissionUserExecute = 64
- red_brick.FilePermissionGroupAll = 56
- red_brick.FilePermissionGroupRead = 32
- red_brick.FilePermissionGroupWrite = 16
- red_brick.FilePermissionGroupExecute = 8
- red_brick.FilePermissionOthersAll = 7
- red_brick.FilePermissionOthersRead = 4
- red_brick.FilePermissionOthersWrite = 2
- red_brick.FilePermissionOthersExecute = 1
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
CreatePipe
(flags uint32, length uint64, sessionId uint16) (errorCode uint8, fileId uint16, err error)
Parameters: | - flags – Type: uint32, Range: See constants
- length – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- fileId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Creates a new pipe and allocates a new file object for it.
The flags
parameter takes a ORed combination of the following possible
pipe flags (in hexadecimal notation):
- NonBlockingRead = 0x0001
- NonBlockingWrite = 0x0002
The length of the pipe buffer can be specified with the length
parameter
in bytes. If length is set to zero, then the default pipe buffer length is used.
Returns the object ID of the new file object and the resulting error code.
The following constants are available for this function:
For flags:
- red_brick.PipeFlagNonBlockingRead = 1
- red_brick.PipeFlagNonBlockingWrite = 2
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetFileInfo
(fileId uint16, sessionId uint16) (errorCode uint8, type_ uint8, nameStringId uint16, flags uint32, permissions uint16, uid uint32, gid uint32, length uint64, accessTimestamp uint64, modificationTimestamp uint64, statusChangeTimestamp uint64, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- type – Type: uint8, Range: See constants
- nameStringId – Type: uint16, Range: [0 to 216 - 1]
- flags – Type: uint32, Range: See constants
- permissions – Type: uint16, Range: See constants
- uid – Type: uint32, Range: [0 to 232 - 1]
- gid – Type: uint32, Range: [0 to 232 - 1]
- length – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]
- accessTimestamp – Type: uint64, Range: [0 to 264 - 1]
- modificationTimestamp – Type: uint64, Range: [0 to 264 - 1]
- statusChangeTimestamp – Type: uint64, Range: [0 to 264 - 1]
- err – Type: error
|
Returns various information about a file and the resulting error code.
Possible file types are:
- Unknown = 0
- Regular = 1
- Directory = 2
- Character = 3
- Block = 4
- FIFO = 5
- Symlink = 6
- Socket = 7
- Pipe = 8
If the file type is Pipe then the returned name string object is invalid,
because a pipe has no name. Otherwise the returned name string object was used
to open or create the file object, as passed to OpenFile()
.
The returned flags were used to open or create the file object, as passed to
OpenFile()
or CreatePipe()
. See the respective function for a list
of possible file and pipe flags.
FIXME: everything except flags and length is invalid if file type is Pipe
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For type:
- red_brick.FileTypeUnknown = 0
- red_brick.FileTypeRegular = 1
- red_brick.FileTypeDirectory = 2
- red_brick.FileTypeCharacter = 3
- red_brick.FileTypeBlock = 4
- red_brick.FileTypeFIFO = 5
- red_brick.FileTypeSymlink = 6
- red_brick.FileTypeSocket = 7
- red_brick.FileTypePipe = 8
For flags:
- red_brick.FileFlagReadOnly = 1
- red_brick.FileFlagWriteOnly = 2
- red_brick.FileFlagReadWrite = 4
- red_brick.FileFlagAppend = 8
- red_brick.FileFlagCreate = 16
- red_brick.FileFlagExclusive = 32
- red_brick.FileFlagNonBlocking = 64
- red_brick.FileFlagTruncate = 128
- red_brick.FileFlagTemporary = 256
- red_brick.FileFlagReplace = 512
For permissions:
- red_brick.FilePermissionUserAll = 448
- red_brick.FilePermissionUserRead = 256
- red_brick.FilePermissionUserWrite = 128
- red_brick.FilePermissionUserExecute = 64
- red_brick.FilePermissionGroupAll = 56
- red_brick.FilePermissionGroupRead = 32
- red_brick.FilePermissionGroupWrite = 16
- red_brick.FilePermissionGroupExecute = 8
- red_brick.FilePermissionOthersAll = 7
- red_brick.FilePermissionOthersRead = 4
- red_brick.FilePermissionOthersWrite = 2
- red_brick.FilePermissionOthersExecute = 1
-
func
(*REDBrick)
ReadFile
(fileId uint16, lengthToRead uint8) (errorCode uint8, buffer [62]uint8, lengthRead uint8, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- lengthToRead – Type: uint8, Unit: 1 B, Range: [0 to 255]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- buffer – Type: [62]uint8, Range: [0 to 255]
- lengthRead – Type: uint8, Unit: 1 B, Range: [0 to 255]
- err – Type: error
|
Reads up to 62 bytes from a file object.
Returns the bytes read, the actual number of bytes read and the resulting
error code.
If there is not data to be read, either because the file position reached
end-of-file or because there is not data in the pipe, then zero bytes are
returned.
If the file object was created by OpenFile()
without the NonBlocking
flag or by CreatePipe()
without the NonBlockingRead flag then the
error code NotSupported is returned.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
ReadFileAsync
(fileId uint16, lengthToRead uint64) (err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- lengthToRead – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]
|
Returns: | |
Reads up to 263 - 1 bytes from a file object asynchronously.
Reports the bytes read (in 60 byte chunks), the actual number of bytes read and
the resulting error code via the AsyncFileReadCallback
callback.
If there is not data to be read, either because the file position reached
end-of-file or because there is not data in the pipe, then zero bytes are
reported.
If the file object was created by OpenFile()
without the NonBlocking
flag or by CreatePipe()
without the NonBlockingRead flag then the error
code NotSupported is reported via the AsyncFileReadCallback
callback.
-
func
(*REDBrick)
AbortAsyncFileRead
(fileId uint16) (errorCode uint8, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Aborts a ReadFileAsync()
operation in progress.
Returns the resulting error code.
On success the AsyncFileReadCallback
callback will report OperationAborted.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
WriteFile
(fileId uint16, buffer [61]uint8, lengthToWrite uint8) (errorCode uint8, lengthWritten uint8, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- buffer – Type: [61]uint8, Range: [0 to 255]
- lengthToWrite – Type: uint8, Unit: 1 B, Range: [0 to 255]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- lengthWritten – Type: uint8, Unit: 1 B, Range: [0 to 255]
- err – Type: error
|
Writes up to 61 bytes to a file object.
Returns the actual number of bytes written and the resulting error code.
If the file object was created by OpenFile()
without the NonBlocking
flag or by CreatePipe()
without the NonBlockingWrite flag then the
error code NotSupported is returned.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
WriteFileUnchecked
(fileId uint16, buffer [61]uint8, lengthToWrite uint8) (err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- buffer – Type: [61]uint8, Range: [0 to 255]
- lengthToWrite – Type: uint8, Unit: 1 B, Range: [0 to 255]
|
Returns: | |
Writes up to 61 bytes to a file object.
Does neither report the actual number of bytes written nor the resulting error
code.
If the file object was created by OpenFile()
without the NonBlocking
flag or by CreatePipe()
without the NonBlockingWrite flag then the
write operation will fail silently.
-
func
(*REDBrick)
WriteFileAsync
(fileId uint16, buffer [61]uint8, lengthToWrite uint8) (err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- buffer – Type: [61]uint8, Range: [0 to 255]
- lengthToWrite – Type: uint8, Unit: 1 B, Range: [0 to 255]
|
Returns: | |
Writes up to 61 bytes to a file object.
Reports the actual number of bytes written and the resulting error code via the
AsyncFileWriteCallback
callback.
If the file object was created by OpenFile()
without the NonBlocking
flag or by CreatePipe()
without the NonBlockingWrite flag then the
error code NotSupported is reported via the AsyncFileWriteCallback
callback.
-
func
(*REDBrick)
SetFilePosition
(fileId uint16, offset int64, origin uint8) (errorCode uint8, position uint64, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- offset – Type: int64, Unit: 1 B, Range: [-263 to 263 - 1]
- origin – Type: uint8, Range: See constants
|
Returns: | - errorCode – Type: uint8, Range: See constants
- position – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]
- err – Type: error
|
Set the current seek position of a file object relative to origin
.
Possible file origins are:
- Beginning = 0
- Current = 1
- End = 2
Returns the resulting absolute seek position and error code.
If the file object was created by CreatePipe()
then it has no seek
position and the error code InvalidSeek is returned.
The following constants are available for this function:
For origin:
- red_brick.FileOriginBeginning = 0
- red_brick.FileOriginCurrent = 1
- red_brick.FileOriginEnd = 2
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetFilePosition
(fileId uint16) (errorCode uint8, position uint64, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- position – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]
- err – Type: error
|
Returns the current seek position of a file object and returns the
resulting error code.
If the file object was created by CreatePipe()
then it has no seek
position and the error code InvalidSeek is returned.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
SetFileEvents
(fileId uint16, events uint16) (errorCode uint8, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- events – Type: uint16, Range: See constants
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For events:
- red_brick.FileEventReadable = 1
- red_brick.FileEventWritable = 2
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetFileEvents
(fileId uint16) (errorCode uint8, events uint16, err error)
Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- events – Type: uint16, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For events:
- red_brick.FileEventReadable = 1
- red_brick.FileEventWritable = 2
-
func
(*REDBrick)
OpenDirectory
(nameStringId uint16, sessionId uint16) (errorCode uint8, directoryId uint16, err error)
Parameters: | - nameStringId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- directoryId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Opens an existing directory and allocates a new directory object for it.
FIXME: name has to be absolute
The reference count of the name string object is increased by one. When the
directory object is destroyed then the reference count of the name string
object is decreased by one. Also the name string object is locked and cannot be
modified while the directory object holds a reference to it.
Returns the object ID of the new directory object and the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetDirectoryName
(directoryId uint16, sessionId uint16) (errorCode uint8, nameStringId uint16, err error)
Parameters: | - directoryId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- nameStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Returns the name of a directory object, as passed to OpenDirectory()
, and
the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetNextDirectoryEntry
(directoryId uint16, sessionId uint16) (errorCode uint8, nameStringId uint16, type_ uint8, err error)
Parameters: | - directoryId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- nameStringId – Type: uint16, Range: [0 to 216 - 1]
- type – Type: uint8, Range: See constants
- err – Type: error
|
Returns the next entry in a directory object and the resulting error code.
If there is not next entry then error code NoMoreData is returned. To rewind
a directory object call RewindDirectory()
.
Possible directory entry types are:
- Unknown = 0
- Regular = 1
- Directory = 2
- Character = 3
- Block = 4
- FIFO = 5
- Symlink = 6
- Socket = 7
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For type:
- red_brick.DirectoryEntryTypeUnknown = 0
- red_brick.DirectoryEntryTypeRegular = 1
- red_brick.DirectoryEntryTypeDirectory = 2
- red_brick.DirectoryEntryTypeCharacter = 3
- red_brick.DirectoryEntryTypeBlock = 4
- red_brick.DirectoryEntryTypeFIFO = 5
- red_brick.DirectoryEntryTypeSymlink = 6
- red_brick.DirectoryEntryTypeSocket = 7
-
func
(*REDBrick)
RewindDirectory
(directoryId uint16) (errorCode uint8, err error)
Parameters: | - directoryId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Rewinds a directory object and returns the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
CreateDirectory
(nameStringId uint16, flags uint32, permissions uint16, uid uint32, gid uint32) (errorCode uint8, err error)
Parameters: | - nameStringId – Type: uint16, Range: [0 to 216 - 1]
- flags – Type: uint32, Range: See constants
- permissions – Type: uint16, Range: See constants
- uid – Type: uint32, Range: [0 to 232 - 1]
- gid – Type: uint32, Range: [0 to 232 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
FIXME: name has to be absolute
The following constants are available for this function:
For flags:
- red_brick.DirectoryFlagRecursive = 1
- red_brick.DirectoryFlagExclusive = 2
For permissions:
- red_brick.FilePermissionUserAll = 448
- red_brick.FilePermissionUserRead = 256
- red_brick.FilePermissionUserWrite = 128
- red_brick.FilePermissionUserExecute = 64
- red_brick.FilePermissionGroupAll = 56
- red_brick.FilePermissionGroupRead = 32
- red_brick.FilePermissionGroupWrite = 16
- red_brick.FilePermissionGroupExecute = 8
- red_brick.FilePermissionOthersAll = 7
- red_brick.FilePermissionOthersRead = 4
- red_brick.FilePermissionOthersWrite = 2
- red_brick.FilePermissionOthersExecute = 1
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProcesses
(sessionId uint16) (errorCode uint8, processesListId uint16, err error)
Parameters: | - sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- processesListId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
SpawnProcess
(executableStringId uint16, argumentsListId uint16, environmentListId uint16, workingDirectoryStringId uint16, uid uint32, gid uint32, stdinFileId uint16, stdoutFileId uint16, stderrFileId uint16, sessionId uint16) (errorCode uint8, processId uint16, err error)
Parameters: | - executableStringId – Type: uint16, Range: [0 to 216 - 1]
- argumentsListId – Type: uint16, Range: [0 to 216 - 1]
- environmentListId – Type: uint16, Range: [0 to 216 - 1]
- workingDirectoryStringId – Type: uint16, Range: [0 to 216 - 1]
- uid – Type: uint32, Range: [0 to 232 - 1]
- gid – Type: uint32, Range: [0 to 232 - 1]
- stdinFileId – Type: uint16, Range: [0 to 216 - 1]
- stdoutFileId – Type: uint16, Range: [0 to 216 - 1]
- stderrFileId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- processId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
KillProcess
(processId uint16, signal uint8) (errorCode uint8, err error)
Parameters: | - processId – Type: uint16, Range: [0 to 216 - 1]
- signal – Type: uint8, Range: See constants
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
Sends a UNIX signal to a process object and returns the resulting error code.
Possible UNIX signals are:
- Interrupt = 2
- Quit = 3
- Abort = 6
- Kill = 9
- User1 = 10
- User2 = 12
- Terminate = 15
- Continue = 18
- Stop = 19
The following constants are available for this function:
For signal:
- red_brick.ProcessSignalInterrupt = 2
- red_brick.ProcessSignalQuit = 3
- red_brick.ProcessSignalAbort = 6
- red_brick.ProcessSignalKill = 9
- red_brick.ProcessSignalUser1 = 10
- red_brick.ProcessSignalUser2 = 12
- red_brick.ProcessSignalTerminate = 15
- red_brick.ProcessSignalContinue = 18
- red_brick.ProcessSignalStop = 19
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProcessCommand
(processId uint16, sessionId uint16) (errorCode uint8, executableStringId uint16, argumentsListId uint16, environmentListId uint16, workingDirectoryStringId uint16, err error)
Parameters: | - processId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- executableStringId – Type: uint16, Range: [0 to 216 - 1]
- argumentsListId – Type: uint16, Range: [0 to 216 - 1]
- environmentListId – Type: uint16, Range: [0 to 216 - 1]
- workingDirectoryStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Returns the executable, arguments, environment and working directory used to
spawn a process object, as passed to SpawnProcess()
, and the resulting
error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProcessIdentity
(processId uint16) (errorCode uint8, pid uint32, uid uint32, gid uint32, err error)
Parameters: | - processId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- pid – Type: uint32, Range: [0 to 232 - 1]
- uid – Type: uint32, Range: [0 to 232 - 1]
- gid – Type: uint32, Range: [0 to 232 - 1]
- err – Type: error
|
Returns the process ID and the user and group ID used to spawn a process object,
as passed to SpawnProcess()
, and the resulting error code.
The process ID is only valid if the state is Running or Stopped, see
GetProcessState()
.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProcessStdio
(processId uint16, sessionId uint16) (errorCode uint8, stdinFileId uint16, stdoutFileId uint16, stderrFileId uint16, err error)
Parameters: | - processId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- stdinFileId – Type: uint16, Range: [0 to 216 - 1]
- stdoutFileId – Type: uint16, Range: [0 to 216 - 1]
- stderrFileId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Returns the stdin, stdout and stderr files used to spawn a process object, as
passed to SpawnProcess()
, and the resulting error code.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProcessState
(processId uint16) (errorCode uint8, state uint8, timestamp uint64, exitCode uint8, err error)
Parameters: | - processId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- state – Type: uint8, Range: See constants
- timestamp – Type: uint64, Range: [0 to 264 - 1]
- exitCode – Type: uint8, Range: [0 to 255]
- err – Type: error
|
Returns the current state, timestamp and exit code of a process object, and
the resulting error code.
Possible process states are:
- Unknown = 0
- Running = 1
- Error = 2
- Exited = 3
- Killed = 4
- Stopped = 5
The timestamp represents the UNIX time since when the process is in its current
state.
The exit code is only valid if the state is Error, Exited, Killed or
Stopped and has different meanings depending on the state:
- Error: error code for error occurred while spawning the process (see below)
- Exited: exit status of the process
- Killed: UNIX signal number used to kill the process
- Stopped: UNIX signal number used to stop the process
Possible exit/error codes in Error state are:
- InternalError = 125
- CannotExecute = 126
- DoesNotExist = 127
The CannotExecute error can be caused by the executable being opened for
writing.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For state:
- red_brick.ProcessStateUnknown = 0
- red_brick.ProcessStateRunning = 1
- red_brick.ProcessStateError = 2
- red_brick.ProcessStateExited = 3
- red_brick.ProcessStateKilled = 4
- red_brick.ProcessStateStopped = 5
-
func
(*REDBrick)
GetPrograms
(sessionId uint16) (errorCode uint8, programsListId uint16, err error)
Parameters: | - sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- programsListId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
DefineProgram
(identifierStringId uint16, sessionId uint16) (errorCode uint8, programId uint16, err error)
Parameters: | - identifierStringId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- programId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
PurgeProgram
(programId uint16, cookie uint32) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- cookie – Type: uint32, Range: [0 to 232 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProgramIdentifier
(programId uint16, sessionId uint16) (errorCode uint8, identifierStringId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- identifierStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProgramRootDirectory
(programId uint16, sessionId uint16) (errorCode uint8, rootDirectoryStringId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- rootDirectoryStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
FIXME: root directory is absolute: <home>/programs/<identifier>
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
SetProgramCommand
(programId uint16, executableStringId uint16, argumentsListId uint16, environmentListId uint16, workingDirectoryStringId uint16) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- executableStringId – Type: uint16, Range: [0 to 216 - 1]
- argumentsListId – Type: uint16, Range: [0 to 216 - 1]
- environmentListId – Type: uint16, Range: [0 to 216 - 1]
- workingDirectoryStringId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
FIXME: working directory is relative to <home>/programs/<identifier>/bin
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProgramCommand
(programId uint16, sessionId uint16) (errorCode uint8, executableStringId uint16, argumentsListId uint16, environmentListId uint16, workingDirectoryStringId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- executableStringId – Type: uint16, Range: [0 to 216 - 1]
- argumentsListId – Type: uint16, Range: [0 to 216 - 1]
- environmentListId – Type: uint16, Range: [0 to 216 - 1]
- workingDirectoryStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
FIXME: working directory is relative to <home>/programs/<identifier>/bin
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
SetProgramStdioRedirection
(programId uint16, stdinRedirection uint8, stdinFileNameStringId uint16, stdoutRedirection uint8, stdoutFileNameStringId uint16, stderrRedirection uint8, stderrFileNameStringId uint16) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- stdinRedirection – Type: uint8, Range: See constants
- stdinFileNameStringId – Type: uint16, Range: [0 to 216 - 1]
- stdoutRedirection – Type: uint8, Range: See constants
- stdoutFileNameStringId – Type: uint16, Range: [0 to 216 - 1]
- stderrRedirection – Type: uint8, Range: See constants
- stderrFileNameStringId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
FIXME: stdio file names are relative to <home>/programs/<identifier>/bin
The following constants are available for this function:
For stdinRedirection:
- red_brick.ProgramStdioRedirectionDevNull = 0
- red_brick.ProgramStdioRedirectionPipe = 1
- red_brick.ProgramStdioRedirectionFile = 2
- red_brick.ProgramStdioRedirectionIndividualLog = 3
- red_brick.ProgramStdioRedirectionContinuousLog = 4
- red_brick.ProgramStdioRedirectionStdout = 5
For stdoutRedirection:
- red_brick.ProgramStdioRedirectionDevNull = 0
- red_brick.ProgramStdioRedirectionPipe = 1
- red_brick.ProgramStdioRedirectionFile = 2
- red_brick.ProgramStdioRedirectionIndividualLog = 3
- red_brick.ProgramStdioRedirectionContinuousLog = 4
- red_brick.ProgramStdioRedirectionStdout = 5
For stderrRedirection:
- red_brick.ProgramStdioRedirectionDevNull = 0
- red_brick.ProgramStdioRedirectionPipe = 1
- red_brick.ProgramStdioRedirectionFile = 2
- red_brick.ProgramStdioRedirectionIndividualLog = 3
- red_brick.ProgramStdioRedirectionContinuousLog = 4
- red_brick.ProgramStdioRedirectionStdout = 5
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProgramStdioRedirection
(programId uint16, sessionId uint16) (errorCode uint8, stdinRedirection uint8, stdinFileNameStringId uint16, stdoutRedirection uint8, stdoutFileNameStringId uint16, stderrRedirection uint8, stderrFileNameStringId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- stdinRedirection – Type: uint8, Range: See constants
- stdinFileNameStringId – Type: uint16, Range: [0 to 216 - 1]
- stdoutRedirection – Type: uint8, Range: See constants
- stdoutFileNameStringId – Type: uint16, Range: [0 to 216 - 1]
- stderrRedirection – Type: uint8, Range: See constants
- stderrFileNameStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
FIXME: stdio file names are relative to <home>/programs/<identifier>/bin
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For stdinRedirection:
- red_brick.ProgramStdioRedirectionDevNull = 0
- red_brick.ProgramStdioRedirectionPipe = 1
- red_brick.ProgramStdioRedirectionFile = 2
- red_brick.ProgramStdioRedirectionIndividualLog = 3
- red_brick.ProgramStdioRedirectionContinuousLog = 4
- red_brick.ProgramStdioRedirectionStdout = 5
For stdoutRedirection:
- red_brick.ProgramStdioRedirectionDevNull = 0
- red_brick.ProgramStdioRedirectionPipe = 1
- red_brick.ProgramStdioRedirectionFile = 2
- red_brick.ProgramStdioRedirectionIndividualLog = 3
- red_brick.ProgramStdioRedirectionContinuousLog = 4
- red_brick.ProgramStdioRedirectionStdout = 5
For stderrRedirection:
- red_brick.ProgramStdioRedirectionDevNull = 0
- red_brick.ProgramStdioRedirectionPipe = 1
- red_brick.ProgramStdioRedirectionFile = 2
- red_brick.ProgramStdioRedirectionIndividualLog = 3
- red_brick.ProgramStdioRedirectionContinuousLog = 4
- red_brick.ProgramStdioRedirectionStdout = 5
-
func
(*REDBrick)
SetProgramSchedule
(programId uint16, startMode uint8, continueAfterError bool, startInterval uint32, startFieldsStringId uint16) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- startMode – Type: uint8, Range: See constants
- continueAfterError – Type: bool
- startInterval – Type: uint32, Range: [0 to 232 - 1]
- startFieldsStringId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For startMode:
- red_brick.ProgramStartModeNever = 0
- red_brick.ProgramStartModeAlways = 1
- red_brick.ProgramStartModeInterval = 2
- red_brick.ProgramStartModeCron = 3
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetProgramSchedule
(programId uint16, sessionId uint16) (errorCode uint8, startMode uint8, continueAfterError bool, startInterval uint32, startFieldsStringId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- startMode – Type: uint8, Range: See constants
- continueAfterError – Type: bool
- startInterval – Type: uint32, Range: [0 to 232 - 1]
- startFieldsStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For startMode:
- red_brick.ProgramStartModeNever = 0
- red_brick.ProgramStartModeAlways = 1
- red_brick.ProgramStartModeInterval = 2
- red_brick.ProgramStartModeCron = 3
-
func
(*REDBrick)
GetProgramSchedulerState
(programId uint16, sessionId uint16) (errorCode uint8, state uint8, timestamp uint64, messageStringId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- state – Type: uint8, Range: See constants
- timestamp – Type: uint64, Range: [0 to 264 - 1]
- messageStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
FIXME: message is currently valid in error-occurred state only
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
For state:
- red_brick.ProgramSchedulerStateStopped = 0
- red_brick.ProgramSchedulerStateRunning = 1
-
func
(*REDBrick)
ContinueProgramSchedule
(programId uint16) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
StartProgram
(programId uint16) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetLastSpawnedProgramProcess
(programId uint16, sessionId uint16) (errorCode uint8, processId uint16, timestamp uint64, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- processId – Type: uint16, Range: [0 to 216 - 1]
- timestamp – Type: uint64, Range: [0 to 264 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetCustomProgramOptionNames
(programId uint16, sessionId uint16) (errorCode uint8, namesListId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- namesListId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
SetCustomProgramOptionValue
(programId uint16, nameStringId uint16, valueStringId uint16) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- nameStringId – Type: uint16, Range: [0 to 216 - 1]
- valueStringId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetCustomProgramOptionValue
(programId uint16, nameStringId uint16, sessionId uint16) (errorCode uint8, valueStringId uint16, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- nameStringId – Type: uint16, Range: [0 to 216 - 1]
- sessionId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- valueStringId – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
RemoveCustomProgramOption
(programId uint16, nameStringId uint16) (errorCode uint8, err error)
Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
- nameStringId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - errorCode – Type: uint8, Range: See constants
- err – Type: error
|
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
GetIdentity
() (uid string, connectedUid string, position rune, hardwareVersion [3]uint8, firmwareVersion [3]uint8, deviceIdentifier uint16, err error)
Returns: | - uid – Type: string, Length: up to 8
- connectedUid – Type: string, Length: up to 8
- position – Type: rune, Range: ['0' to '8']
- hardwareVersion – Type: [3]uint8
- 0: major – Type: uint8, Range: [0 to 255]
- 1: minor – Type: uint8, Range: [0 to 255]
- 2: revision – Type: uint8, Range: [0 to 255]
- firmwareVersion – Type: [3]uint8
- 0: major – Type: uint8, Range: [0 to 255]
- 1: minor – Type: uint8, Range: [0 to 255]
- 2: revision – Type: uint8, Range: [0 to 255]
- deviceIdentifier – Type: uint16, Range: [0 to 216 - 1]
- err – Type: error
|
Returns the UID, the UID where the Brick is connected to,
the position, the hardware and firmware version as well as the
device identifier.
The position is the position in the stack from '0' (bottom) to '8' (top).
The device identifier numbers can be found here.
There is also a constant for the device identifier of this Brick.
Callbacks
Callbacks can be registered to receive
time critical or recurring data from the device. The registration is done
with the corresponding Register*Callback
function, which returns a unique callback ID.
This ID can be used to deregister the callback later with the corresponding Deregister*Callback
function.
Note
Using callbacks for recurring events is always preferred
compared to using getters. It will use less USB bandwidth and the latency
will be a lot better, since there is no round trip time.
-
func
(*REDBrick)
RegisterAsyncFileReadCallback
(func(fileId uint16, errorCode uint8, buffer [60]uint8, lengthRead uint8)) (registrationId uint64)
Callback Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- errorCode – Type: uint8, Range: See constants
- buffer – Type: [60]uint8, Range: [0 to 255]
- lengthRead – Type: uint8, Unit: 1 B, Range: [0 to 255]
|
Returns: | - registrationId – Type: uint64
|
This callback reports the result of a call to the ReadFileAsync()
function.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
RegisterAsyncFileWriteCallback
(func(fileId uint16, errorCode uint8, lengthWritten uint8)) (registrationId uint64)
Callback Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- errorCode – Type: uint8, Range: See constants
- lengthWritten – Type: uint8, Unit: 1 B, Range: [0 to 255]
|
Returns: | - registrationId – Type: uint64
|
This callback reports the result of a call to the WriteFileAsync()
function.
The following constants are available for this function:
For errorCode:
- red_brick.ErrorCodeSuccess = 0
- red_brick.ErrorCodeUnknownError = 1
- red_brick.ErrorCodeInvalidOperation = 2
- red_brick.ErrorCodeOperationAborted = 3
- red_brick.ErrorCodeInternalError = 4
- red_brick.ErrorCodeUnknownSessionId = 5
- red_brick.ErrorCodeNoFreeSessionId = 6
- red_brick.ErrorCodeUnknownObjectId = 7
- red_brick.ErrorCodeNoFreeObjectId = 8
- red_brick.ErrorCodeObjectIsLocked = 9
- red_brick.ErrorCodeNoMoreData = 10
- red_brick.ErrorCodeWrongListItemType = 11
- red_brick.ErrorCodeProgramIsPurged = 12
- red_brick.ErrorCodeInvalidParameter = 128
- red_brick.ErrorCodeNoFreeMemory = 129
- red_brick.ErrorCodeNoFreeSpace = 130
- red_brick.ErrorCodeAccessDenied = 121
- red_brick.ErrorCodeAlreadyExists = 132
- red_brick.ErrorCodeDoesNotExist = 133
- red_brick.ErrorCodeInterrupted = 134
- red_brick.ErrorCodeIsDirectory = 135
- red_brick.ErrorCodeNotADirectory = 136
- red_brick.ErrorCodeWouldBlock = 137
- red_brick.ErrorCodeOverflow = 138
- red_brick.ErrorCodeBadFileDescriptor = 139
- red_brick.ErrorCodeOutOfRange = 140
- red_brick.ErrorCodeNameTooLong = 141
- red_brick.ErrorCodeInvalidSeek = 142
- red_brick.ErrorCodeNotSupported = 143
- red_brick.ErrorCodeTooManyOpenFiles = 144
-
func
(*REDBrick)
RegisterFileEventsOccurredCallback
(func(fileId uint16, events uint16)) (registrationId uint64)
Callback Parameters: | - fileId – Type: uint16, Range: [0 to 216 - 1]
- events – Type: uint16, Range: See constants
|
Returns: | - registrationId – Type: uint64
|
The following constants are available for this function:
For events:
- red_brick.FileEventReadable = 1
- red_brick.FileEventWritable = 2
-
func
(*REDBrick)
RegisterProcessStateChangedCallback
(func(processId uint16, state uint8, timestamp uint64, exitCode uint8)) (registrationId uint64)
Callback Parameters: | - processId – Type: uint16, Range: [0 to 216 - 1]
- state – Type: uint8, Range: See constants
- timestamp – Type: uint64, Range: [0 to 264 - 1]
- exitCode – Type: uint8, Range: [0 to 255]
|
Returns: | - registrationId – Type: uint64
|
The following constants are available for this function:
For state:
- red_brick.ProcessStateUnknown = 0
- red_brick.ProcessStateRunning = 1
- red_brick.ProcessStateError = 2
- red_brick.ProcessStateExited = 3
- red_brick.ProcessStateKilled = 4
- red_brick.ProcessStateStopped = 5
-
func
(*REDBrick)
RegisterProgramSchedulerStateChangedCallback
(func(programId uint16)) (registrationId uint64)
Callback Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - registrationId – Type: uint64
|
-
func
(*REDBrick)
RegisterProgramProcessSpawnedCallback
(func(programId uint16)) (registrationId uint64)
Callback Parameters: | - programId – Type: uint16, Range: [0 to 216 - 1]
|
Returns: | - registrationId – Type: uint64
|
Virtual Functions
Virtual functions don't communicate with the device itself, but operate only on
the API bindings device object. They can be called without the corresponding
IP Connection object being connected.
-
func
(*REDBrick)
GetAPIVersion
() (apiVersion [3]uint8, err error)
Returns: | - apiVersion – Type: [3]uint8
- 0: major – Type: uint8, Range: [0 to 255]
- 1: minor – Type: uint8, Range: [0 to 255]
- 2: revision – Type: uint8, Range: [0 to 255]
- err – Type: error
|
Returns the version of the API definition implemented
by this API bindings. This is neither the release version of this API bindings
nor does it tell you anything about the represented Brick or Bricklet.
-
func
(*REDBrick)
GetResponseExpected
(functionId uint8) (responseExpected bool, err error)
Parameters: | - functionId – Type: uint8, Range: See constants
|
Returns: | - responseExpected – Type: bool
- err – Type: error
|
Returns the response expected flag for the function specified by the function
ID parameter. It is true if the function is expected to send a response,
false otherwise.
For getter functions this is enabled by default and cannot be disabled,
because those functions will always send a response. For callback configuration
functions it is enabled by default too, but can be disabled by
SetResponseExpected()
. For setter functions it is disabled by default
and can be enabled.
Enabling the response expected flag for a setter function allows to detect
timeouts and other error conditions calls of this setter as well. The
device will then send a response for this purpose. If this flag is disabled for
a setter function then no response is sent and errors are silently ignored,
because they cannot be detected.
The following constants are available for this function:
For functionId:
- red_brick.FunctionExpireSessionUnchecked = 3
- red_brick.FunctionReleaseObjectUnchecked = 6
- red_brick.FunctionReadFileAsync = 21
- red_brick.FunctionWriteFileUnchecked = 24
- red_brick.FunctionWriteFileAsync = 25
-
func
(*REDBrick)
SetResponseExpected
(functionId uint8, responseExpected bool) (err error)
Parameters: | - functionId – Type: uint8, Range: See constants
- responseExpected – Type: bool
|
Returns: | |
Changes the response expected flag of the function specified by the
function ID parameter. This flag can only be changed for setter (default value:
false) and callback configuration functions (default value: true). For
getter functions it is always enabled.
Enabling the response expected flag for a setter function allows to detect
timeouts and other error conditions calls of this setter as well. The
device will then send a response for this purpose. If this flag is disabled for
a setter function then no response is sent and errors are silently ignored,
because they cannot be detected.
The following constants are available for this function:
For functionId:
- red_brick.FunctionExpireSessionUnchecked = 3
- red_brick.FunctionReleaseObjectUnchecked = 6
- red_brick.FunctionReadFileAsync = 21
- red_brick.FunctionWriteFileUnchecked = 24
- red_brick.FunctionWriteFileAsync = 25
-
func
(*REDBrick)
SetResponseExpectedAll
(responseExpected bool) (err error)
Parameters: | - responseExpected – Type: bool
|
Returns: | |
Changes the response expected flag for all setter and callback configuration
functions of this device at once.
Constants
-
red_brick.
DeviceIdentifier
This constant is used to identify a RED Brick.
The GetIdentity()
function and
the (*IPConnection) RegisterEnumerateCallback
callback of the IPConnection have a deviceIdentifier
parameter to specify
the Brick's or Bricklet's type.
-
red_brick.
DeviceDisplayName
This constant represents the human readable name of a RED Brick.