Remote API Constants

Remote API function return codes

A remote API function return can be a combination of following flags:

simx_return_ok (0)
The function executed fine
simx_return_novalue_flag (1 (i.e. bit 0))
There is no command reply in the input buffer. This should not always be considered as an error, depending on the selected operation mode
simx_return_timeout_flag (2 (i.e. bit 1))
The function timed out (probably the network is down or too slow)
simx_return_illegal_opmode_flag (4 (i.e. bit 2))
The specified operation mode is not supported for the given function
simx_return_remote_error_flag (8 (i.e. bit 3))
The function caused an error on the server side (e.g. an invalid handle was specified)
simx_return_split_progress_flag (16 (i.e. bit 4))
The communication thread is still processing previous split command of the same type
simx_return_local_error_flag (32 (i.e. bit 5))
The function caused an error on the client side
simx_return_initialize_error_flag (64 (i.e. bit 6))
simxStart was not yet called

Remote API function operation modes

When most remote API functions are called, they will be translated into commands that might travel to the server, and come back as a command reply from the server. The operation mode of a remote API function defines what exactly happens to those commands and command replies:

simx_opmode_oneshot
Non-blocking mode. The command is sent and a previous reply to the same command returned (if available). The function doesn't wait for the actual reply.
simx_opmode_blocking (or simx_opmode_oneshot_wait)
Blocking mode. The command is sent, and the function will wait for the actual reply and return it (if the function doesn't time out). The received command reply will be removed from the inbox buffer (other operation modes will leave their command replies in the inbox buffer)
simx_opmode_streaming + alpha
Non-blocking mode. The command is sent and a previous reply to the same command returned (if available). The command will be continuously executed on the server side. The function doesn't wait for the actual reply. Alpha is a value between 0-65535 representing the delay in ms wanted, before the same command gets executed again on the server side.
simx_opmode_oneshot_split + beta (not recommended)
Non-blocking mode. The command is sent in small chunks, and a previous reply to the same command returned (if available). The server will also send the reply in small chunks. The function doesn't wait for the actual reply. Beta is a value between 100 and 65535 representing the maximum chunk size in bytes to send. Small values won't slow down the communication framework, but it will take more time until the full command has been transferred. With large values, commands are transferred faster, but the communication framework might appear frozen while chunks are being transferred.
simx_opmode_streaming_split + beta (not recommended)
Non-blocking mode. The command is sent in small chunks and a previous reply to the same command returned (if available). The command will be continuously executed on the server side, which will also send the replies in small chunks. The function doesn't wait for the actual reply. Beta is a value between 100 and 65535 representing the maximum chunk size in bytes to send. Small values won't slow down the communication framework, but it will take more time until the full command has been transferred. With large values, commands are transferred faster, but the communication framework might appear frozen while chunks are being transferred.
simx_opmode_discontinue
Non-blocking mode. The command is sent and a previous reply to the same command returned (if available). A same command will be erased from the server side if the command is of streaming or continuous type. The same will happen on the client's input buffer. The function doesn't wait for the actual reply.
simx_opmode_buffer
Non-blocking mode. A previous reply to the same command is returned (if available). The command is not send, nor does the function wait for the actual reply.
simx_opmode_remove
Non-blocking mode. A previous reply to the same command is cleared from the input buffer (if available). The command is not send, nor does the function return any specific values, except for the return code. Can be useful to free some memory on the client side.

Make sure to also read the remote API modus operandi section.

Inbox message info type

Following values to be used with the simxGetInMessageInfo function:

simx_headeroffset_version
The version of the remote API server software
simx_headeroffset_message_id
The last received message ID. This value is incremental, but some values might be skipped
simx_headeroffset_client_time
The time stamp that was generated by the client when the message was initially sent to the server
simx_headeroffset_server_time
The time stamp that was generated by the server when commands were last executed on the server
simx_headeroffset_scene_id
A unique ID identifying the scene currently displayed
simx_headeroffset_server_state
The server state, bit coded:
bit0 set: simulation not stopped
bit1 set: simulation paused
bit2 set: real-time switch on
bit3-bit5: the edit mode type (0=no edit mode, 1=triangle, 2=vertex, 3=edge, 4=path, 5=UI)

Outbox message info type

Following values to be used with the simxGetOutMessageInfo function:

simx_headeroffset_version
The version of the remote API client software
simx_headeroffset_message_id
The next message ID that will be sent. This value is incremental.
simx_headeroffset_client_time
The current time on the client side