我为我的 UPnP 设备定义了以下 SCPD 文档:
<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0" >
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<actionList>
<action>
<name>Echo</name>
<argumentList>
<argument>
<name>InText</name>
<relatedStateVariable>Text</relatedStateVariable>
<direction>in</direction>
</argument>
<argument>
<name>ReturnText</name>
<relatedStateVariable>Text</relatedStateVariable>
<direction>out</direction>
</argument>
</argumentList>
</action>
</actionList>
<serviceStateTable>
<stateVariable sendEvents="no">
<name>Text</name>
<dataType>string</dataType>
</stateVariable>
</serviceStateTable>
</scpd>
我也注册了我的 UPnP 设备。我还能够检索我的 UPnPDevice。我将如何调用 SCPD 文档中定义的回显操作?
调用动作的代码应该是这样的:
var o: IUPnPDeviceFinder;
d: IUPnPDevice;
s: IUPnPService;
E: IEnumVARIANT;
K: OleVariant;
iFetched: Cardinal;
V1, V2: OleVariant;
r: HRESULT;
begin
o := CoUPnPDeviceFinder.Create;
d := o.FindByUDN('uuid:a6d332da-f8ce-43ce-8210-79eacd4231c6');
E := d.Services._NewEnum as IEnumVARIANT;
E.Reset;
CheckOSError(E.Next(1, K, iFetched));
s := IDispatch(K) as IUPnPService;
r := s.InvokeAction('Echo', v1, v2);
ShowMessage(v2);
end;
如何为 InvokeAction 形成 v1 和 v2 参数?