private static int DoPrepareForConnection(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string remoteProtocolInfo;
string peerConnectionManager;
int peerConnectionID;
string direction;
int connectionID;
int aVTransportID;
int rcsID;
try
{
invocation.ReadStart();
remoteProtocolInfo = invocation.ReadString("RemoteProtocolInfo");
peerConnectionManager = invocation.ReadString("PeerConnectionManager");
peerConnectionID = invocation.ReadInt("PeerConnectionID");
direction = invocation.ReadString("Direction");
invocation.ReadEnd();
self.PrepareForConnection(invocation, remoteProtocolInfo, peerConnectionManager, peerConnectionID, direction, out connectionID, out aVTransportID, out rcsID);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "PrepareForConnection");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "PrepareForConnection" }));
return -1;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "PrepareForConnection" });
System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteInt("ConnectionID", connectionID);
invocation.WriteInt("AVTransportID", aVTransportID);
invocation.WriteInt("RcsID", rcsID);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "PrepareForConnection" });
System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}