Delphi/Lazarus - RED Brick

This is the description of the Delphi/Lazarus 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 Delphi/Lazarus API bindings is part of their general description.

Examples

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

Read File

Download (ExampleReadFile.pas)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
program ExampleReadFile;

{$ifdef MSWINDOWS}{$apptype CONSOLE}{$endif}
{$ifdef FPC}{$mode OBJFPC}{$H+}{$endif}

uses
  SysUtils, IPConnection, BrickRED;

type
  TExample = class
  private
    ipcon: TIPConnection;
    red: TBrickRED;
  public
    procedure CheckError(context: string; errorCode: byte);
    function AllocateString(sessionId: word; buffer: string): word;
    procedure ReadFile(remotePath: string; localPath: string);
    procedure Execute;
  end;

const
  HOST = 'localhost';
  PORT = 4223;
  UID = 'XXYYZZ'; { Change XXYYZZ to the UID of your RED Brick }

var
  e: TExample;

procedure TExample.CheckError(context: string; errorCode: byte);
begin
  if (errorCode <> 0) then begin
    raise Exception.Create(Format('%s error occurred: %d', [context, errorCode]));
  end;
end;

function TExample.AllocateString(sessionId: word; buffer: string): word;
var errorCode: byte; stringId: word;
begin
  if (Length(buffer) > 60) then begin
    { FIXME: Currently this helper function only supports strings up to 60 characters }
    raise Exception.Create('String too long');
  end;
  red.AllocateString(Length(buffer), buffer, sessionId, errorCode, stringId);
  CheckError('AllocateString', errorCode);
  result := stringId;
end;

procedure TExample.ReadFile(remotePath: string; localPath: string);
var errorCode: byte; sessionId: word; remotePathStringId: word; remoteFileId: word;
    buffer: TArray0To61OfUInt8; lengthRead: byte; localFile: file; counter: longint;
begin
  { Create session }
  red.CreateSession(60, errorCode, sessionId);
  CheckError('CreateSession', errorCode);

  { Wrap remote path string }
  remotePathStringId := AllocateString(sessionId, remotePath);

  { Open remote file for reading }
  red.OpenFile(remotePathStringId, BRICK_RED_FILE_FLAG_READ_ONLY or BRICK_RED_FILE_FLAG_NON_BLOCKING,
               0, 0, 0, sessionId, errorCode, remoteFileId);
  CheckError('OpenFile', errorCode);

  { Open local file for writing }
  Assign(localFile, localPath);
  Rewrite(localFile, 1);

  { Read remote file and write to local file }
  counter := 500;

  repeat
    red.ReadFile(remoteFileId, 62, errorCode, buffer, lengthRead);
    CheckError('ReadFile', errorCode);
    BlockWrite(localFile, buffer, lengthRead);
    Dec(counter);

    if (counter = 0) then begin
      counter := 500;
      Write('.');
      errorCode := red.KeepSessionAlive(sessionId, 30);
      CheckError('KeepSessionAlive', errorCode);
    end;
  until (lengthRead = 0);

  WriteLn('.');

  { Close local file }
  Close(localFile);

  { Close remote file }
  red.ReleaseObjectUnchecked(remoteFileId, sessionId);

  { Expire session }
  red.ExpireSessionUnchecked(sessionId);
end;

