Package com.tinkerforge
Class BrickRED
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickRED
-
public class BrickRED extends Device
Executes user programs and controls other Bricks/Bricklets standalone
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BrickRED(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description short
abortAsyncFileRead(int fileId)
Aborts areadFileAsync(int, long)
operation in progress.void
addAsyncFileReadListener(BrickRED.AsyncFileReadListener listener)
Adds a AsyncFileRead listener.void
addAsyncFileWriteListener(BrickRED.AsyncFileWriteListener listener)
Adds a AsyncFileWrite listener.void
addFileEventsOccurredListener(BrickRED.FileEventsOccurredListener listener)
Adds a FileEventsOccurred listener.void
addProcessStateChangedListener(BrickRED.ProcessStateChangedListener listener)
Adds a ProcessStateChanged listener.void
addProgramProcessSpawnedListener(BrickRED.ProgramProcessSpawnedListener listener)
Adds a ProgramProcessSpawned listener.void
addProgramSchedulerStateChangedListener(BrickRED.ProgramSchedulerStateChangedListener listener)
Adds a ProgramSchedulerStateChanged listener.BrickRED.AllocateList
allocateList(int lengthToReserve, int sessionId)
Allocates a new list object and reserves memory for ``length_to_reserve`` items.BrickRED.AllocateString
allocateString(long lengthToReserve, java.lang.String buffer, int sessionId)
Allocates a new string object, reserves ``length_to_reserve`` bytes memory for it and sets up to the first 60 bytes.short
appendToList(int listId, int itemObjectId)
Appends an object to a list object and increases the reference count of the appended object by one.short
continueProgramSchedule(int programId)
short
createDirectory(int nameStringId, long flags, int permissions, long uid, long gid)
FIXME: name has to be absoluteBrickRED.CreatePipe
createPipe(long flags, long length, int sessionId)
Creates a new pipe and allocates a new file object for it.BrickRED.CreateSession
createSession(long lifetime)
BrickRED.DefineProgram
defineProgram(int identifierStringId, int sessionId)
short
expireSession(int sessionId)
void
expireSessionUnchecked(int sessionId)
BrickRED.CustomProgramOptionNames
getCustomProgramOptionNames(int programId, int sessionId)
BrickRED.CustomProgramOptionValue
getCustomProgramOptionValue(int programId, int nameStringId, int sessionId)
BrickRED.DirectoryName
getDirectoryName(int directoryId, int sessionId)
Returns the name of a directory object, as passed toopenDirectory(int, int)
, and the resulting error code.BrickRED.FileEvents
getFileEvents(int fileId)
BrickRED.FileInfo
getFileInfo(int fileId, int sessionId)
Returns various information about a file and the resulting error code.BrickRED.FilePosition
getFilePosition(int fileId)
Returns the current seek position of a file object and returns the resulting error code.Device.Identity
getIdentity()
Returns the UID, the UID where the Brick is connected to, the position, the hardware and firmware version as well as the device identifier.BrickRED.LastSpawnedProgramProcess
getLastSpawnedProgramProcess(int programId, int sessionId)
BrickRED.ListItem
getListItem(int listId, int index, int sessionId)
Returns the object ID and type of the object stored at ``index`` in a list object and returns the resulting error code.BrickRED.ListLength
getListLength(int listId)
Returns the length of a list object in items and the resulting error code.BrickRED.NextDirectoryEntry
getNextDirectoryEntry(int directoryId, int sessionId)
Returns the next entry in a directory object and the resulting error code.BrickRED.ProcessCommand
getProcessCommand(int processId, int sessionId)
Returns the executable, arguments, environment and working directory used to spawn a process object, as passed tospawnProcess(int, int, int, int, long, long, int, int, int, int)
, and the resulting error code.BrickRED.Processes
getProcesses(int sessionId)
BrickRED.ProcessIdentity
getProcessIdentity(int processId)
Returns the process ID and the user and group ID used to spawn a process object, as passed tospawnProcess(int, int, int, int, long, long, int, int, int, int)
, and the resulting error code.BrickRED.ProcessState
getProcessState(int processId)
Returns the current state, timestamp and exit code of a process object, and the resulting error code.BrickRED.ProcessStdio
getProcessStdio(int processId, int sessionId)
Returns the stdin, stdout and stderr files used to spawn a process object, as passed tospawnProcess(int, int, int, int, long, long, int, int, int, int)
, and the resulting error code.BrickRED.ProgramCommand
getProgramCommand(int programId, int sessionId)
FIXME: working directory is relative to <home>/programs/<identifier>/binBrickRED.ProgramIdentifier
getProgramIdentifier(int programId, int sessionId)
BrickRED.ProgramRootDirectory
getProgramRootDirectory(int programId, int sessionId)
FIXME: root directory is absolute: <home>/programs/<identifier>BrickRED.Programs
getPrograms(int sessionId)
BrickRED.ProgramSchedule
getProgramSchedule(int programId, int sessionId)
BrickRED.ProgramSchedulerState
getProgramSchedulerState(int programId, int sessionId)
FIXME: message is currently valid in error-occurred state onlyBrickRED.ProgramStdioRedirection
getProgramStdioRedirection(int programId, int sessionId)
FIXME: stdio file names are relative to <home>/programs/<identifier>/binBrickRED.StringChunk
getStringChunk(int stringId, long offset)
Returns a chunk up to 63 bytes from a string object beginning at ``offset`` and returns the resulting error code.BrickRED.StringLength
getStringLength(int stringId)
Returns the length of a string object and the resulting error code.short
keepSessionAlive(int sessionId, long lifetime)
short
killProcess(int processId, short signal)
Sends a UNIX signal to a process object and returns the resulting error code.BrickRED.OpenDirectory
openDirectory(int nameStringId, int sessionId)
Opens an existing directory and allocates a new directory object for it.BrickRED.OpenFile
openFile(int nameStringId, long flags, int permissions, long uid, long gid, int sessionId)
Opens an existing file or creates a new file and allocates a new file object for it.short
purgeProgram(int programId, long cookie)
BrickRED.ReadFile
readFile(int fileId, short lengthToRead)
Reads up to 62 bytes from a file object.void
readFileAsync(int fileId, long lengthToRead)
Reads up to 2\ :sup:`63`\ - 1 bytes from a file object asynchronously.short
releaseObject(int objectId, int sessionId)
Decreases the reference count of an object by one and returns the resulting error code.void
releaseObjectUnchecked(int objectId, int sessionId)
void
removeAsyncFileReadListener(BrickRED.AsyncFileReadListener listener)
Removes a AsyncFileRead listener.void
removeAsyncFileWriteListener(BrickRED.AsyncFileWriteListener listener)
Removes a AsyncFileWrite listener.short
removeCustomProgramOption(int programId, int nameStringId)
void
removeFileEventsOccurredListener(BrickRED.FileEventsOccurredListener listener)
Removes a FileEventsOccurred listener.short
removeFromList(int listId, int index)
Removes the object stored at ``index`` from a list object and decreases the reference count of the removed object by one.void
removeProcessStateChangedListener(BrickRED.ProcessStateChangedListener listener)
Removes a ProcessStateChanged listener.void
removeProgramProcessSpawnedListener(BrickRED.ProgramProcessSpawnedListener listener)
Removes a ProgramProcessSpawned listener.void
removeProgramSchedulerStateChangedListener(BrickRED.ProgramSchedulerStateChangedListener listener)
Removes a ProgramSchedulerStateChanged listener.short
rewindDirectory(int directoryId)
Rewinds a directory object and returns the resulting error code.short
setCustomProgramOptionValue(int programId, int nameStringId, int valueStringId)
short
setFileEvents(int fileId, int events)
BrickRED.SetFilePosition
setFilePosition(int fileId, long offset, short origin)
Set the current seek position of a file object relative to ``origin``.short
setProgramCommand(int programId, int executableStringId, int argumentsListId, int environmentListId, int workingDirectoryStringId)
FIXME: working directory is relative to <home>/programs/<identifier>/binshort
setProgramSchedule(int programId, short startMode, boolean continueAfterError, long startInterval, int startFieldsStringId)
short
setProgramStdioRedirection(int programId, short stdinRedirection, int stdinFileNameStringId, short stdoutRedirection, int stdoutFileNameStringId, short stderrRedirection, int stderrFileNameStringId)
FIXME: stdio file names are relative to <home>/programs/<identifier>/binshort
setStringChunk(int stringId, long offset, java.lang.String buffer)
Sets a chunk of up to 58 bytes in a string object beginning at ``offset``.BrickRED.SpawnProcess
spawnProcess(int executableStringId, int argumentsListId, int environmentListId, int workingDirectoryStringId, long uid, long gid, int stdinFileId, int stdoutFileId, int stderrFileId, int sessionId)
short
startProgram(int programId)
short
truncateString(int stringId, long length)
Truncates a string object to ``length`` bytes and returns the resulting error code.BrickRED.WriteFile
writeFile(int fileId, short[] buffer, short lengthToWrite)
Writes up to 61 bytes to a file object.void
writeFileAsync(int fileId, short[] buffer, short lengthToWrite)
Writes up to 61 bytes to a file object.void
writeFileUnchecked(int fileId, short[] buffer, short lengthToWrite)
Writes up to 61 bytes to a file object.-
Methods inherited from class com.tinkerforge.DeviceBase
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
-
-
-
-
Field Detail
-
DEVICE_IDENTIFIER
public static final int DEVICE_IDENTIFIER
- See Also:
- Constant Field Values
-
DEVICE_DISPLAY_NAME
public static final java.lang.String DEVICE_DISPLAY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_CREATE_SESSION
public static final byte FUNCTION_CREATE_SESSION
- See Also:
- Constant Field Values
-
FUNCTION_EXPIRE_SESSION
public static final byte FUNCTION_EXPIRE_SESSION
- See Also:
- Constant Field Values
-
FUNCTION_EXPIRE_SESSION_UNCHECKED
public static final byte FUNCTION_EXPIRE_SESSION_UNCHECKED
- See Also:
- Constant Field Values
-
FUNCTION_KEEP_SESSION_ALIVE
public static final byte FUNCTION_KEEP_SESSION_ALIVE
- See Also:
- Constant Field Values
-
FUNCTION_RELEASE_OBJECT
public static final byte FUNCTION_RELEASE_OBJECT
- See Also:
- Constant Field Values
-
FUNCTION_RELEASE_OBJECT_UNCHECKED
public static final byte FUNCTION_RELEASE_OBJECT_UNCHECKED
- See Also:
- Constant Field Values
-
FUNCTION_ALLOCATE_STRING
public static final byte FUNCTION_ALLOCATE_STRING
- See Also:
- Constant Field Values
-
FUNCTION_TRUNCATE_STRING
public static final byte FUNCTION_TRUNCATE_STRING
- See Also:
- Constant Field Values
-
FUNCTION_GET_STRING_LENGTH
public static final byte FUNCTION_GET_STRING_LENGTH
- See Also:
- Constant Field Values
-
FUNCTION_SET_STRING_CHUNK
public static final byte FUNCTION_SET_STRING_CHUNK
- See Also:
- Constant Field Values
-
FUNCTION_GET_STRING_CHUNK
public static final byte FUNCTION_GET_STRING_CHUNK
- See Also:
- Constant Field Values
-
FUNCTION_ALLOCATE_LIST
public static final byte FUNCTION_ALLOCATE_LIST
- See Also:
- Constant Field Values
-
FUNCTION_GET_LIST_LENGTH
public static final byte FUNCTION_GET_LIST_LENGTH
- See Also:
- Constant Field Values
-
FUNCTION_GET_LIST_ITEM
public static final byte FUNCTION_GET_LIST_ITEM
- See Also:
- Constant Field Values
-
FUNCTION_APPEND_TO_LIST
public static final byte FUNCTION_APPEND_TO_LIST
- See Also:
- Constant Field Values
-
FUNCTION_REMOVE_FROM_LIST
public static final byte FUNCTION_REMOVE_FROM_LIST
- See Also:
- Constant Field Values
-
FUNCTION_OPEN_FILE
public static final byte FUNCTION_OPEN_FILE
- See Also:
- Constant Field Values
-
FUNCTION_CREATE_PIPE
public static final byte FUNCTION_CREATE_PIPE
- See Also:
- Constant Field Values
-
FUNCTION_GET_FILE_INFO
public static final byte FUNCTION_GET_FILE_INFO
- See Also:
- Constant Field Values
-
FUNCTION_READ_FILE
public static final byte FUNCTION_READ_FILE
- See Also:
- Constant Field Values
-
FUNCTION_READ_FILE_ASYNC
public static final byte FUNCTION_READ_FILE_ASYNC
- See Also:
- Constant Field Values
-
FUNCTION_ABORT_ASYNC_FILE_READ
public static final byte FUNCTION_ABORT_ASYNC_FILE_READ
- See Also:
- Constant Field Values
-
FUNCTION_WRITE_FILE
public static final byte FUNCTION_WRITE_FILE
- See Also:
- Constant Field Values
-
FUNCTION_WRITE_FILE_UNCHECKED
public static final byte FUNCTION_WRITE_FILE_UNCHECKED
- See Also:
- Constant Field Values
-
FUNCTION_WRITE_FILE_ASYNC
public static final byte FUNCTION_WRITE_FILE_ASYNC
- See Also:
- Constant Field Values
-
FUNCTION_SET_FILE_POSITION
public static final byte FUNCTION_SET_FILE_POSITION
- See Also:
- Constant Field Values
-
FUNCTION_GET_FILE_POSITION
public static final byte FUNCTION_GET_FILE_POSITION
- See Also:
- Constant Field Values
-
FUNCTION_SET_FILE_EVENTS
public static final byte FUNCTION_SET_FILE_EVENTS
- See Also:
- Constant Field Values
-
FUNCTION_GET_FILE_EVENTS
public static final byte FUNCTION_GET_FILE_EVENTS
- See Also:
- Constant Field Values
-
FUNCTION_OPEN_DIRECTORY
public static final byte FUNCTION_OPEN_DIRECTORY
- See Also:
- Constant Field Values
-
FUNCTION_GET_DIRECTORY_NAME
public static final byte FUNCTION_GET_DIRECTORY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_GET_NEXT_DIRECTORY_ENTRY
public static final byte FUNCTION_GET_NEXT_DIRECTORY_ENTRY
- See Also:
- Constant Field Values
-
FUNCTION_REWIND_DIRECTORY
public static final byte FUNCTION_REWIND_DIRECTORY
- See Also:
- Constant Field Values
-
FUNCTION_CREATE_DIRECTORY
public static final byte FUNCTION_CREATE_DIRECTORY
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROCESSES
public static final byte FUNCTION_GET_PROCESSES
- See Also:
- Constant Field Values
-
FUNCTION_SPAWN_PROCESS
public static final byte FUNCTION_SPAWN_PROCESS
- See Also:
- Constant Field Values
-
FUNCTION_KILL_PROCESS
public static final byte FUNCTION_KILL_PROCESS
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROCESS_COMMAND
public static final byte FUNCTION_GET_PROCESS_COMMAND
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROCESS_IDENTITY
public static final byte FUNCTION_GET_PROCESS_IDENTITY
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROCESS_STDIO
public static final byte FUNCTION_GET_PROCESS_STDIO
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROCESS_STATE
public static final byte FUNCTION_GET_PROCESS_STATE
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROGRAMS
public static final byte FUNCTION_GET_PROGRAMS
- See Also:
- Constant Field Values
-
FUNCTION_DEFINE_PROGRAM
public static final byte FUNCTION_DEFINE_PROGRAM
- See Also:
- Constant Field Values
-
FUNCTION_PURGE_PROGRAM
public static final byte FUNCTION_PURGE_PROGRAM
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROGRAM_IDENTIFIER
public static final byte FUNCTION_GET_PROGRAM_IDENTIFIER
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROGRAM_ROOT_DIRECTORY
public static final byte FUNCTION_GET_PROGRAM_ROOT_DIRECTORY
- See Also:
- Constant Field Values
-
FUNCTION_SET_PROGRAM_COMMAND
public static final byte FUNCTION_SET_PROGRAM_COMMAND
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROGRAM_COMMAND
public static final byte FUNCTION_GET_PROGRAM_COMMAND
- See Also:
- Constant Field Values
-
FUNCTION_SET_PROGRAM_STDIO_REDIRECTION
public static final byte FUNCTION_SET_PROGRAM_STDIO_REDIRECTION
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROGRAM_STDIO_REDIRECTION
public static final byte FUNCTION_GET_PROGRAM_STDIO_REDIRECTION
- See Also:
- Constant Field Values
-
FUNCTION_SET_PROGRAM_SCHEDULE
public static final byte FUNCTION_SET_PROGRAM_SCHEDULE
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROGRAM_SCHEDULE
public static final byte FUNCTION_GET_PROGRAM_SCHEDULE
- See Also:
- Constant Field Values
-
FUNCTION_GET_PROGRAM_SCHEDULER_STATE
public static final byte FUNCTION_GET_PROGRAM_SCHEDULER_STATE
- See Also:
- Constant Field Values
-
FUNCTION_CONTINUE_PROGRAM_SCHEDULE
public static final byte FUNCTION_CONTINUE_PROGRAM_SCHEDULE
- See Also:
- Constant Field Values
-
FUNCTION_START_PROGRAM
public static final byte FUNCTION_START_PROGRAM
- See Also:
- Constant Field Values
-
FUNCTION_GET_LAST_SPAWNED_PROGRAM_PROCESS
public static final byte FUNCTION_GET_LAST_SPAWNED_PROGRAM_PROCESS
- See Also:
- Constant Field Values
-
FUNCTION_GET_CUSTOM_PROGRAM_OPTION_NAMES
public static final byte FUNCTION_GET_CUSTOM_PROGRAM_OPTION_NAMES
- See Also:
- Constant Field Values
-
FUNCTION_SET_CUSTOM_PROGRAM_OPTION_VALUE
public static final byte FUNCTION_SET_CUSTOM_PROGRAM_OPTION_VALUE
- See Also:
- Constant Field Values
-
FUNCTION_GET_CUSTOM_PROGRAM_OPTION_VALUE
public static final byte FUNCTION_GET_CUSTOM_PROGRAM_OPTION_VALUE
- See Also:
- Constant Field Values
-
FUNCTION_REMOVE_CUSTOM_PROGRAM_OPTION
public static final byte FUNCTION_REMOVE_CUSTOM_PROGRAM_OPTION
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
ERROR_CODE_SUCCESS
public static final short ERROR_CODE_SUCCESS
- See Also:
- Constant Field Values
-
ERROR_CODE_UNKNOWN_ERROR
public static final short ERROR_CODE_UNKNOWN_ERROR
- See Also:
- Constant Field Values
-
ERROR_CODE_INVALID_OPERATION
public static final short ERROR_CODE_INVALID_OPERATION
- See Also:
- Constant Field Values
-
ERROR_CODE_OPERATION_ABORTED
public static final short ERROR_CODE_OPERATION_ABORTED
- See Also:
- Constant Field Values
-
ERROR_CODE_INTERNAL_ERROR
public static final short ERROR_CODE_INTERNAL_ERROR
- See Also:
- Constant Field Values
-
ERROR_CODE_UNKNOWN_SESSION_ID
public static final short ERROR_CODE_UNKNOWN_SESSION_ID
- See Also:
- Constant Field Values
-
ERROR_CODE_NO_FREE_SESSION_ID
public static final short ERROR_CODE_NO_FREE_SESSION_ID
- See Also:
- Constant Field Values
-
ERROR_CODE_UNKNOWN_OBJECT_ID
public static final short ERROR_CODE_UNKNOWN_OBJECT_ID
- See Also:
- Constant Field Values
-
ERROR_CODE_NO_FREE_OBJECT_ID
public static final short ERROR_CODE_NO_FREE_OBJECT_ID
- See Also:
- Constant Field Values
-
ERROR_CODE_OBJECT_IS_LOCKED
public static final short ERROR_CODE_OBJECT_IS_LOCKED
- See Also:
- Constant Field Values
-
ERROR_CODE_NO_MORE_DATA
public static final short ERROR_CODE_NO_MORE_DATA
- See Also:
- Constant Field Values
-
ERROR_CODE_WRONG_LIST_ITEM_TYPE
public static final short ERROR_CODE_WRONG_LIST_ITEM_TYPE
- See Also:
- Constant Field Values
-
ERROR_CODE_PROGRAM_IS_PURGED
public static final short ERROR_CODE_PROGRAM_IS_PURGED
- See Also:
- Constant Field Values
-
ERROR_CODE_INVALID_PARAMETER
public static final short ERROR_CODE_INVALID_PARAMETER
- See Also:
- Constant Field Values
-
ERROR_CODE_NO_FREE_MEMORY
public static final short ERROR_CODE_NO_FREE_MEMORY
- See Also:
- Constant Field Values
-
ERROR_CODE_NO_FREE_SPACE
public static final short ERROR_CODE_NO_FREE_SPACE
- See Also:
- Constant Field Values
-
ERROR_CODE_ACCESS_DENIED
public static final short ERROR_CODE_ACCESS_DENIED
- See Also:
- Constant Field Values
-
ERROR_CODE_ALREADY_EXISTS
public static final short ERROR_CODE_ALREADY_EXISTS
- See Also:
- Constant Field Values
-
ERROR_CODE_DOES_NOT_EXIST
public static final short ERROR_CODE_DOES_NOT_EXIST
- See Also:
- Constant Field Values
-
ERROR_CODE_INTERRUPTED
public static final short ERROR_CODE_INTERRUPTED
- See Also:
- Constant Field Values
-
ERROR_CODE_IS_DIRECTORY
public static final short ERROR_CODE_IS_DIRECTORY
- See Also:
- Constant Field Values
-
ERROR_CODE_NOT_A_DIRECTORY
public static final short ERROR_CODE_NOT_A_DIRECTORY
- See Also:
- Constant Field Values
-
ERROR_CODE_WOULD_BLOCK
public static final short ERROR_CODE_WOULD_BLOCK
- See Also:
- Constant Field Values
-
ERROR_CODE_OVERFLOW
public static final short ERROR_CODE_OVERFLOW
- See Also:
- Constant Field Values
-
ERROR_CODE_BAD_FILE_DESCRIPTOR
public static final short ERROR_CODE_BAD_FILE_DESCRIPTOR
- See Also:
- Constant Field Values
-
ERROR_CODE_OUT_OF_RANGE
public static final short ERROR_CODE_OUT_OF_RANGE
- See Also:
- Constant Field Values
-
ERROR_CODE_NAME_TOO_LONG
public static final short ERROR_CODE_NAME_TOO_LONG
- See Also:
- Constant Field Values
-
ERROR_CODE_INVALID_SEEK
public static final short ERROR_CODE_INVALID_SEEK
- See Also:
- Constant Field Values
-
ERROR_CODE_NOT_SUPPORTED
public static final short ERROR_CODE_NOT_SUPPORTED
- See Also:
- Constant Field Values
-
ERROR_CODE_TOO_MANY_OPEN_FILES
public static final short ERROR_CODE_TOO_MANY_OPEN_FILES
- See Also:
- Constant Field Values
-
OBJECT_TYPE_STRING
public static final short OBJECT_TYPE_STRING
- See Also:
- Constant Field Values
-
OBJECT_TYPE_LIST
public static final short OBJECT_TYPE_LIST
- See Also:
- Constant Field Values
-
OBJECT_TYPE_FILE
public static final short OBJECT_TYPE_FILE
- See Also:
- Constant Field Values
-
OBJECT_TYPE_DIRECTORY
public static final short OBJECT_TYPE_DIRECTORY
- See Also:
- Constant Field Values
-
OBJECT_TYPE_PROCESS
public static final short OBJECT_TYPE_PROCESS
- See Also:
- Constant Field Values
-
OBJECT_TYPE_PROGRAM
public static final short OBJECT_TYPE_PROGRAM
- See Also:
- Constant Field Values
-
FILE_FLAG_READ_ONLY
public static final long FILE_FLAG_READ_ONLY
- See Also:
- Constant Field Values
-
FILE_FLAG_WRITE_ONLY
public static final long FILE_FLAG_WRITE_ONLY
- See Also:
- Constant Field Values
-
FILE_FLAG_READ_WRITE
public static final long FILE_FLAG_READ_WRITE
- See Also:
- Constant Field Values
-
FILE_FLAG_APPEND
public static final long FILE_FLAG_APPEND
- See Also:
- Constant Field Values
-
FILE_FLAG_CREATE
public static final long FILE_FLAG_CREATE
- See Also:
- Constant Field Values
-
FILE_FLAG_EXCLUSIVE
public static final long FILE_FLAG_EXCLUSIVE
- See Also:
- Constant Field Values
-
FILE_FLAG_NON_BLOCKING
public static final long FILE_FLAG_NON_BLOCKING
- See Also:
- Constant Field Values
-
FILE_FLAG_TRUNCATE
public static final long FILE_FLAG_TRUNCATE
- See Also:
- Constant Field Values
-
FILE_FLAG_TEMPORARY
public static final long FILE_FLAG_TEMPORARY
- See Also:
- Constant Field Values
-
FILE_FLAG_REPLACE
public static final long FILE_FLAG_REPLACE
- See Also:
- Constant Field Values
-
FILE_PERMISSION_USER_ALL
public static final int FILE_PERMISSION_USER_ALL
- See Also:
- Constant Field Values
-
FILE_PERMISSION_USER_READ
public static final int FILE_PERMISSION_USER_READ
- See Also:
- Constant Field Values
-
FILE_PERMISSION_USER_WRITE
public static final int FILE_PERMISSION_USER_WRITE
- See Also:
- Constant Field Values
-
FILE_PERMISSION_USER_EXECUTE
public static final int FILE_PERMISSION_USER_EXECUTE
- See Also:
- Constant Field Values
-
FILE_PERMISSION_GROUP_ALL
public static final int FILE_PERMISSION_GROUP_ALL
- See Also:
- Constant Field Values
-
FILE_PERMISSION_GROUP_READ
public static final int FILE_PERMISSION_GROUP_READ
- See Also:
- Constant Field Values
-
FILE_PERMISSION_GROUP_WRITE
public static final int FILE_PERMISSION_GROUP_WRITE
- See Also:
- Constant Field Values
-
FILE_PERMISSION_GROUP_EXECUTE
public static final int FILE_PERMISSION_GROUP_EXECUTE
- See Also:
- Constant Field Values
-
FILE_PERMISSION_OTHERS_ALL
public static final int FILE_PERMISSION_OTHERS_ALL
- See Also:
- Constant Field Values
-
FILE_PERMISSION_OTHERS_READ
public static final int FILE_PERMISSION_OTHERS_READ
- See Also:
- Constant Field Values
-
FILE_PERMISSION_OTHERS_WRITE
public static final int FILE_PERMISSION_OTHERS_WRITE
- See Also:
- Constant Field Values
-
FILE_PERMISSION_OTHERS_EXECUTE
public static final int FILE_PERMISSION_OTHERS_EXECUTE
- See Also:
- Constant Field Values
-
PIPE_FLAG_NON_BLOCKING_READ
public static final long PIPE_FLAG_NON_BLOCKING_READ
- See Also:
- Constant Field Values
-
PIPE_FLAG_NON_BLOCKING_WRITE
public static final long PIPE_FLAG_NON_BLOCKING_WRITE
- See Also:
- Constant Field Values
-
FILE_TYPE_UNKNOWN
public static final short FILE_TYPE_UNKNOWN
- See Also:
- Constant Field Values
-
FILE_TYPE_REGULAR
public static final short FILE_TYPE_REGULAR
- See Also:
- Constant Field Values
-
FILE_TYPE_DIRECTORY
public static final short FILE_TYPE_DIRECTORY
- See Also:
- Constant Field Values
-
FILE_TYPE_CHARACTER
public static final short FILE_TYPE_CHARACTER
- See Also:
- Constant Field Values
-
FILE_TYPE_BLOCK
public static final short FILE_TYPE_BLOCK
- See Also:
- Constant Field Values
-
FILE_TYPE_FIFO
public static final short FILE_TYPE_FIFO
- See Also:
- Constant Field Values
-
FILE_TYPE_SYMLINK
public static final short FILE_TYPE_SYMLINK
- See Also:
- Constant Field Values
-
FILE_TYPE_SOCKET
public static final short FILE_TYPE_SOCKET
- See Also:
- Constant Field Values
-
FILE_TYPE_PIPE
public static final short FILE_TYPE_PIPE
- See Also:
- Constant Field Values
-
FILE_ORIGIN_BEGINNING
public static final short FILE_ORIGIN_BEGINNING
- See Also:
- Constant Field Values
-
FILE_ORIGIN_CURRENT
public static final short FILE_ORIGIN_CURRENT
- See Also:
- Constant Field Values
-
FILE_ORIGIN_END
public static final short FILE_ORIGIN_END
- See Also:
- Constant Field Values
-
FILE_EVENT_READABLE
public static final int FILE_EVENT_READABLE
- See Also:
- Constant Field Values
-
FILE_EVENT_WRITABLE
public static final int FILE_EVENT_WRITABLE
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_UNKNOWN
public static final short DIRECTORY_ENTRY_TYPE_UNKNOWN
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_REGULAR
public static final short DIRECTORY_ENTRY_TYPE_REGULAR
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_DIRECTORY
public static final short DIRECTORY_ENTRY_TYPE_DIRECTORY
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_CHARACTER
public static final short DIRECTORY_ENTRY_TYPE_CHARACTER
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_BLOCK
public static final short DIRECTORY_ENTRY_TYPE_BLOCK
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_FIFO
public static final short DIRECTORY_ENTRY_TYPE_FIFO
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_SYMLINK
public static final short DIRECTORY_ENTRY_TYPE_SYMLINK
- See Also:
- Constant Field Values
-
DIRECTORY_ENTRY_TYPE_SOCKET
public static final short DIRECTORY_ENTRY_TYPE_SOCKET
- See Also:
- Constant Field Values
-
DIRECTORY_FLAG_RECURSIVE
public static final long DIRECTORY_FLAG_RECURSIVE
- See Also:
- Constant Field Values
-
DIRECTORY_FLAG_EXCLUSIVE
public static final long DIRECTORY_FLAG_EXCLUSIVE
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_INTERRUPT
public static final short PROCESS_SIGNAL_INTERRUPT
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_QUIT
public static final short PROCESS_SIGNAL_QUIT
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_ABORT
public static final short PROCESS_SIGNAL_ABORT
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_KILL
public static final short PROCESS_SIGNAL_KILL
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_USER1
public static final short PROCESS_SIGNAL_USER1
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_USER2
public static final short PROCESS_SIGNAL_USER2
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_TERMINATE
public static final short PROCESS_SIGNAL_TERMINATE
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_CONTINUE
public static final short PROCESS_SIGNAL_CONTINUE
- See Also:
- Constant Field Values
-
PROCESS_SIGNAL_STOP
public static final short PROCESS_SIGNAL_STOP
- See Also:
- Constant Field Values
-
PROCESS_STATE_UNKNOWN
public static final short PROCESS_STATE_UNKNOWN
- See Also:
- Constant Field Values
-
PROCESS_STATE_RUNNING
public static final short PROCESS_STATE_RUNNING
- See Also:
- Constant Field Values
-
PROCESS_STATE_ERROR
public static final short PROCESS_STATE_ERROR
- See Also:
- Constant Field Values
-
PROCESS_STATE_EXITED
public static final short PROCESS_STATE_EXITED
- See Also:
- Constant Field Values
-
PROCESS_STATE_KILLED
public static final short PROCESS_STATE_KILLED
- See Also:
- Constant Field Values
-
PROCESS_STATE_STOPPED
public static final short PROCESS_STATE_STOPPED
- See Also:
- Constant Field Values
-
PROGRAM_STDIO_REDIRECTION_DEV_NULL
public static final short PROGRAM_STDIO_REDIRECTION_DEV_NULL
- See Also:
- Constant Field Values
-
PROGRAM_STDIO_REDIRECTION_PIPE
public static final short PROGRAM_STDIO_REDIRECTION_PIPE
- See Also:
- Constant Field Values
-
PROGRAM_STDIO_REDIRECTION_FILE
public static final short PROGRAM_STDIO_REDIRECTION_FILE
- See Also:
- Constant Field Values
-
PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG
public static final short PROGRAM_STDIO_REDIRECTION_INDIVIDUAL_LOG
- See Also:
- Constant Field Values
-
PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG
public static final short PROGRAM_STDIO_REDIRECTION_CONTINUOUS_LOG
- See Also:
- Constant Field Values
-
PROGRAM_STDIO_REDIRECTION_STDOUT
public static final short PROGRAM_STDIO_REDIRECTION_STDOUT
- See Also:
- Constant Field Values
-
PROGRAM_START_MODE_NEVER
public static final short PROGRAM_START_MODE_NEVER
- See Also:
- Constant Field Values
-
PROGRAM_START_MODE_ALWAYS
public static final short PROGRAM_START_MODE_ALWAYS
- See Also:
- Constant Field Values
-
PROGRAM_START_MODE_INTERVAL
public static final short PROGRAM_START_MODE_INTERVAL
- See Also:
- Constant Field Values
-
PROGRAM_START_MODE_CRON
public static final short PROGRAM_START_MODE_CRON
- See Also:
- Constant Field Values
-
PROGRAM_SCHEDULER_STATE_STOPPED
public static final short PROGRAM_SCHEDULER_STATE_STOPPED
- See Also:
- Constant Field Values
-
PROGRAM_SCHEDULER_STATE_RUNNING
public static final short PROGRAM_SCHEDULER_STATE_RUNNING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickRED
public BrickRED(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid. and adds it to the IP Connection \c ipcon.
-
-
Method Detail
-
createSession
public BrickRED.CreateSession createSession(long lifetime) throws TinkerforgeException
- Throws:
TinkerforgeException
-
expireSession
public short expireSession(int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
expireSessionUnchecked
public void expireSessionUnchecked(int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
keepSessionAlive
public short keepSessionAlive(int sessionId, long lifetime) throws TinkerforgeException
- Throws:
TinkerforgeException
-
releaseObject
public short releaseObject(int objectId, int sessionId) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
releaseObjectUnchecked
public void releaseObjectUnchecked(int objectId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
allocateString
public BrickRED.AllocateString allocateString(long lengthToReserve, java.lang.String buffer, int sessionId) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
truncateString
public short truncateString(int stringId, long length) throws TinkerforgeException
Truncates a string object to ``length`` bytes and returns the resulting error code.- Throws:
TinkerforgeException
-
getStringLength
public BrickRED.StringLength getStringLength(int stringId) throws TinkerforgeException
Returns the length of a string object and the resulting error code.- Throws:
TinkerforgeException
-
setStringChunk
public short setStringChunk(int stringId, long offset, java.lang.String buffer) throws TinkerforgeException
Sets a chunk of up to 58 bytes in a string object beginning at ``offset``. Returns the resulting error code.- Throws:
TinkerforgeException
-
getStringChunk
public BrickRED.StringChunk getStringChunk(int stringId, long offset) throws TinkerforgeException
Returns a chunk up to 63 bytes from a string object beginning at ``offset`` and returns the resulting error code.- Throws:
TinkerforgeException
-
allocateList
public BrickRED.AllocateList allocateList(int lengthToReserve, int sessionId) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
getListLength
public BrickRED.ListLength getListLength(int listId) throws TinkerforgeException
Returns the length of a list object in items and the resulting error code.- Throws:
TinkerforgeException
-
getListItem
public BrickRED.ListItem getListItem(int listId, int index, int sessionId) throws TinkerforgeException
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- Throws:
TinkerforgeException
-
appendToList
public short appendToList(int listId, int itemObjectId) throws TinkerforgeException
Appends an object to a list object and increases the reference count of the appended object by one. Returns the resulting error code.- Throws:
TinkerforgeException
-
removeFromList
public short removeFromList(int listId, int index) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
openFile
public BrickRED.OpenFile openFile(int nameStringId, long flags, int permissions, long uid, long gid, int sessionId) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
createPipe
public BrickRED.CreatePipe createPipe(long flags, long length, int sessionId) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
getFileInfo
public BrickRED.FileInfo getFileInfo(int fileId, int sessionId) throws TinkerforgeException
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 toopenFile(int, long, int, long, long, int)
. The returned flags were used to open or create the file object, as passed toopenFile(int, long, int, long, long, int)
orcreatePipe(long, long, int)
. 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*- Throws:
TinkerforgeException
-
readFile
public BrickRED.ReadFile readFile(int fileId, short lengthToRead) throws TinkerforgeException
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 byopenFile(int, long, int, long, long, int)
without the *NonBlocking* flag or bycreatePipe(long, long, int)
without the *NonBlockingRead* flag then the error code *NotSupported* is returned.- Throws:
TinkerforgeException
-
readFileAsync
public void readFileAsync(int fileId, long lengthToRead) throws TinkerforgeException
Reads up to 2\ :sup:`63`\ - 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 theBrickRED.AsyncFileReadListener
listener. 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 byopenFile(int, long, int, long, long, int)
without the *NonBlocking* flag or bycreatePipe(long, long, int)
without the *NonBlockingRead* flag then the error code *NotSupported* is reported via theBrickRED.AsyncFileReadListener
listener.- Throws:
TinkerforgeException
-
abortAsyncFileRead
public short abortAsyncFileRead(int fileId) throws TinkerforgeException
Aborts areadFileAsync(int, long)
operation in progress. Returns the resulting error code. On success theBrickRED.AsyncFileReadListener
listener will report *OperationAborted*.- Throws:
TinkerforgeException
-
writeFile
public BrickRED.WriteFile writeFile(int fileId, short[] buffer, short lengthToWrite) throws TinkerforgeException
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 byopenFile(int, long, int, long, long, int)
without the *NonBlocking* flag or bycreatePipe(long, long, int)
without the *NonBlockingWrite* flag then the error code *NotSupported* is returned.- Throws:
TinkerforgeException
-
writeFileUnchecked
public void writeFileUnchecked(int fileId, short[] buffer, short lengthToWrite) throws TinkerforgeException
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 byopenFile(int, long, int, long, long, int)
without the *NonBlocking* flag or bycreatePipe(long, long, int)
without the *NonBlockingWrite* flag then the write operation will fail silently.- Throws:
TinkerforgeException
-
writeFileAsync
public void writeFileAsync(int fileId, short[] buffer, short lengthToWrite) throws TinkerforgeException
Writes up to 61 bytes to a file object. Reports the actual number of bytes written and the resulting error code via theBrickRED.AsyncFileWriteListener
listener. If the file object was created byopenFile(int, long, int, long, long, int)
without the *NonBlocking* flag or bycreatePipe(long, long, int)
without the *NonBlockingWrite* flag then the error code *NotSupported* is reported via theBrickRED.AsyncFileWriteListener
listener.- Throws:
TinkerforgeException
-
setFilePosition
public BrickRED.SetFilePosition setFilePosition(int fileId, long offset, short origin) throws TinkerforgeException
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 bycreatePipe(long, long, int)
then it has no seek position and the error code *InvalidSeek* is returned.- Throws:
TinkerforgeException
-
getFilePosition
public BrickRED.FilePosition getFilePosition(int fileId) throws TinkerforgeException
Returns the current seek position of a file object and returns the resulting error code. If the file object was created bycreatePipe(long, long, int)
then it has no seek position and the error code *InvalidSeek* is returned.- Throws:
TinkerforgeException
-
setFileEvents
public short setFileEvents(int fileId, int events) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getFileEvents
public BrickRED.FileEvents getFileEvents(int fileId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
openDirectory
public BrickRED.OpenDirectory openDirectory(int nameStringId, int sessionId) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
getDirectoryName
public BrickRED.DirectoryName getDirectoryName(int directoryId, int sessionId) throws TinkerforgeException
Returns the name of a directory object, as passed toopenDirectory(int, int)
, and the resulting error code.- Throws:
TinkerforgeException
-
getNextDirectoryEntry
public BrickRED.NextDirectoryEntry getNextDirectoryEntry(int directoryId, int sessionId) throws TinkerforgeException
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 callrewindDirectory(int)
. Possible directory entry types are: * Unknown = 0 * Regular = 1 * Directory = 2 * Character = 3 * Block = 4 * FIFO = 5 * Symlink = 6 * Socket = 7- Throws:
TinkerforgeException
-
rewindDirectory
public short rewindDirectory(int directoryId) throws TinkerforgeException
Rewinds a directory object and returns the resulting error code.- Throws:
TinkerforgeException
-
createDirectory
public short createDirectory(int nameStringId, long flags, int permissions, long uid, long gid) throws TinkerforgeException
FIXME: name has to be absolute- Throws:
TinkerforgeException
-
getProcesses
public BrickRED.Processes getProcesses(int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
spawnProcess
public BrickRED.SpawnProcess spawnProcess(int executableStringId, int argumentsListId, int environmentListId, int workingDirectoryStringId, long uid, long gid, int stdinFileId, int stdoutFileId, int stderrFileId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
killProcess
public short killProcess(int processId, short signal) throws TinkerforgeException
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- Throws:
TinkerforgeException
-
getProcessCommand
public BrickRED.ProcessCommand getProcessCommand(int processId, int sessionId) throws TinkerforgeException
Returns the executable, arguments, environment and working directory used to spawn a process object, as passed tospawnProcess(int, int, int, int, long, long, int, int, int, int)
, and the resulting error code.- Throws:
TinkerforgeException
-
getProcessIdentity
public BrickRED.ProcessIdentity getProcessIdentity(int processId) throws TinkerforgeException
Returns the process ID and the user and group ID used to spawn a process object, as passed tospawnProcess(int, int, int, int, long, long, int, int, int, int)
, and the resulting error code. The process ID is only valid if the state is *Running* or *Stopped*, seegetProcessState(int)
.- Throws:
TinkerforgeException
-
getProcessStdio
public BrickRED.ProcessStdio getProcessStdio(int processId, int sessionId) throws TinkerforgeException
Returns the stdin, stdout and stderr files used to spawn a process object, as passed tospawnProcess(int, int, int, int, long, long, int, int, int, int)
, and the resulting error code.- Throws:
TinkerforgeException
-
getProcessState
public BrickRED.ProcessState getProcessState(int processId) throws TinkerforgeException
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.- Throws:
TinkerforgeException
-
getPrograms
public BrickRED.Programs getPrograms(int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
defineProgram
public BrickRED.DefineProgram defineProgram(int identifierStringId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
purgeProgram
public short purgeProgram(int programId, long cookie) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getProgramIdentifier
public BrickRED.ProgramIdentifier getProgramIdentifier(int programId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getProgramRootDirectory
public BrickRED.ProgramRootDirectory getProgramRootDirectory(int programId, int sessionId) throws TinkerforgeException
FIXME: root directory is absolute: <home>/programs/<identifier>- Throws:
TinkerforgeException
-
setProgramCommand
public short setProgramCommand(int programId, int executableStringId, int argumentsListId, int environmentListId, int workingDirectoryStringId) throws TinkerforgeException
FIXME: working directory is relative to <home>/programs/<identifier>/bin- Throws:
TinkerforgeException
-
getProgramCommand
public BrickRED.ProgramCommand getProgramCommand(int programId, int sessionId) throws TinkerforgeException
FIXME: working directory is relative to <home>/programs/<identifier>/bin- Throws:
TinkerforgeException
-
setProgramStdioRedirection
public short setProgramStdioRedirection(int programId, short stdinRedirection, int stdinFileNameStringId, short stdoutRedirection, int stdoutFileNameStringId, short stderrRedirection, int stderrFileNameStringId) throws TinkerforgeException
FIXME: stdio file names are relative to <home>/programs/<identifier>/bin- Throws:
TinkerforgeException
-
getProgramStdioRedirection
public BrickRED.ProgramStdioRedirection getProgramStdioRedirection(int programId, int sessionId) throws TinkerforgeException
FIXME: stdio file names are relative to <home>/programs/<identifier>/bin- Throws:
TinkerforgeException
-
setProgramSchedule
public short setProgramSchedule(int programId, short startMode, boolean continueAfterError, long startInterval, int startFieldsStringId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getProgramSchedule
public BrickRED.ProgramSchedule getProgramSchedule(int programId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getProgramSchedulerState
public BrickRED.ProgramSchedulerState getProgramSchedulerState(int programId, int sessionId) throws TinkerforgeException
FIXME: message is currently valid in error-occurred state only- Throws:
TinkerforgeException
-
continueProgramSchedule
public short continueProgramSchedule(int programId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
startProgram
public short startProgram(int programId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getLastSpawnedProgramProcess
public BrickRED.LastSpawnedProgramProcess getLastSpawnedProgramProcess(int programId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getCustomProgramOptionNames
public BrickRED.CustomProgramOptionNames getCustomProgramOptionNames(int programId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
setCustomProgramOptionValue
public short setCustomProgramOptionValue(int programId, int nameStringId, int valueStringId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getCustomProgramOptionValue
public BrickRED.CustomProgramOptionValue getCustomProgramOptionValue(int programId, int nameStringId, int sessionId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
removeCustomProgramOption
public short removeCustomProgramOption(int programId, int nameStringId) throws TinkerforgeException
- Throws:
TinkerforgeException
-
getIdentity
public Device.Identity getIdentity() throws TinkerforgeException
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 :ref:`here <device_identifier>`. |device_identifier_constant|- Specified by:
getIdentity
in classDevice
- Throws:
TinkerforgeException
-
addAsyncFileReadListener
public void addAsyncFileReadListener(BrickRED.AsyncFileReadListener listener)
Adds a AsyncFileRead listener.
-
removeAsyncFileReadListener
public void removeAsyncFileReadListener(BrickRED.AsyncFileReadListener listener)
Removes a AsyncFileRead listener.
-
addAsyncFileWriteListener
public void addAsyncFileWriteListener(BrickRED.AsyncFileWriteListener listener)
Adds a AsyncFileWrite listener.
-
removeAsyncFileWriteListener
public void removeAsyncFileWriteListener(BrickRED.AsyncFileWriteListener listener)
Removes a AsyncFileWrite listener.
-
addFileEventsOccurredListener
public void addFileEventsOccurredListener(BrickRED.FileEventsOccurredListener listener)
Adds a FileEventsOccurred listener.
-
removeFileEventsOccurredListener
public void removeFileEventsOccurredListener(BrickRED.FileEventsOccurredListener listener)
Removes a FileEventsOccurred listener.
-
addProcessStateChangedListener
public void addProcessStateChangedListener(BrickRED.ProcessStateChangedListener listener)
Adds a ProcessStateChanged listener.
-
removeProcessStateChangedListener
public void removeProcessStateChangedListener(BrickRED.ProcessStateChangedListener listener)
Removes a ProcessStateChanged listener.
-
addProgramSchedulerStateChangedListener
public void addProgramSchedulerStateChangedListener(BrickRED.ProgramSchedulerStateChangedListener listener)
Adds a ProgramSchedulerStateChanged listener.
-
removeProgramSchedulerStateChangedListener
public void removeProgramSchedulerStateChangedListener(BrickRED.ProgramSchedulerStateChangedListener listener)
Removes a ProgramSchedulerStateChanged listener.
-
addProgramProcessSpawnedListener
public void addProgramProcessSpawnedListener(BrickRED.ProgramProcessSpawnedListener listener)
Adds a ProgramProcessSpawned listener.
-
removeProgramProcessSpawnedListener
public void removeProgramProcessSpawnedListener(BrickRED.ProgramProcessSpawnedListener listener)
Removes a ProgramProcessSpawned listener.
-
-