TRVCamSender.SendCmd, BeginCmd, EndCmd, WaitSendCmd

<< Click to display table of contents >>

TRVCamSender.SendCmd, BeginCmd, EndCmd, WaitSendCmd

Methods for sending commands to TRVCamReceiver (when the sender is connected via the network with TRVCamReceiver either directly or through TRVMediaServer).

procedure BeginCmd;

procedure EndCmd;

procedure WaitForSendCmd(IsProcessMessages: Boolean; AMediaIndex: Word = 0);

procedure SendCmd(Cmd: TRVCmd; vGUIDTo: TRVMAnsiString = '';

  vGUIDGroup: TRVMAnsiString = ''; AMediaIndex: Word = 0);

When connected to TRVMediaServer:

Names of commands sent to a server must not start from 'RV_' or 'RVS_', These prefixes are reserved for system commands.

SendCmd sends Cmd to the client specified in vGUIDTo (if vGUIDTo is empy, GUIDTo property is used instead). If they are empty, the command is sent to clients belonging to the group having identifier vGUIDGroup (if vGUIDGroup is empty, GUIDGroup property is used instead). Otherwise, the command is sent to the default receivers (if they are defined). When the client's receiver receives a command, OnReceiveCmdData event occurs.

Commands with names starting from 'RVSU_' are processed specially. They are sent to the server itself (GUID parameters are ignored). When the server receives it, OnServerCmd event occurs. These commands are not resent by the server to clients. Commands to the server must not be large: the total command size, including all internal information, must not exceed 8912 bytes.

When connected to TRVCamReceiver:

SendCmd sends Cmd to the receiver, vGUIDTo may specify a receiver identifier (if vGUIDTo is empy, GUIDTo property is used instead). Group identifier is ignored. When the receiver receives a command, OnReceiveCmdData event occurs.

 

SendCmd only initiates sending, and exits before this command is actually sent. It's not guaranteed that commands will be received by the other side in the order they were sent by SendCmd. To provide a sequential receiving of commands, you can use WaitForSendCmd. When called after SendCmd, WaitForSendCmd waits until this command is sent and received. If IsProcessMessages=True, WaitForSendCmd contains a cycle calling Application.ProcessMessages, so check Application.Terminated after.

If you need to send several commands, call BeginCmd, then call multiple SendCmd, then call EndCmd. In this mode, commands are accumulated when calling SendCmd, and sent only in EndCmd. This mode guarantees that commands will be received by the other side in the order they were accumulated by SendCmd.

Media channels

The optional AMediaIndex parameter allows defining the index of media channel, thus linking this command to this channel. In the most applications, you can leave this parameter equal to 0. Commands in different channels can be sent at the same time.