procedure TExample.Execute;
begin
  { Create IP connection }
  ipcon := TIPConnection.Create;

  { Create device object }
  red := TBrickRED.Create(UID, ipcon);

  { Connect to brickd }
  ipcon.Connect(HOST, PORT);
  { Don't use device before ipcon is connected }

  { Read /home/tf/foobar.txt on RED Brick and write it locally to foobar.txt }
  ReadFile('/home/tf/foobar.txt', 'foobar.txt');

  WriteLn('Press key to exit');
  ReadLn;
  ipcon.Destroy; { Calls ipcon.Disconnect internally }
end;

begin
  e := TExample.Create;
  e.Execute;
  e.Destroy;
end.

Write File

Download (ExampleWriteFile.pas)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
program ExampleWriteFile;

{$ifdef MSWINDOWS}{$apptype CONSOLE}{$endif}
{$ifdef FPC}{$mode OBJFPC}{$H+}{$endif}

uses
  SysUtils, IPConnection, BrickRED;

type
  TExample = class
  private
    ipcon: TIPConnection;
    red: TBrickRED;
  public
    procedure CheckError(context: string; errorCode: byte);
    function AllocateString(sessionId: word; buffer: string): word;
    procedure WriteFile(localPath: string; remotePath: string);
    procedure Execute;
  end;

const
  HOST = 'localhost';
  PORT = 4223;
  UID = 'XXYYZZ'; { Change XXYYZZ to the UID of your RED Brick }

var
  e: TExample;

procedure TExample.CheckError(context: string; errorCode: byte);
begin
  if (errorCode <> 0) then begin
    raise Exception.Create(Format('%s error occurred: %d', [context, errorCode]));
  end;
end;

function TExample.AllocateString(sessionId: word; buffer: string): word;
var errorCode: byte; stringId: word;
begin
  if (Length(buffer) > 60) then begin
    { FIXME: Currently this helper function only supports strings up to 60 characters }
    raise Exception.Create('String too long');
  end;
  red.AllocateString(Length(buffer), buffer, sessionId, errorCode, stringId);
  CheckError('AllocateString', errorCode);
  result := stringId;
end;

procedure TExample.WriteFile(localPath: string; remotePath: string);
var errorCode: byte; sessionId: word; remotePathStringId: word; remoteFileId: word;
    buffer: TArray0To60OfUInt8; lengthRead: longint; localFile: file; lengthWritten: byte;
    counter: longint;
begin
  { Open local file for reading }
  Assign(localFile, localPath);
  Reset(localFile, 1);

  { Create session }
  red.CreateSession(60, errorCode, sessionId);
  CheckError('CreateSession', errorCode);

  { Wrap remote path string }
  remotePathStringId := AllocateString(sessionId, remotePath);

  { Create remote non-executable file for writing as user/group tf }
  red.OpenFile(remotePathStringId,
               BRICK_RED_FILE_FLAG_WRITE_ONLY or BRICK_RED_FILE_FLAG_CREATE or
               BRICK_RED_FILE_FLAG_TRUNCATE or BRICK_RED_FILE_FLAG_NON_BLOCKING,
               420 { 0o644 }, 1000, 1000, sessionId, errorCode, remoteFileId);
  CheckError('OpenFile', errorCode);

  { Read local file and write to remote file }
  counter := 500;

  repeat
    BlockRead(localFile, buffer, 61, lengthRead);
    red.WriteFile(remoteFileId, buffer, lengthRead, errorCode, lengthWritten);
    CheckError('WriteFile', errorCode);

    if (lengthRead <> lengthWritten) then begin
      { FIXME: Currently this example doesn't handle short writes }
      raise Exception.Create('Short write');
    end;

    Dec(counter);

    if (counter = 0) then begin
      counter := 500;
      Write('.');
      errorCode := red.KeepSessionAlive(sessionId, 30);
      CheckError('KeepSessionAlive', errorCode);
    end;
  until (lengthRead = 0);

  WriteLn('.');

  { Close remote file }
  red.ReleaseObjectUnchecked(remoteFileId, sessionId);

  { Close local file }
  Close(localFile);

  { Expire session }
  red.ExpireSessionUnchecked(sessionId);
end;

procedure TExample.Execute;
begin
  { Create IP connection }
  ipcon := TIPConnection.Create;

  { Create device object }
  red := TBrickRED.Create(UID, ipcon);

  { Connect to brickd }
  ipcon.Connect(HOST, PORT);
  { Don't use device before ipcon is connected }

  { Read foobar.txt locally and write it to /home/tf/foobar.txt on RED Brick }
  WriteFile('foobar.txt', '/home/tf/foobar.txt');

  WriteLn('Press key to exit');
  ReadLn;
  ipcon.Destroy; { Calls ipcon.Disconnect internally }
end;

begin
  e := TExample.Create;
  e.Execute;
  e.Destroy;
end.

API

Since Delphi does not support multiple return values directly, we use the out keyword to return multiple values from a function.

All functions and procedures 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

procedure TBrickRED.CreateSession(const lifetime: longword; out errorCode: byte; out sessionId: word)
Parameters:
  • lifetime – Type: longword, Range: [0 to 232 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • sessionId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.ExpireSession(const sessionId: word): byte
Parameters:
  • sessionId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.ExpireSessionUnchecked(const sessionId: word)
Parameters:
  • sessionId – Type: word, Range: [0 to 216 - 1]
function TBrickRED.KeepSessionAlive(const sessionId: word; const lifetime: longword): byte
Parameters:
  • sessionId – Type: word, Range: [0 to 216 - 1]
  • lifetime – Type: longword, Range: [0 to 232 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.ReleaseObject(const objectId: word; const sessionId: word): byte
Parameters:
  • objectId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.ReleaseObjectUnchecked(const objectId: word; const sessionId: word)
Parameters:
  • objectId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
procedure TBrickRED.AllocateString(const lengthToReserve: longword; const buffer: string; const sessionId: word; out errorCode: byte; out stringId: word)
Parameters:
  • lengthToReserve – Type: longword, Unit: 1 B, Range: [0 to 232 - 1]
  • buffer – Type: string, Length: up to 58
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • stringId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.TruncateString(const stringId: word; const length: longword): byte
Parameters:
  • stringId – Type: word, Range: [0 to 216 - 1]
  • length – Type: longword, Unit: 1 B, Range: [0 to 232 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetStringLength(const stringId: word; out errorCode: byte; out length: longword)
Parameters:
  • stringId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • length – Type: longword, Unit: 1 B, Range: [0 to 232 - 1]

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.SetStringChunk(const stringId: word; const offset: longword; const buffer: string): byte
Parameters:
  • stringId – Type: word, Range: [0 to 216 - 1]
  • offset – Type: longword, Unit: 1 B, Range: [0 to 232 - 1]
  • buffer – Type: string, Length: up to 58
Returns:
  • errorCode – Type: byte, Range: See constants

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetStringChunk(const stringId: word; const offset: longword; out errorCode: byte; out buffer: string)
Parameters:
  • stringId – Type: word, Range: [0 to 216 - 1]
  • offset – Type: longword, Unit: 1 B, Range: [0 to 232 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • buffer – Type: string, Length: up to 63

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.AllocateList(const lengthToReserve: word; const sessionId: word; out errorCode: byte; out listId: word)
Parameters:
  • lengthToReserve – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • listId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetListLength(const listId: word; out errorCode: byte; out length: word)
Parameters:
  • listId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • length – Type: word, Range: [0 to 216 - 1]

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetListItem(const listId: word; const index: word; const sessionId: word; out errorCode: byte; out itemObjectId: word; out type: byte)
Parameters:
  • listId – Type: word, Range: [0 to 216 - 1]
  • index – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • itemObjectId – Type: word, Range: [0 to 216 - 1]
  • type – Type: byte, Range: See constants

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For type:

  • BRICK_RED_OBJECT_TYPE_STRING = 0
  • BRICK_RED_OBJECT_TYPE_LIST = 1
  • BRICK_RED_OBJECT_TYPE_FILE = 2
  • BRICK_RED_OBJECT_TYPE_DIRECTORY = 3
  • BRICK_RED_OBJECT_TYPE_PROCESS = 4
  • BRICK_RED_OBJECT_TYPE_PROGRAM = 5
function TBrickRED.AppendToList(const listId: word; const itemObjectId: word): byte
Parameters:
  • listId – Type: word, Range: [0 to 216 - 1]
  • itemObjectId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.RemoveFromList(const listId: word; const index: word): byte
Parameters:
  • listId – Type: word, Range: [0 to 216 - 1]
  • index – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.OpenFile(const nameStringId: word; const flags: longword; const permissions: word; const uid: longword; const gid: longword; const sessionId: word; out errorCode: byte; out fileId: word)
Parameters:
  • nameStringId – Type: word, Range: [0 to 216 - 1]
  • flags – Type: longword, Range: See constants
  • permissions – Type: word, Range: See constants
  • uid – Type: longword, Range: [0 to 232 - 1]
  • gid – Type: longword, Range: [0 to 232 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • fileId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_FILE_FLAG_READ_ONLY = 1
  • BRICK_RED_FILE_FLAG_WRITE_ONLY = 2
  • BRICK_RED_FILE_FLAG_READ_WRITE = 4
  • BRICK_RED_FILE_FLAG_APPEND = 8
  • BRICK_RED_FILE_FLAG_CREATE = 16
  • BRICK_RED_FILE_FLAG_EXCLUSIVE = 32
  • BRICK_RED_FILE_FLAG_NON_BLOCKING = 64
  • BRICK_RED_FILE_FLAG_TRUNCATE = 128
  • BRICK_RED_FILE_FLAG_TEMPORARY = 256
  • BRICK_RED_FILE_FLAG_REPLACE = 512

For permissions:

  • BRICK_RED_FILE_PERMISSION_USER_ALL = 448
  • BRICK_RED_FILE_PERMISSION_USER_READ = 256
  • BRICK_RED_FILE_PERMISSION_USER_WRITE = 128
  • BRICK_RED_FILE_PERMISSION_USER_EXECUTE = 64
  • BRICK_RED_FILE_PERMISSION_GROUP_ALL = 56
  • BRICK_RED_FILE_PERMISSION_GROUP_READ = 32
  • BRICK_RED_FILE_PERMISSION_GROUP_WRITE = 16
  • BRICK_RED_FILE_PERMISSION_GROUP_EXECUTE = 8
  • BRICK_RED_FILE_PERMISSION_OTHERS_ALL = 7
  • BRICK_RED_FILE_PERMISSION_OTHERS_READ = 4
  • BRICK_RED_FILE_PERMISSION_OTHERS_WRITE = 2
  • BRICK_RED_FILE_PERMISSION_OTHERS_EXECUTE = 1

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.CreatePipe(const flags: longword; const length: uint64; const sessionId: word; out errorCode: byte; out fileId: word)
Parameters:
  • flags – Type: longword, Range: See constants
  • length – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • fileId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_PIPE_FLAG_NON_BLOCKING_READ = 1
  • BRICK_RED_PIPE_FLAG_NON_BLOCKING_WRITE = 2

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetFileInfo(const fileId: word; const sessionId: word; out errorCode: byte; out type: byte; out nameStringId: word; out flags: longword; out permissions: word; out uid: longword; out gid: longword; out length: uint64; out accessTimestamp: uint64; out modificationTimestamp: uint64; out statusChangeTimestamp: uint64)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • type – Type: byte, Range: See constants
  • nameStringId – Type: word, Range: [0 to 216 - 1]
  • flags – Type: longword, Range: See constants
  • permissions – Type: word, Range: See constants
  • uid – Type: longword, Range: [0 to 232 - 1]
  • gid – Type: longword, 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]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For type:

  • BRICK_RED_FILE_TYPE_UNKNOWN = 0
  • BRICK_RED_FILE_TYPE_REGULAR = 1
  • BRICK_RED_FILE_TYPE_DIRECTORY = 2
  • BRICK_RED_FILE_TYPE_CHARACTER = 3
  • BRICK_RED_FILE_TYPE_BLOCK = 4
  • BRICK_RED_FILE_TYPE_FIFO = 5
  • BRICK_RED_FILE_TYPE_SYMLINK = 6
  • BRICK_RED_FILE_TYPE_SOCKET = 7
  • BRICK_RED_FILE_TYPE_PIPE = 8

For flags:

  • BRICK_RED_FILE_FLAG_READ_ONLY = 1
  • BRICK_RED_FILE_FLAG_WRITE_ONLY = 2
  • BRICK_RED_FILE_FLAG_READ_WRITE = 4
  • BRICK_RED_FILE_FLAG_APPEND = 8
  • BRICK_RED_FILE_FLAG_CREATE = 16
  • BRICK_RED_FILE_FLAG_EXCLUSIVE = 32
  • BRICK_RED_FILE_FLAG_NON_BLOCKING = 64
  • BRICK_RED_FILE_FLAG_TRUNCATE = 128
  • BRICK_RED_FILE_FLAG_TEMPORARY = 256
  • BRICK_RED_FILE_FLAG_REPLACE = 512

For permissions:

  • BRICK_RED_FILE_PERMISSION_USER_ALL = 448
  • BRICK_RED_FILE_PERMISSION_USER_READ = 256
  • BRICK_RED_FILE_PERMISSION_USER_WRITE = 128
  • BRICK_RED_FILE_PERMISSION_USER_EXECUTE = 64
  • BRICK_RED_FILE_PERMISSION_GROUP_ALL = 56
  • BRICK_RED_FILE_PERMISSION_GROUP_READ = 32
  • BRICK_RED_FILE_PERMISSION_GROUP_WRITE = 16
  • BRICK_RED_FILE_PERMISSION_GROUP_EXECUTE = 8
  • BRICK_RED_FILE_PERMISSION_OTHERS_ALL = 7
  • BRICK_RED_FILE_PERMISSION_OTHERS_READ = 4
  • BRICK_RED_FILE_PERMISSION_OTHERS_WRITE = 2
  • BRICK_RED_FILE_PERMISSION_OTHERS_EXECUTE = 1
procedure TBrickRED.ReadFile(const fileId: word; const lengthToRead: byte; out errorCode: byte; out buffer: array [0..61] of byte; out lengthRead: byte)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • lengthToRead – Type: byte, Unit: 1 B, Range: [0 to 255]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • buffer – Type: array [0..61] of byte, Range: [0 to 255]
  • lengthRead – Type: byte, Unit: 1 B, Range: [0 to 255]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.ReadFileAsync(const fileId: word; const lengthToRead: uint64)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • lengthToRead – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]

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 OnAsyncFileRead 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 OnAsyncFileRead callback.

function TBrickRED.AbortAsyncFileRead(const fileId: word): byte
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

Aborts a ReadFileAsync operation in progress.

Returns the resulting error code.

On success the OnAsyncFileRead callback will report OperationAborted.

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.WriteFile(const fileId: word; const buffer: array [0..60] of byte; const lengthToWrite: byte; out errorCode: byte; out lengthWritten: byte)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • buffer – Type: array [0..60] of byte, Range: [0 to 255]
  • lengthToWrite – Type: byte, Unit: 1 B, Range: [0 to 255]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • lengthWritten – Type: byte, Unit: 1 B, Range: [0 to 255]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.WriteFileUnchecked(const fileId: word; const buffer: array [0..60] of byte; const lengthToWrite: byte)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • buffer – Type: array [0..60] of byte, Range: [0 to 255]
  • lengthToWrite – Type: byte, Unit: 1 B, Range: [0 to 255]

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.

procedure TBrickRED.WriteFileAsync(const fileId: word; const buffer: array [0..60] of byte; const lengthToWrite: byte)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • buffer – Type: array [0..60] of byte, Range: [0 to 255]
  • lengthToWrite – Type: byte, Unit: 1 B, Range: [0 to 255]

Writes up to 61 bytes to a file object.

Reports the actual number of bytes written and the resulting error code via the OnAsyncFileWrite 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 OnAsyncFileWrite callback.

procedure TBrickRED.SetFilePosition(const fileId: word; const offset: int64; const origin: byte; out errorCode: byte; out position: uint64)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • offset – Type: int64, Unit: 1 B, Range: [-263 to 263 - 1]
  • origin – Type: byte, Range: See constants
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • position – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]

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:

  • BRICK_RED_FILE_ORIGIN_BEGINNING = 0
  • BRICK_RED_FILE_ORIGIN_CURRENT = 1
  • BRICK_RED_FILE_ORIGIN_END = 2

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetFilePosition(const fileId: word; out errorCode: byte; out position: uint64)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • position – Type: uint64, Unit: 1 B, Range: [0 to 264 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.SetFileEvents(const fileId: word; const events: word): byte
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
  • events – Type: word, Range: See constants
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For events:

  • BRICK_RED_FILE_EVENT_READABLE = 1
  • BRICK_RED_FILE_EVENT_WRITABLE = 2

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetFileEvents(const fileId: word; out errorCode: byte; out events: word)
Parameters:
  • fileId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • events – Type: word, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For events:

  • BRICK_RED_FILE_EVENT_READABLE = 1
  • BRICK_RED_FILE_EVENT_WRITABLE = 2
procedure TBrickRED.OpenDirectory(const nameStringId: word; const sessionId: word; out errorCode: byte; out directoryId: word)
Parameters:
  • nameStringId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • directoryId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetDirectoryName(const directoryId: word; const sessionId: word; out errorCode: byte; out nameStringId: word)
Parameters:
  • directoryId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • nameStringId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetNextDirectoryEntry(const directoryId: word; const sessionId: word; out errorCode: byte; out nameStringId: word; out type: byte)
Parameters:
  • directoryId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • nameStringId – Type: word, Range: [0 to 216 - 1]
  • type – Type: byte, Range: See constants

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For type:

  • BRICK_RED_DIRECTORY_ENTRY_TYPE_UNKNOWN = 0
  • BRICK_RED_DIRECTORY_ENTRY_TYPE_REGULAR = 1
  • BRICK_RED_DIRECTORY_ENTRY_TYPE_DIRECTORY = 2
  • BRICK_RED_DIRECTORY_ENTRY_TYPE_CHARACTER = 3
  • BRICK_RED_DIRECTORY_ENTRY_TYPE_BLOCK = 4
  • BRICK_RED_DIRECTORY_ENTRY_TYPE_FIFO = 5
  • BRICK_RED_DIRECTORY_ENTRY_TYPE_SYMLINK = 6
  • BRICK_RED_DIRECTORY_ENTRY_TYPE_SOCKET = 7
function TBrickRED.RewindDirectory(const directoryId: word): byte
Parameters:
  • directoryId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

Rewinds a directory object and returns the resulting error code.

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.CreateDirectory(const nameStringId: word; const flags: longword; const permissions: word; const uid: longword; const gid: longword): byte
Parameters:
  • nameStringId – Type: word, Range: [0 to 216 - 1]
  • flags – Type: longword, Range: See constants
  • permissions – Type: word, Range: See constants
  • uid – Type: longword, Range: [0 to 232 - 1]
  • gid – Type: longword, Range: [0 to 232 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

FIXME: name has to be absolute

The following constants are available for this function:

For flags:

  • BRICK_RED_DIRECTORY_FLAG_RECURSIVE = 1
  • BRICK_RED_DIRECTORY_FLAG_EXCLUSIVE = 2

For permissions:

  • BRICK_RED_FILE_PERMISSION_USER_ALL = 448
  • BRICK_RED_FILE_PERMISSION_USER_READ = 256
  • BRICK_RED_FILE_PERMISSION_USER_WRITE = 128
  • BRICK_RED_FILE_PERMISSION_USER_EXECUTE = 64
  • BRICK_RED_FILE_PERMISSION_GROUP_ALL = 56
  • BRICK_RED_FILE_PERMISSION_GROUP_READ = 32
  • BRICK_RED_FILE_PERMISSION_GROUP_WRITE = 16
  • BRICK_RED_FILE_PERMISSION_GROUP_EXECUTE = 8
  • BRICK_RED_FILE_PERMISSION_OTHERS_ALL = 7
  • BRICK_RED_FILE_PERMISSION_OTHERS_READ = 4
  • BRICK_RED_FILE_PERMISSION_OTHERS_WRITE = 2
  • BRICK_RED_FILE_PERMISSION_OTHERS_EXECUTE = 1

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProcesses(const sessionId: word; out errorCode: byte; out processesListId: word)
Parameters:
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • processesListId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.SpawnProcess(const executableStringId: word; const argumentsListId: word; const environmentListId: word; const workingDirectoryStringId: word; const uid: longword; const gid: longword; const stdinFileId: word; const stdoutFileId: word; const stderrFileId: word; const sessionId: word; out errorCode: byte; out processId: word)
Parameters:
  • executableStringId – Type: word, Range: [0 to 216 - 1]
  • argumentsListId – Type: word, Range: [0 to 216 - 1]
  • environmentListId – Type: word, Range: [0 to 216 - 1]
  • workingDirectoryStringId – Type: word, Range: [0 to 216 - 1]
  • uid – Type: longword, Range: [0 to 232 - 1]
  • gid – Type: longword, Range: [0 to 232 - 1]
  • stdinFileId – Type: word, Range: [0 to 216 - 1]
  • stdoutFileId – Type: word, Range: [0 to 216 - 1]
  • stderrFileId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • processId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.KillProcess(const processId: word; const signal: byte): byte
Parameters:
  • processId – Type: word, Range: [0 to 216 - 1]
  • signal – Type: byte, Range: See constants
Returns:
  • errorCode – Type: byte, Range: See constants

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:

  • BRICK_RED_PROCESS_SIGNAL_INTERRUPT = 2
  • BRICK_RED_PROCESS_SIGNAL_QUIT = 3
  • BRICK_RED_PROCESS_SIGNAL_ABORT = 6
  • BRICK_RED_PROCESS_SIGNAL_KILL = 9
  • BRICK_RED_PROCESS_SIGNAL_USER1 = 10
  • BRICK_RED_PROCESS_SIGNAL_USER2 = 12
  • BRICK_RED_PROCESS_SIGNAL_TERMINATE = 15
  • BRICK_RED_PROCESS_SIGNAL_CONTINUE = 18
  • BRICK_RED_PROCESS_SIGNAL_STOP = 19

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProcessCommand(const processId: word; const sessionId: word; out errorCode: byte; out executableStringId: word; out argumentsListId: word; out environmentListId: word; out workingDirectoryStringId: word)
Parameters:
  • processId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • executableStringId – Type: word, Range: [0 to 216 - 1]
  • argumentsListId – Type: word, Range: [0 to 216 - 1]
  • environmentListId – Type: word, Range: [0 to 216 - 1]
  • workingDirectoryStringId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProcessIdentity(const processId: word; out errorCode: byte; out pid: longword; out uid: longword; out gid: longword)
Parameters:
  • processId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • pid – Type: longword, Range: [0 to 232 - 1]
  • uid – Type: longword, Range: [0 to 232 - 1]
  • gid – Type: longword, Range: [0 to 232 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProcessStdio(const processId: word; const sessionId: word; out errorCode: byte; out stdinFileId: word; out stdoutFileId: word; out stderrFileId: word)
Parameters:
  • processId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • stdinFileId – Type: word, Range: [0 to 216 - 1]
  • stdoutFileId – Type: word, Range: [0 to 216 - 1]
  • stderrFileId – Type: word, Range: [0 to 216 - 1]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProcessState(const processId: word; out errorCode: byte; out state: byte; out timestamp: uint64; out exitCode: byte)
Parameters:
  • processId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • state – Type: byte, Range: See constants
  • timestamp – Type: uint64, Range: [0 to 264 - 1]
  • exitCode – Type: byte, Range: [0 to 255]

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:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For state:

  • BRICK_RED_PROCESS_STATE_UNKNOWN = 0
  • BRICK_RED_PROCESS_STATE_RUNNING = 1
  • BRICK_RED_PROCESS_STATE_ERROR = 2
  • BRICK_RED_PROCESS_STATE_EXITED = 3
  • BRICK_RED_PROCESS_STATE_KILLED = 4
  • BRICK_RED_PROCESS_STATE_STOPPED = 5
procedure TBrickRED.GetPrograms(const sessionId: word; out errorCode: byte; out programsListId: word)
Parameters:
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • programsListId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.DefineProgram(const identifierStringId: word; const sessionId: word; out errorCode: byte; out programId: word)
Parameters:
  • identifierStringId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • programId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.PurgeProgram(const programId: word; const cookie: longword): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • cookie – Type: longword, Range: [0 to 232 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProgramIdentifier(const programId: word; const sessionId: word; out errorCode: byte; out identifierStringId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • identifierStringId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProgramRootDirectory(const programId: word; const sessionId: word; out errorCode: byte; out rootDirectoryStringId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • rootDirectoryStringId – Type: word, Range: [0 to 216 - 1]

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.SetProgramCommand(const programId: word; const executableStringId: word; const argumentsListId: word; const environmentListId: word; const workingDirectoryStringId: word): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • executableStringId – Type: word, Range: [0 to 216 - 1]
  • argumentsListId – Type: word, Range: [0 to 216 - 1]
  • environmentListId – Type: word, Range: [0 to 216 - 1]
  • workingDirectoryStringId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProgramCommand(const programId: word; const sessionId: word; out errorCode: byte; out executableStringId: word; out argumentsListId: word; out environmentListId: word; out workingDirectoryStringId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • executableStringId – Type: word, Range: [0 to 216 - 1]
  • argumentsListId – Type: word, Range: [0 to 216 - 1]
  • environmentListId – Type: word, Range: [0 to 216 - 1]
  • workingDirectoryStringId – Type: word, Range: [0 to 216 - 1]

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.SetProgramStdioRedirection(const programId: word; const stdinRedirection: byte; const stdinFileNameStringId: word; const stdoutRedirection: byte; const stdoutFileNameStringId: word; const stderrRedirection: byte; const stderrFileNameStringId: word): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • stdinRedirection – Type: byte, Range: See constants
  • stdinFileNameStringId – Type: word, Range: [0 to 216 - 1]
  • stdoutRedirection – Type: byte, Range: See constants
  • stdoutFileNameStringId – Type: word, Range: [0 to 216 - 1]
  • stderrRedirection – Type: byte, Range: See constants
  • stderrFileNameStringId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

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

The following constants are available for this function:

For stdinRedirection:

  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For stdoutRedirection:

  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For stderrRedirection:

  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProgramStdioRedirection(const programId: word; const sessionId: word; out errorCode: byte; out stdinRedirection: byte; out stdinFileNameStringId: word; out stdoutRedirection: byte; out stdoutFileNameStringId: word; out stderrRedirection: byte; out stderrFileNameStringId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • stdinRedirection – Type: byte, Range: See constants
  • stdinFileNameStringId – Type: word, Range: [0 to 216 - 1]
  • stdoutRedirection – Type: byte, Range: See constants
  • stdoutFileNameStringId – Type: word, Range: [0 to 216 - 1]
  • stderrRedirection – Type: byte, Range: See constants
  • stderrFileNameStringId – Type: word, Range: [0 to 216 - 1]

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For stdinRedirection:

  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For stdoutRedirection:

  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5

For stderrRedirection:

  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_DEV_NULL = 0
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_PIPE = 1
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_FILE = 2
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG = 3
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG = 4
  • BRICK_RED_PROGRAM_STDIO_REDIRECTION_STDOUT = 5
function TBrickRED.SetProgramSchedule(const programId: word; const startMode: byte; const continueAfterError: boolean; const startInterval: longword; const startFieldsStringId: word): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • startMode – Type: byte, Range: See constants
  • continueAfterError – Type: boolean
  • startInterval – Type: longword, Range: [0 to 232 - 1]
  • startFieldsStringId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For startMode:

  • BRICK_RED_PROGRAM_START_MODE_NEVER = 0
  • BRICK_RED_PROGRAM_START_MODE_ALWAYS = 1
  • BRICK_RED_PROGRAM_START_MODE_INTERVAL = 2
  • BRICK_RED_PROGRAM_START_MODE_CRON = 3

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetProgramSchedule(const programId: word; const sessionId: word; out errorCode: byte; out startMode: byte; out continueAfterError: boolean; out startInterval: longword; out startFieldsStringId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • startMode – Type: byte, Range: See constants
  • continueAfterError – Type: boolean
  • startInterval – Type: longword, Range: [0 to 232 - 1]
  • startFieldsStringId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For startMode:

  • BRICK_RED_PROGRAM_START_MODE_NEVER = 0
  • BRICK_RED_PROGRAM_START_MODE_ALWAYS = 1
  • BRICK_RED_PROGRAM_START_MODE_INTERVAL = 2
  • BRICK_RED_PROGRAM_START_MODE_CRON = 3
procedure TBrickRED.GetProgramSchedulerState(const programId: word; const sessionId: word; out errorCode: byte; out state: byte; out timestamp: uint64; out messageStringId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • state – Type: byte, Range: See constants
  • timestamp – Type: uint64, Range: [0 to 264 - 1]
  • messageStringId – Type: word, Range: [0 to 216 - 1]

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

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144

For state:

  • BRICK_RED_PROGRAM_SCHEDULER_STATE_STOPPED = 0
  • BRICK_RED_PROGRAM_SCHEDULER_STATE_RUNNING = 1
function TBrickRED.ContinueProgramSchedule(const programId: word): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.StartProgram(const programId: word): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetLastSpawnedProgramProcess(const programId: word; const sessionId: word; out errorCode: byte; out processId: word; out timestamp: uint64)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • processId – Type: word, Range: [0 to 216 - 1]
  • timestamp – Type: uint64, Range: [0 to 264 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetCustomProgramOptionNames(const programId: word; const sessionId: word; out errorCode: byte; out namesListId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • namesListId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.SetCustomProgramOptionValue(const programId: word; const nameStringId: word; const valueStringId: word): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • nameStringId – Type: word, Range: [0 to 216 - 1]
  • valueStringId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetCustomProgramOptionValue(const programId: word; const nameStringId: word; const sessionId: word; out errorCode: byte; out valueStringId: word)
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • nameStringId – Type: word, Range: [0 to 216 - 1]
  • sessionId – Type: word, Range: [0 to 216 - 1]
Output Parameters:
  • errorCode – Type: byte, Range: See constants
  • valueStringId – Type: word, Range: [0 to 216 - 1]

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
function TBrickRED.RemoveCustomProgramOption(const programId: word; const nameStringId: word): byte
Parameters:
  • programId – Type: word, Range: [0 to 216 - 1]
  • nameStringId – Type: word, Range: [0 to 216 - 1]
Returns:
  • errorCode – Type: byte, Range: See constants

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
procedure TBrickRED.GetIdentity(out uid: string; out connectedUid: string; out position: char; out hardwareVersion: array [0..2] of byte; out firmwareVersion: array [0..2] of byte; out deviceIdentifier: word)
Output Parameters:
  • uid – Type: string, Length: up to 8
  • connectedUid – Type: string, Length: up to 8
  • position – Type: char, Range: ['0' to '8']
  • hardwareVersion – Type: array [0..2] of byte
    • 0: major – Type: byte, Range: [0 to 255]
    • 1: minor – Type: byte, Range: [0 to 255]
    • 2: revision – Type: byte, Range: [0 to 255]
  • firmwareVersion – Type: array [0..2] of byte
    • 0: major – Type: byte, Range: [0 to 255]
    • 1: minor – Type: byte, Range: [0 to 255]
    • 2: revision – Type: byte, Range: [0 to 255]
  • deviceIdentifier – Type: word, Range: [0 to 216 - 1]

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 by assigning a procedure to an callback property of the device object:

procedure TExample.MyCallback(sender: TBrickRED; const value: longint);
begin
  WriteLn(Format('Value: %d', [value]));
end;

red.OnExample := {$ifdef FPC}@{$endif}example.MyCallback;

The available callback properties and their parameter types are described below.

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.

property TBrickRED.OnAsyncFileRead
procedure(sender: TBrickRED; const fileId: word; const errorCode: byte; const buffer: array [0..59] of byte; const lengthRead: byte) of object;
Callback Parameters:
  • sender – Type: TBrickRED
  • fileId – Type: word, Range: [0 to 216 - 1]
  • errorCode – Type: byte, Range: See constants
  • buffer – Type: array [0..59] of byte, Range: [0 to 255]
  • lengthRead – Type: byte, Unit: 1 B, Range: [0 to 255]

This callback reports the result of a call to the ReadFileAsync function.

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
property TBrickRED.OnAsyncFileWrite
procedure(sender: TBrickRED; const fileId: word; const errorCode: byte; const lengthWritten: byte) of object;
Callback Parameters:
  • sender – Type: TBrickRED
  • fileId – Type: word, Range: [0 to 216 - 1]
  • errorCode – Type: byte, Range: See constants
  • lengthWritten – Type: byte, Unit: 1 B, Range: [0 to 255]

This callback reports the result of a call to the WriteFileAsync function.

The following constants are available for this function:

For errorCode:

  • BRICK_RED_ERROR_CODE_SUCCESS = 0
  • BRICK_RED_ERROR_CODE_UNKNOWN_ERROR = 1
  • BRICK_RED_ERROR_CODE_INVALID_OPERATION = 2
  • BRICK_RED_ERROR_CODE_OPERATION_ABORTED = 3
  • BRICK_RED_ERROR_CODE_INTERNAL_ERROR = 4
  • BRICK_RED_ERROR_CODE_UNKNOWN_SESSION_ID = 5
  • BRICK_RED_ERROR_CODE_NO_FREE_SESSION_ID = 6
  • BRICK_RED_ERROR_CODE_UNKNOWN_OBJECT_ID = 7
  • BRICK_RED_ERROR_CODE_NO_FREE_OBJECT_ID = 8
  • BRICK_RED_ERROR_CODE_OBJECT_IS_LOCKED = 9
  • BRICK_RED_ERROR_CODE_NO_MORE_DATA = 10
  • BRICK_RED_ERROR_CODE_WRONG_LIST_ITEM_TYPE = 11
  • BRICK_RED_ERROR_CODE_PROGRAM_IS_PURGED = 12
  • BRICK_RED_ERROR_CODE_INVALID_PARAMETER = 128
  • BRICK_RED_ERROR_CODE_NO_FREE_MEMORY = 129
  • BRICK_RED_ERROR_CODE_NO_FREE_SPACE = 130
  • BRICK_RED_ERROR_CODE_ACCESS_DENIED = 121
  • BRICK_RED_ERROR_CODE_ALREADY_EXISTS = 132
  • BRICK_RED_ERROR_CODE_DOES_NOT_EXIST = 133
  • BRICK_RED_ERROR_CODE_INTERRUPTED = 134
  • BRICK_RED_ERROR_CODE_IS_DIRECTORY = 135
  • BRICK_RED_ERROR_CODE_NOT_A_DIRECTORY = 136
  • BRICK_RED_ERROR_CODE_WOULD_BLOCK = 137
  • BRICK_RED_ERROR_CODE_OVERFLOW = 138
  • BRICK_RED_ERROR_CODE_BAD_FILE_DESCRIPTOR = 139
  • BRICK_RED_ERROR_CODE_OUT_OF_RANGE = 140
  • BRICK_RED_ERROR_CODE_NAME_TOO_LONG = 141
  • BRICK_RED_ERROR_CODE_INVALID_SEEK = 142
  • BRICK_RED_ERROR_CODE_NOT_SUPPORTED = 143
  • BRICK_RED_ERROR_CODE_TOO_MANY_OPEN_FILES = 144
property TBrickRED.OnFileEventsOccurred
procedure(sender: TBrickRED; const fileId: word; const events: word) of object;
Callback Parameters:
  • sender – Type: TBrickRED
  • fileId – Type: word, Range: [0 to 216 - 1]
  • events – Type: word, Range: See constants

The following constants are available for this function:

For events:

  • BRICK_RED_FILE_EVENT_READABLE = 1
  • BRICK_RED_FILE_EVENT_WRITABLE = 2
property TBrickRED.OnProcessStateChanged
procedure(sender: TBrickRED; const processId: word; const state: byte; const timestamp: uint64; const exitCode: byte) of object;
Callback Parameters:
  • sender – Type: TBrickRED
  • processId – Type: word, Range: [0 to 216 - 1]
  • state – Type: byte, Range: See constants
  • timestamp – Type: uint64, Range: [0 to 264 - 1]
  • exitCode – Type: byte, Range: [0 to 255]

The following constants are available for this function:

For state:

  • BRICK_RED_PROCESS_STATE_UNKNOWN = 0
  • BRICK_RED_PROCESS_STATE_RUNNING = 1
  • BRICK_RED_PROCESS_STATE_ERROR = 2
  • BRICK_RED_PROCESS_STATE_EXITED = 3
  • BRICK_RED_PROCESS_STATE_KILLED = 4
  • BRICK_RED_PROCESS_STATE_STOPPED = 5
property TBrickRED.OnProgramSchedulerStateChanged
procedure(sender: TBrickRED; const programId: word) of object;
Callback Parameters:
  • sender – Type: TBrickRED
  • programId – Type: word, Range: [0 to 216 - 1]
property TBrickRED.OnProgramProcessSpawned
procedure(sender: TBrickRED; const programId: word) of object;
Callback Parameters:
  • sender – Type: TBrickRED
  • programId – Type: word, Range: [0 to 216 - 1]

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.

function TBrickRED.GetAPIVersion: array [0..2] of byte
Output Parameters:
  • apiVersion – Type: array [0..2] of byte
    • 0: major – Type: byte, Range: [0 to 255]
    • 1: minor – Type: byte, Range: [0 to 255]
    • 2: revision – Type: byte, Range: [0 to 255]

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.

function TBrickRED.GetResponseExpected(const functionId: byte): boolean
Parameters:
  • functionId – Type: byte, Range: See constants
Returns:
  • responseExpected – Type: boolean

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:

  • BRICK_RED_FUNCTION_EXPIRE_SESSION_UNCHECKED = 3
  • BRICK_RED_FUNCTION_RELEASE_OBJECT_UNCHECKED = 6
  • BRICK_RED_FUNCTION_READ_FILE_ASYNC = 21
  • BRICK_RED_FUNCTION_WRITE_FILE_UNCHECKED = 24
  • BRICK_RED_FUNCTION_WRITE_FILE_ASYNC = 25
procedure TBrickRED.SetResponseExpected(const functionId: byte; const responseExpected: boolean)
Parameters:
  • functionId – Type: byte, Range: See constants
  • responseExpected – Type: boolean

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:

  • BRICK_RED_FUNCTION_EXPIRE_SESSION_UNCHECKED = 3
  • BRICK_RED_FUNCTION_RELEASE_OBJECT_UNCHECKED = 6
  • BRICK_RED_FUNCTION_READ_FILE_ASYNC = 21
  • BRICK_RED_FUNCTION_WRITE_FILE_UNCHECKED = 24
  • BRICK_RED_FUNCTION_WRITE_FILE_ASYNC = 25
procedure TBrickRED.SetResponseExpectedAll(const responseExpected: boolean)
Parameters:
  • responseExpected – Type: boolean

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

Constants

const BRICK_RED_DEVICE_IDENTIFIER

This constant is used to identify a RED Brick.

The GetIdentity function and the TIPConnection.OnEnumerate callback of the IP Connection have a deviceIdentifier parameter to specify the Brick's or Bricklet's type.

const BRICK_RED_DEVICE_DISPLAY_NAME

This constant represents the human readable name of a RED Brick.