Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
3/12/2014
This method will send a Command Packet to the device-side application. The device side application's callback function will then act upon this packet. The device side application will return a Command Packet at the end of the callback function. Whether the Command Packet has data in it is up to the implementation.
Namespace: Microsoft.RemoteToolSdk.PluginComponents
Assembly: Microsoft.RemoteToolSdk (in microsoft.remotetoolsdk.dll)
Syntax
public CommandPacket ProcessCommand (
CommandPacket commandIn,
PluginData pluginData
)
'Declaration
Public Function ProcessCommand ( _
commandIn As CommandPacket, _
pluginData As PluginData _
) As CommandPacket
Parameters
- commandIn
The Command Packet to send to the device.
- pluginData
The plugin data object that is associated with the packet.
Return Value
The Command Packet received from the device.
Remarks
This is a synchronous call. This method blocks until the device-side application returns.
Typically this method is called from a OnGetData implementation in your plug-in's data objects. The OnGetData method in your data object is called by the Remote Tools Framework in a thread, so the fact that this method blocks is not an issue for typical plug-in development.
If you use this method in an unconventional implementation, you may want to consider placing it in a thread to keep the UI responsive.
Example
The following example shows a typical GetData implementation in a PluginData object.
public MyData : PluginData
{
...
protected override void OnGetData()
{
CommandPacket sendCommand = new CommandPacket();
//
// Populate the command object (command value of 1)
//
sendCommand.CommandId = 1;
//
// Process the command
//
CommandPacket receivedCommand =
base.CommandTransport.ProcessCommand(sendCommand, this);
//
// Take the return value (in this example, a string)
// and place it in our data structure
//
this.myString = receivedCommand.GetParameterString();
//
// The view panel will now be allowed to render this data if asked.
//
this.Initialized = true;
}
}
The following code example shows one example of what the native C++ device-side code that handles the code in the preceding example might look like.
HRESULT STDAPICALLTYPE MyCallback(
DWORD cmd,
const CCommandPacket* pCmdDataIn,
CCommandPacket* pCmdDataOut
)
{
switch (cmd)
{
case 1:
pCmdDataOut->AddString ( _T("Hello World!") );
break;
}
return S_OK;
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.
See Also
Reference
CommandTransport Class
CommandTransport Members
Microsoft.RemoteToolSdk.PluginComponents Namespace