TRVCamSender.SendCmd, BeginCmd, EndCmd, WaitSendCmd
|Top Previous Next|
procedure WaitForSendCmd(IsProcessMessages: Boolean);
procedure SendCmd(Cmd: TRVCmd;
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.
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.