private static int DoGetCurrentConnectionInfo(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); int connectionID; int rcsID; int aVTransportID; string protocolInfo; string peerConnectionManager; int peerConnectionID; string direction; string status; try { invocation.ReadStart(); connectionID = invocation.ReadInt("ConnectionID"); invocation.ReadEnd(); self.GetCurrentConnectionInfo(invocation, connectionID, out rcsID, out aVTransportID, out protocolInfo, out peerConnectionManager, out peerConnectionID, out direction, out status); } catch (ActionError e) { invocation.ReportActionError(e, "GetCurrentConnectionInfo"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetCurrentConnectionInfo" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetCurrentConnectionInfo" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteInt("RcsID", rcsID); invocation.WriteInt("AVTransportID", aVTransportID); invocation.WriteString("ProtocolInfo", protocolInfo); invocation.WriteString("PeerConnectionManager", peerConnectionManager); invocation.WriteInt("PeerConnectionID", peerConnectionID); invocation.WriteString("Direction", direction); invocation.WriteString("Status", status); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetCurrentConnectionInfo" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
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}", "PrepareForConnection")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "PrepareForConnection", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "PrepareForConnection", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoGetProtocolInfo(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string source; string sink; try { invocation.ReadStart(); invocation.ReadEnd(); self.GetProtocolInfo(invocation, out source, out sink); } catch (ActionError e) { invocation.ReportActionError(e, "GetProtocolInfo"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetProtocolInfo" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetProtocolInfo" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteString("Source", source); invocation.WriteString("Sink", sink); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetProtocolInfo" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoConnectionComplete(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); int connectionID; try { invocation.ReadStart(); connectionID = invocation.ReadInt("ConnectionID"); invocation.ReadEnd(); self.ConnectionComplete(invocation, connectionID); } catch (ActionError e) { invocation.ReportActionError(e, "ConnectionComplete"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "ConnectionComplete" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "ConnectionComplete" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "ConnectionComplete" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoGetCurrentConnectionIDs(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string connectionIDs; try { invocation.ReadStart(); invocation.ReadEnd(); self.GetCurrentConnectionIDs(invocation, out connectionIDs); } catch (ActionError e) { invocation.ReportActionError(e, "GetCurrentConnectionIDs"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetCurrentConnectionIDs")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetCurrentConnectionIDs", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteString("ConnectionIDs", connectionIDs); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetCurrentConnectionIDs", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }