Go - RED Brick

This is the description of the Go API bindings for the RED Brick. General information and technical specifications for the RED Brick are summarized in its hardware description.

An installation guide for the Go API bindings is part of their general description. Additional documentation can be found on godoc.org.

Examples

The example code below is Public Domain (CC0 1.0).

API

The RED Brick's API is defined in the package github.com/Tinkerforge/go-api-bindings/red_brick

Nearly every function of the Go bindings can return an BrickletError, implementing the error interface. The error can have one of the following values:

  • BrickletErrorSuccess = 0
  • BrickletErrorInvalidParameter = 1
  • BrickletErrorFunctionNotSupported = 2
  • BrickletErrorUnknownError = 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. (*REDBrick) AllocateString and (*REDBrick) GetNextDirectoryEntry) increase the reference count of the returned object. If the object is no longer needed then (*REDBrick) 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 (*REDBrick) ReleaseObject must not be called for such an object in response to a callback.

There are functions (e.g. (*REDBrick) GetFileInfo) that only return valid objects under certain conditions. This conditions are documented for the specific functions. For invalid objects (*REDBrick) ReleaseObject must not be called.

There are also function (e.g. (*REDBrick) 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 ErrorCode, sessionId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)ExpireSession(sessionId uint16)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)ExpireSessionUnchecked(sessionId uint16)(err error)
func (*REDBrick)KeepSessionAlive(sessionId uint16, lifetime uint32)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)ReleaseObject(objectId uint16, sessionId uint16)(errorCode ErrorCode, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)ReleaseObjectUnchecked(objectId uint16, sessionId uint16)(err error)
func (*REDBrick)AllocateString(lengthToReserve uint32, buffer string, sessionId uint16)(errorCode ErrorCode, stringId uint16, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)TruncateString(stringId uint16, length uint32)(errorCode ErrorCode, err error)

Truncates a string object to length bytes and returns the resulting error code.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetStringLength(stringId uint16)(errorCode ErrorCode, length uint32, err error)

Returns the length of a string object in bytes and the resulting error code.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)SetStringChunk(stringId uint16, offset uint32, buffer string)(errorCode ErrorCode, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetStringChunk(stringId uint16, offset uint32)(errorCode ErrorCode, buffer string, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)AllocateList(lengthToReserve uint16, sessionId uint16)(errorCode ErrorCode, listId uint16, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetListLength(listId uint16)(errorCode ErrorCode, length uint16, err error)

Returns the length of a list object in items and the resulting error code.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetListItem(listId uint16, index uint16, sessionId uint16)(errorCode ErrorCode, itemObjectId uint16, type_ ObjectType, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • ObjectTypeString = 0
  • ObjectTypeList = 1
  • ObjectTypeFile = 2
  • ObjectTypeDirectory = 3
  • ObjectTypeProcess = 4
  • ObjectTypeProgram = 5
func (*REDBrick)AppendToList(listId uint16, itemObjectId uint16)(errorCode ErrorCode, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)RemoveFromList(listId uint16, index uint16)(errorCode ErrorCode, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)OpenFile(nameStringId uint16, flags FileFlag, permissions FilePermission, uid uint32, gid uint32, sessionId uint16)(errorCode ErrorCode, fileId uint16, err 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:

  • FileFlagReadOnly = 1
  • FileFlagWriteOnly = 2
  • FileFlagReadWrite = 4
  • FileFlagAppend = 8
  • FileFlagCreate = 16
  • FileFlagExclusive = 32
  • FileFlagNonBlocking = 64
  • FileFlagTruncate = 128
  • FileFlagTemporary = 256
  • FileFlagReplace = 512
  • FilePermissionUserAll = 448
  • FilePermissionUserRead = 256
  • FilePermissionUserWrite = 128
  • FilePermissionUserExecute = 64
  • FilePermissionGroupAll = 56
  • FilePermissionGroupRead = 32
  • FilePermissionGroupWrite = 16
  • FilePermissionGroupExecute = 8
  • FilePermissionOthersAll = 7
  • FilePermissionOthersRead = 4
  • FilePermissionOthersWrite = 2
  • FilePermissionOthersExecute = 1
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)CreatePipe(flags PipeFlag, length uint64, sessionId uint16)(errorCode ErrorCode, fileId uint16, err 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:

  • PipeFlagNonBlockingRead = 1
  • PipeFlagNonBlockingWrite = 2
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetFileInfo(fileId uint16, sessionId uint16)(errorCode ErrorCode, type_ FileType, nameStringId uint16, flags uint32, permissions FilePermission, uid uint32, gid uint32, length uint64, accessTimestamp uint64, modificationTimestamp uint64, statusChangeTimestamp uint64, err 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 (*REDBrick) OpenFile.

The returned flags were used to open or create the file object, as passed to (*REDBrick) OpenFile or (*REDBrick) 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • FileTypeUnknown = 0
  • FileTypeRegular = 1
  • FileTypeDirectory = 2
  • FileTypeCharacter = 3
  • FileTypeBlock = 4
  • FileTypeFIFO = 5
  • FileTypeSymlink = 6
  • FileTypeSocket = 7
  • FileTypePipe = 8
  • FilePermissionUserAll = 448
  • FilePermissionUserRead = 256
  • FilePermissionUserWrite = 128
  • FilePermissionUserExecute = 64
  • FilePermissionGroupAll = 56
  • FilePermissionGroupRead = 32
  • FilePermissionGroupWrite = 16
  • FilePermissionGroupExecute = 8
  • FilePermissionOthersAll = 7
  • FilePermissionOthersRead = 4
  • FilePermissionOthersWrite = 2
  • FilePermissionOthersExecute = 1
func (*REDBrick)ReadFile(fileId uint16, lengthToRead uint8)(errorCode ErrorCode, buffer [62]uint8, lengthRead uint8, err 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 (*REDBrick) OpenFile without the NonBlocking flag or by (*REDBrick) CreatePipe without the NonBlockingRead flag then the error code NotSupported is returned.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)ReadFileAsync(fileId uint16, lengthToRead uint64)(err error)

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 (*REDBrick) RegisterAsyncFileReadCallback 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 (*REDBrick) OpenFile without the NonBlocking flag or by (*REDBrick) CreatePipe without the NonBlockingRead flag then the error code NotSupported is reported via the (*REDBrick) RegisterAsyncFileReadCallback callback.

func (*REDBrick)AbortAsyncFileRead(fileId uint16)(errorCode ErrorCode, err error)

Aborts a (*REDBrick) ReadFileAsync operation in progress.

Returns the resulting error code.

On success the (*REDBrick) RegisterAsyncFileReadCallback callback will report OperationAborted.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)WriteFile(fileId uint16, buffer [61]uint8, lengthToWrite uint8)(errorCode ErrorCode, lengthWritten uint8, err 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 (*REDBrick) OpenFile without the NonBlocking flag or by (*REDBrick) CreatePipe without the NonBlockingWrite flag then the error code NotSupported is returned.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)WriteFileUnchecked(fileId uint16, buffer [61]uint8, lengthToWrite uint8)(err error)

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 (*REDBrick) OpenFile without the NonBlocking flag or by (*REDBrick) CreatePipe without the NonBlockingWrite flag then the write operation will fail silently.

func (*REDBrick)WriteFileAsync(fileId uint16, buffer [61]uint8, lengthToWrite uint8)(err error)

Writes up to 61 bytes to a file object.

Reports the actual number of bytes written and the resulting error code via the (*REDBrick) RegisterAsyncFileWriteCallback callback.

If the file object was created by (*REDBrick) OpenFile without the NonBlocking flag or by (*REDBrick) CreatePipe without the NonBlockingWrite flag then the error code NotSupported is reported via the (*REDBrick) RegisterAsyncFileWriteCallback callback.

func (*REDBrick)SetFilePosition(fileId uint16, offset int64, origin FileOrigin)(errorCode ErrorCode, position uint64, err error)

Set the current seek position of a file object in bytes 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 (*REDBrick) CreatePipe then it has no seek position and the error code InvalidSeek is returned.

The following constants are available for this function:

  • FileOriginBeginning = 0
  • FileOriginCurrent = 1
  • FileOriginEnd = 2
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetFilePosition(fileId uint16)(errorCode ErrorCode, position uint64, err error)

Returns the current seek position of a file object in bytes and returns the resulting error code.

If the file object was created by (*REDBrick) CreatePipe then it has no seek position and the error code InvalidSeek is returned.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)SetFileEvents(fileId uint16, events FileEvent)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • FileEventReadable = 1
  • FileEventWritable = 2
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetFileEvents(fileId uint16)(errorCode ErrorCode, events FileEvent, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • FileEventReadable = 1
  • FileEventWritable = 2
func (*REDBrick)OpenDirectory(nameStringId uint16, sessionId uint16)(errorCode ErrorCode, directoryId uint16, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetDirectoryName(directoryId uint16, sessionId uint16)(errorCode ErrorCode, nameStringId uint16, err error)

Returns the name of a directory object, as passed to (*REDBrick) OpenDirectory, and the resulting error code.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetNextDirectoryEntry(directoryId uint16, sessionId uint16)(errorCode ErrorCode, nameStringId uint16, type_ DirectoryEntryType, err 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 (*REDBrick) 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • DirectoryEntryTypeUnknown = 0
  • DirectoryEntryTypeRegular = 1
  • DirectoryEntryTypeDirectory = 2
  • DirectoryEntryTypeCharacter = 3
  • DirectoryEntryTypeBlock = 4
  • DirectoryEntryTypeFIFO = 5
  • DirectoryEntryTypeSymlink = 6
  • DirectoryEntryTypeSocket = 7
func (*REDBrick)RewindDirectory(directoryId uint16)(errorCode ErrorCode, err error)

Rewinds a directory object and returns the resulting error code.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)CreateDirectory(nameStringId uint16, flags DirectoryFlag, permissions FilePermission, uid uint32, gid uint32)(errorCode ErrorCode, err error)

FIXME: name has to be absolute

The following constants are available for this function:

  • DirectoryFlagRecursive = 1
  • DirectoryFlagExclusive = 2
  • FilePermissionUserAll = 448
  • FilePermissionUserRead = 256
  • FilePermissionUserWrite = 128
  • FilePermissionUserExecute = 64
  • FilePermissionGroupAll = 56
  • FilePermissionGroupRead = 32
  • FilePermissionGroupWrite = 16
  • FilePermissionGroupExecute = 8
  • FilePermissionOthersAll = 7
  • FilePermissionOthersRead = 4
  • FilePermissionOthersWrite = 2
  • FilePermissionOthersExecute = 1
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProcesses(sessionId uint16)(errorCode ErrorCode, processesListId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • 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 ErrorCode, processId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)KillProcess(processId uint16, signal ProcessSignal)(errorCode ErrorCode, err 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:

  • ProcessSignalInterrupt = 2
  • ProcessSignalQuit = 3
  • ProcessSignalAbort = 6
  • ProcessSignalKill = 9
  • ProcessSignalUser1 = 10
  • ProcessSignalUser2 = 12
  • ProcessSignalTerminate = 15
  • ProcessSignalContinue = 18
  • ProcessSignalStop = 19
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProcessCommand(processId uint16, sessionId uint16)(errorCode ErrorCode, executableStringId uint16, argumentsListId uint16, environmentListId uint16, workingDirectoryStringId uint16, err error)

Returns the executable, arguments, environment and working directory used to spawn a process object, as passed to (*REDBrick) SpawnProcess, and the resulting error code.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProcessIdentity(processId uint16)(errorCode ErrorCode, pid uint32, uid uint32, gid uint32, err error)

Returns the process ID and the user and group ID used to spawn a process object, as passed to (*REDBrick) SpawnProcess, and the resulting error code.

The process ID is only valid if the state is Running or Stopped, see (*REDBrick) GetProcessState.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProcessStdio(processId uint16, sessionId uint16)(errorCode ErrorCode, stdinFileId uint16, stdoutFileId uint16, stderrFileId uint16, err error)

Returns the stdin, stdout and stderr files used to spawn a process object, as passed to (*REDBrick) SpawnProcess, and the resulting error code.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProcessState(processId uint16)(errorCode ErrorCode, state ProcessState, timestamp uint64, exitCode uint8, err 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:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • ProcessStateUnknown = 0
  • ProcessStateRunning = 1
  • ProcessStateError = 2
  • ProcessStateExited = 3
  • ProcessStateKilled = 4
  • ProcessStateStopped = 5
func (*REDBrick)GetPrograms(sessionId uint16)(errorCode ErrorCode, programsListId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)DefineProgram(identifierStringId uint16, sessionId uint16)(errorCode ErrorCode, programId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)PurgeProgram(programId uint16, cookie uint32)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProgramIdentifier(programId uint16, sessionId uint16)(errorCode ErrorCode, identifierStringId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProgramRootDirectory(programId uint16, sessionId uint16)(errorCode ErrorCode, rootDirectoryStringId uint16, err error)

FIXME: root directory is absolute: <home>/programs/<identifier>

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)SetProgramCommand(programId uint16, executableStringId uint16, argumentsListId uint16, environmentListId uint16, workingDirectoryStringId uint16)(errorCode ErrorCode, err error)

FIXME: working directory is relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProgramCommand(programId uint16, sessionId uint16)(errorCode ErrorCode, executableStringId uint16, argumentsListId uint16, environmentListId uint16, workingDirectoryStringId uint16, err error)

FIXME: working directory is relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)SetProgramStdioRedirection(programId uint16, stdinRedirection ProgramStdioRedirection, stdinFileNameStringId uint16, stdoutRedirection ProgramStdioRedirection, stdoutFileNameStringId uint16, stderrRedirection ProgramStdioRedirection, stderrFileNameStringId uint16)(errorCode ErrorCode, err error)

FIXME: stdio file names are relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

  • ProgramStdioRedirectionDevNull = 0
  • ProgramStdioRedirectionPipe = 1
  • ProgramStdioRedirectionFile = 2
  • ProgramStdioRedirectionIndividualLog = 3
  • ProgramStdioRedirectionContinuousLog = 4
  • ProgramStdioRedirectionStdout = 5
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProgramStdioRedirection(programId uint16, sessionId uint16)(errorCode ErrorCode, stdinRedirection ProgramStdioRedirection, stdinFileNameStringId uint16, stdoutRedirection ProgramStdioRedirection, stdoutFileNameStringId uint16, stderrRedirection ProgramStdioRedirection, stderrFileNameStringId uint16, err error)

FIXME: stdio file names are relative to <home>/programs/<identifier>/bin

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • ProgramStdioRedirectionDevNull = 0
  • ProgramStdioRedirectionPipe = 1
  • ProgramStdioRedirectionFile = 2
  • ProgramStdioRedirectionIndividualLog = 3
  • ProgramStdioRedirectionContinuousLog = 4
  • ProgramStdioRedirectionStdout = 5
func (*REDBrick)SetProgramSchedule(programId uint16, startMode ProgramStartMode, continueAfterError bool, startInterval uint32, startFieldsStringId uint16)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ProgramStartModeNever = 0
  • ProgramStartModeAlways = 1
  • ProgramStartModeInterval = 2
  • ProgramStartModeCron = 3
  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetProgramSchedule(programId uint16, sessionId uint16)(errorCode ErrorCode, startMode ProgramStartMode, continueAfterError bool, startInterval uint32, startFieldsStringId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • ProgramStartModeNever = 0
  • ProgramStartModeAlways = 1
  • ProgramStartModeInterval = 2
  • ProgramStartModeCron = 3
func (*REDBrick)GetProgramSchedulerState(programId uint16, sessionId uint16)(errorCode ErrorCode, state ProgramSchedulerState, timestamp uint64, messageStringId uint16, err error)

FIXME: message is currently valid in error-occurred state only

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
  • ProgramSchedulerStateStopped = 0
  • ProgramSchedulerStateRunning = 1
func (*REDBrick)ContinueProgramSchedule(programId uint16)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)StartProgram(programId uint16)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetLastSpawnedProgramProcess(programId uint16, sessionId uint16)(errorCode ErrorCode, processId uint16, timestamp uint64, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetCustomProgramOptionNames(programId uint16, sessionId uint16)(errorCode ErrorCode, namesListId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)SetCustomProgramOptionValue(programId uint16, nameStringId uint16, valueStringId uint16)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetCustomProgramOptionValue(programId uint16, nameStringId uint16, sessionId uint16)(errorCode ErrorCode, valueStringId uint16, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)RemoveCustomProgramOption(programId uint16, nameStringId uint16)(errorCode ErrorCode, err error)

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)GetAPIVersion()(apiVersion [3]uint8, err error)

Returns the version of the API definition (major, minor, revision) 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)

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 (*REDBrick) 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 send and errors are silently ignored, because they cannot be detected.

See (*REDBrick) SetResponseExpected for the list of function ID constants available for this function.

func (*REDBrick)SetResponseExpected(functionId uint8, responseExpected bool)(err error)

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 send and errors are silently ignored, because they cannot be detected.

The following function ID constants are available for this function:

  • FunctionExpireSessionUnchecked = 3
  • FunctionReleaseObjectUnchecked = 6
  • FunctionReadFileAsync = 21
  • FunctionWriteFileUnchecked = 24
  • FunctionWriteFileAsync = 25
func (*REDBrick)SetResponseExpectedAll(responseExpected bool)(err error)

Changes the response expected flag for all setter and callback configuration functions of this device at once.

func (*REDBrick)GetIdentity()(uid string, connectedUid string, position rune, hardwareVersion [3]uint8, firmwareVersion [3]uint8, deviceIdentifier uint16, err 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 can be '0'-'8' (stack position).

The device identifier numbers can be found here. There is also a constant for the device identifier of this Brick.

Callback Configuration Functions

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.

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 ErrorCode, buffer [60]uint8, lengthRead uint8))(callbackID uint64)

A callback can be registered for this event with the RegisterAsyncFileReadCallback() function. This function returns the ID of the registered callback. An added callback can be removed with the DeregisterAsyncFileReadCallback(callbackID uint64) function.

This callback reports the result of a call to the (*REDBrick) ReadFileAsync function.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)RegisterAsyncFileWriteCallback(func(fileId uint16, errorCode ErrorCode, lengthWritten uint8))(callbackID uint64)

A callback can be registered for this event with the RegisterAsyncFileWriteCallback() function. This function returns the ID of the registered callback. An added callback can be removed with the DeregisterAsyncFileWriteCallback(callbackID uint64) function.

This callback reports the result of a call to the (*REDBrick) WriteFileAsync function.

The following constants are available for this function:

  • ErrorCodeSuccess = 0
  • ErrorCodeUnknownError = 1
  • ErrorCodeInvalidOperation = 2
  • ErrorCodeOperationAborted = 3
  • ErrorCodeInternalError = 4
  • ErrorCodeUnknownSessionId = 5
  • ErrorCodeNoFreeSessionId = 6
  • ErrorCodeUnknownObjectId = 7
  • ErrorCodeNoFreeObjectId = 8
  • ErrorCodeObjectIsLocked = 9
  • ErrorCodeNoMoreData = 10
  • ErrorCodeWrongListItemType = 11
  • ErrorCodeProgramIsPurged = 12
  • ErrorCodeInvalidParameter = 128
  • ErrorCodeNoFreeMemory = 129
  • ErrorCodeNoFreeSpace = 130
  • ErrorCodeAccessDenied = 121
  • ErrorCodeAlreadyExists = 132
  • ErrorCodeDoesNotExist = 133
  • ErrorCodeInterrupted = 134
  • ErrorCodeIsDirectory = 135
  • ErrorCodeNotADirectory = 136
  • ErrorCodeWouldBlock = 137
  • ErrorCodeOverflow = 138
  • ErrorCodeBadFileDescriptor = 139
  • ErrorCodeOutOfRange = 140
  • ErrorCodeNameTooLong = 141
  • ErrorCodeInvalidSeek = 142
  • ErrorCodeNotSupported = 143
  • ErrorCodeTooManyOpenFiles = 144
func (*REDBrick)RegisterFileEventsOccurredCallback(func(fileId uint16, events FileEvent))(callbackID uint64)

A callback can be registered for this event with the RegisterFileEventsOccurredCallback() function. This function returns the ID of the registered callback. An added callback can be removed with the DeregisterFileEventsOccurredCallback(callbackID uint64) function.

The following constants are available for this function:

  • FileEventReadable = 1
  • FileEventWritable = 2
func (*REDBrick)RegisterProcessStateChangedCallback(func(processId uint16, state ProcessState, timestamp uint64, exitCode uint8))(callbackID uint64)

A callback can be registered for this event with the RegisterProcessStateChangedCallback() function. This function returns the ID of the registered callback. An added callback can be removed with the DeregisterProcessStateChangedCallback(callbackID uint64) function.

The following constants are available for this function:

  • ProcessStateUnknown = 0
  • ProcessStateRunning = 1
  • ProcessStateError = 2
  • ProcessStateExited = 3
  • ProcessStateKilled = 4
  • ProcessStateStopped = 5
func (*REDBrick)RegisterProgramSchedulerStateChangedCallback(func(programId uint16))(callbackID uint64)

A callback can be registered for this event with the RegisterProgramSchedulerStateChangedCallback() function. This function returns the ID of the registered callback. An added callback can be removed with the DeregisterProgramSchedulerStateChangedCallback(callbackID uint64) function.

func (*REDBrick)RegisterProgramProcessSpawnedCallback(func(programId uint16))(callbackID uint64)

A callback can be registered for this event with the RegisterProgramProcessSpawnedCallback() function. This function returns the ID of the registered callback. An added callback can be removed with the DeregisterProgramProcessSpawnedCallback(callbackID uint64) function.

Constants

red_brick.DeviceIdentifier

This constant is used to identify a RED Brick.

The (*REDBrick) GetIdentity function and the (*IPConnection) RegisterEnumerateCallback callback of the IP Connection 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.