private static int DoDetails(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgInfo1 self = (DvProviderAvOpenhomeOrgInfo1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint duration; uint bitRate; uint bitDepth; uint sampleRate; bool lossless; string codecName; try { invocation.ReadStart(); invocation.ReadEnd(); self.Details(invocation, out duration, out bitRate, out bitDepth, out sampleRate, out lossless, out codecName); } catch (ActionError e) { invocation.ReportActionError(e, "Details"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Details")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Details", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("Duration", duration); invocation.WriteUint("BitRate", bitRate); invocation.WriteUint("BitDepth", bitDepth); invocation.WriteUint("SampleRate", sampleRate); invocation.WriteBool("Lossless", lossless); invocation.WriteString("CodecName", codecName); 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, "Details", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoGetColorComponents(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint color; uint brightness; uint red; uint green; uint blue; try { invocation.ReadStart(); color = invocation.ReadUint("Color"); invocation.ReadEnd(); self.GetColorComponents(invocation, color, out brightness, out red, out green, out blue); } catch (ActionError e) { invocation.ReportActionError(e, "GetColorComponents"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetColorComponents")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetColorComponents", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("Brightness", brightness); invocation.WriteUint("Red", red); invocation.WriteUint("Green", green); invocation.WriteUint("Blue", blue); 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, "GetColorComponents", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoGetPosition(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index; uint x; uint y; uint z; try { invocation.ReadStart(); index = invocation.ReadUint("Index"); invocation.ReadEnd(); self.GetPosition(invocation, index, out x, out y, out z); } catch (ActionError e) { invocation.ReportActionError(e, "GetPosition"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetPosition")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetPosition", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("X", x); invocation.WriteUint("Y", y); invocation.WriteUint("Z", z); 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, "GetPosition", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoPorts(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgNetworkMonitor1 self = (DvProviderAvOpenhomeOrgNetworkMonitor1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint sender; uint receiver; uint results; try { invocation.ReadStart(); invocation.ReadEnd(); self.Ports(invocation, out sender, out receiver, out results); } catch (ActionError e) { invocation.ReportActionError(e, "Ports"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Ports" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Ports" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("Sender", sender); invocation.WriteUint("Receiver", receiver); invocation.WriteUint("Results", results); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Ports" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoTime(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgTime1 self = (DvProviderAvOpenhomeOrgTime1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint trackCount; uint duration; uint seconds; try { invocation.ReadStart(); invocation.ReadEnd(); self.Time(invocation, out trackCount, out duration, out seconds); } catch (ActionError e) { invocation.ReportActionError(e, "Time"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Time")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Time", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("TrackCount", trackCount); invocation.WriteUint("Duration", duration); invocation.WriteUint("Seconds", seconds); 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, "Time", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoTime(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgTime1 self = (DvProviderAvOpenhomeOrgTime1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint trackCount; uint duration; uint seconds; try { invocation.ReadStart(); invocation.ReadEnd(); self.Time(invocation, out trackCount, out duration, out seconds); } catch (ActionError e) { invocation.ReportActionError(e, "Time"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Time" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Time" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("TrackCount", trackCount); invocation.WriteUint("Duration", duration); invocation.WriteUint("Seconds", seconds); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Time" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoPorts(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgNetworkMonitor1 self = (DvProviderAvOpenhomeOrgNetworkMonitor1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint sender; uint receiver; uint results; try { invocation.ReadStart(); invocation.ReadEnd(); self.Ports(invocation, out sender, out receiver, out results); } catch (ActionError e) { invocation.ReportActionError(e, "Ports"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Ports")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Ports", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("Sender", sender); invocation.WriteUint("Receiver", receiver); invocation.WriteUint("Results", results); 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, "Ports", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoGetDeviceAccountMax(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPins1 self = (DvProviderAvOpenhomeOrgPins1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint deviceMax; uint accountMax; try { invocation.ReadStart(); invocation.ReadEnd(); self.GetDeviceAccountMax(invocation, out deviceMax, out accountMax); } catch (ActionError e) { invocation.ReportActionError(e, "GetDeviceAccountMax"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetDeviceAccountMax" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetDeviceAccountMax" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("DeviceMax", deviceMax); invocation.WriteUint("AccountMax", accountMax); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetDeviceAccountMax" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSubscribe(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgSubscriptionLongPoll1 self = (DvProviderOpenhomeOrgSubscriptionLongPoll1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string clientId; string udn; string service; uint requestedDuration; string sid; uint duration; try { invocation.ReadStart(); clientId = invocation.ReadString("ClientId"); udn = invocation.ReadString("Udn"); service = invocation.ReadString("Service"); requestedDuration = invocation.ReadUint("RequestedDuration"); invocation.ReadEnd(); self.Subscribe(invocation, clientId, udn, service, requestedDuration, out sid, out duration); } catch (ActionError e) { invocation.ReportActionError(e, "Subscribe"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Subscribe")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Subscribe", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteString("Sid", sid); invocation.WriteUint("Duration", duration); 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, "Subscribe", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoRenew(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgSubscriptionLongPoll1 self = (DvProviderOpenhomeOrgSubscriptionLongPoll1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string sid; uint requestedDuration; uint duration; try { invocation.ReadStart(); sid = invocation.ReadString("Sid"); requestedDuration = invocation.ReadUint("RequestedDuration"); invocation.ReadEnd(); self.Renew(invocation, sid, requestedDuration, out duration); } catch (ActionError e) { invocation.ReportActionError(e, "Renew"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Renew" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Renew" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("Duration", duration); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Renew" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoRomDirInfo(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderLinnCoUkFlash1 self = (DvProviderLinnCoUkFlash1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint aFlashIdMain; uint aOffsetMain; uint aBytesMain; uint aFlashIdFallback; uint aOffsetFallback; uint aBytesFallback; try { invocation.ReadStart(); invocation.ReadEnd(); self.RomDirInfo(invocation, out aFlashIdMain, out aOffsetMain, out aBytesMain, out aFlashIdFallback, out aOffsetFallback, out aBytesFallback); } catch (ActionError e) { invocation.ReportActionError(e, "RomDirInfo"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "RomDirInfo" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "RomDirInfo" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("aFlashIdMain", aFlashIdMain); invocation.WriteUint("aOffsetMain", aOffsetMain); invocation.WriteUint("aBytesMain", aBytesMain); invocation.WriteUint("aFlashIdFallback", aFlashIdFallback); invocation.WriteUint("aOffsetFallback", aOffsetFallback); invocation.WriteUint("aBytesFallback", aBytesFallback); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "RomDirInfo" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSectorBytes(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderLinnCoUkFlash1 self = (DvProviderLinnCoUkFlash1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint aId; uint aBytes; try { invocation.ReadStart(); aId = invocation.ReadUint("aId"); invocation.ReadEnd(); self.SectorBytes(invocation, aId, out aBytes); } catch (ActionError e) { invocation.ReportActionError(e, "SectorBytes"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "SectorBytes" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SectorBytes" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("aBytes", aBytes); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SectorBytes" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoDelayMaximum(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderLinnCoUkLipSync1 self = (DvProviderLinnCoUkLipSync1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint max; try { invocation.ReadStart(); invocation.ReadEnd(); self.DelayMaximum(invocation, out max); } catch (ActionError e) { invocation.ReportActionError(e, "DelayMaximum"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "DelayMaximum" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "DelayMaximum" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteUint("Max", max); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "DelayMaximum" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoId(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgRadio1 self = (DvProviderAvOpenhomeOrgRadio1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint value; try { invocation.ReadStart(); invocation.ReadEnd(); self.Id(aVersion, out value); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Value", value); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoInsert(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPlaylist1 self = (DvProviderAvOpenhomeOrgPlaylist1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint afterId; string uri; string metadata; uint newId; try { invocation.ReadStart(); afterId = invocation.ReadUint("AfterId"); uri = invocation.ReadString("Uri"); metadata = invocation.ReadString("Metadata"); invocation.ReadEnd(); self.Insert(aVersion, afterId, uri, metadata, out newId); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("NewId", newId); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoEchoAllowedRangeUint(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestBasic1 self = (DvProviderOpenhomeOrgTestBasic1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint value; uint result; try { invocation.ReadStart(); value = invocation.ReadUint("Value"); invocation.ReadEnd(); self.EchoAllowedRangeUint(invocation, value, out result); } catch (ActionError e) { invocation.ReportActionError(e, "EchoAllowedRangeUint"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "EchoAllowedRangeUint")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "EchoAllowedRangeUint", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Result", result); 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, "EchoAllowedRangeUint", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetSortCapabilities(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgScheduledRecording2 self = (DvProviderUpnpOrgScheduledRecording2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string sortCaps; uint sortLevelCap; try { invocation.ReadStart(); invocation.ReadEnd(); self.GetSortCapabilities(aVersion, out sortCaps, out sortLevelCap); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("SortCaps", sortCaps); invocation.WriteUint("SortLevelCap", sortLevelCap); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoExportResource(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string sourceURI; string destinationURI; uint transferID; try { invocation.ReadStart(); sourceURI = invocation.ReadString("SourceURI"); destinationURI = invocation.ReadString("DestinationURI"); invocation.ReadEnd(); self.ExportResource(aVersion, sourceURI, destinationURI, out transferID); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("TransferID", transferID); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoIdArray(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgRadio1 self = (DvProviderAvOpenhomeOrgRadio1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint token; byte[] array; try { invocation.ReadStart(); invocation.ReadEnd(); self.IdArray(invocation, out token, out array); } catch (ActionError e) { invocation.ReportActionError(e, "IdArray"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "IdArray")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "IdArray", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Token", token); invocation.WriteBinary("Array", array); 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, "IdArray", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoBrowse(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string objectID; string browseFlag; string filter; uint startingIndex; uint requestedCount; string sortCriteria; string result; uint numberReturned; uint totalMatches; uint updateID; try { invocation.ReadStart(); objectID = invocation.ReadString("ObjectID"); browseFlag = invocation.ReadString("BrowseFlag"); filter = invocation.ReadString("Filter"); startingIndex = invocation.ReadUint("StartingIndex"); requestedCount = invocation.ReadUint("RequestedCount"); sortCriteria = invocation.ReadString("SortCriteria"); invocation.ReadEnd(); self.Browse(invocation, objectID, browseFlag, filter, startingIndex, requestedCount, sortCriteria, out result, out numberReturned, out totalMatches, out updateID); } catch (ActionError e) { invocation.ReportActionError(e, "Browse"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Browse")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Browse", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("Result", result); invocation.WriteUint("NumberReturned", numberReturned); invocation.WriteUint("TotalMatches", totalMatches); invocation.WriteUint("UpdateID", updateID); 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, "Browse", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoFreeFormQuery(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgContentDirectory3 self = (DvProviderUpnpOrgContentDirectory3)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string containerID; uint cDSView; string queryRequest; string queryResult; uint updateID; try { invocation.ReadStart(); containerID = invocation.ReadString("ContainerID"); cDSView = invocation.ReadUint("CDSView"); queryRequest = invocation.ReadString("QueryRequest"); invocation.ReadEnd(); self.FreeFormQuery(aVersion, containerID, cDSView, queryRequest, out queryResult, out updateID); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("QueryResult", queryResult); invocation.WriteUint("UpdateID", updateID); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoCreateRecordSchedule(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgScheduledRecording1 self = (DvProviderUpnpOrgScheduledRecording1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string elements; string recordScheduleID; string result; uint updateID; try { invocation.ReadStart(); elements = invocation.ReadString("Elements"); invocation.ReadEnd(); self.CreateRecordSchedule(aVersion, elements, out recordScheduleID, out result, out updateID); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("RecordScheduleID", recordScheduleID); invocation.WriteString("Result", result); invocation.WriteUint("UpdateID", updateID); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoBrowseRecordTasks(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgScheduledRecording1 self = (DvProviderUpnpOrgScheduledRecording1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string recordScheduleID; string filter; uint startingIndex; uint requestedCount; string sortCriteria; string result; uint numberReturned; uint totalMatches; uint updateID; try { invocation.ReadStart(); recordScheduleID = invocation.ReadString("RecordScheduleID"); filter = invocation.ReadString("Filter"); startingIndex = invocation.ReadUint("StartingIndex"); requestedCount = invocation.ReadUint("RequestedCount"); sortCriteria = invocation.ReadString("SortCriteria"); invocation.ReadEnd(); self.BrowseRecordTasks(aVersion, recordScheduleID, filter, startingIndex, requestedCount, sortCriteria, out result, out numberReturned, out totalMatches, out updateID); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("Result", result); invocation.WriteUint("NumberReturned", numberReturned); invocation.WriteUint("TotalMatches", totalMatches); invocation.WriteUint("UpdateID", updateID); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoGetColorComponents(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint color; uint brightness; uint red; uint green; uint blue; try { invocation.ReadStart(); color = invocation.ReadUint("Color"); invocation.ReadEnd(); self.GetColorComponents(invocation, color, out brightness, out red, out green, out blue); } catch (ActionError e) { invocation.ReportActionError(e, "GetColorComponents"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetColorComponents")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetColorComponents", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Brightness", brightness); invocation.WriteUint("Red", red); invocation.WriteUint("Green", green); invocation.WriteUint("Blue", blue); 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, "GetColorComponents", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoCreateRecordSchedule(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgScheduledRecording2 self = (DvProviderUpnpOrgScheduledRecording2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string elements; string recordScheduleID; string result; uint updateID; try { invocation.ReadStart(); elements = invocation.ReadString("Elements"); invocation.ReadEnd(); self.CreateRecordSchedule(invocation, elements, out recordScheduleID, out result, out updateID); } catch (ActionError e) { invocation.ReportActionError(e, "CreateRecordSchedule"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "CreateRecordSchedule")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "CreateRecordSchedule", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("RecordScheduleID", recordScheduleID); invocation.WriteString("Result", result); invocation.WriteUint("UpdateID", updateID); 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, "CreateRecordSchedule", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoCharacteristics(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgVolume1 self = (DvProviderAvOpenhomeOrgVolume1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint volumeMax; uint volumeUnity; uint volumeSteps; uint volumeMilliDbPerStep; uint balanceMax; uint fadeMax; try { invocation.ReadStart(); invocation.ReadEnd(); self.Characteristics(invocation, out volumeMax, out volumeUnity, out volumeSteps, out volumeMilliDbPerStep, out balanceMax, out fadeMax); } catch (ActionError e) { invocation.ReportActionError(e, "Characteristics"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Characteristics")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Characteristics", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("VolumeMax", volumeMax); invocation.WriteUint("VolumeUnity", volumeUnity); invocation.WriteUint("VolumeSteps", volumeSteps); invocation.WriteUint("VolumeMilliDbPerStep", volumeMilliDbPerStep); invocation.WriteUint("BalanceMax", balanceMax); invocation.WriteUint("FadeMax", fadeMax); 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, "Characteristics", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetSharpness(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgRenderingControl1 self = (DvProviderUpnpOrgRenderingControl1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; uint currentSharpness; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); invocation.ReadEnd(); self.GetSharpness(aVersion, instanceID, out currentSharpness); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("CurrentSharpness", currentSharpness); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoRenew(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgSubscriptionLongPoll1 self = (DvProviderOpenhomeOrgSubscriptionLongPoll1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string sid; uint requestedDuration; uint duration; try { invocation.ReadStart(); sid = invocation.ReadString("Sid"); requestedDuration = invocation.ReadUint("RequestedDuration"); invocation.ReadEnd(); self.Renew(invocation, sid, requestedDuration, out duration); } catch (ActionError e) { invocation.ReportActionError(e, "Renew"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Renew")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Renew", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Duration", duration); 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, "Renew", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoTracksMax(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPlaylistManager1 self = (DvProviderAvOpenhomeOrgPlaylistManager1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint value; try { invocation.ReadStart(); invocation.ReadEnd(); self.TracksMax(invocation, out value); } catch (ActionError e) { invocation.ReportActionError(e, "TracksMax"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "TracksMax")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "TracksMax", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Value", value); 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, "TracksMax", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetPositionInfo(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; uint track; string trackDuration; string trackMetaData; string trackURI; string relTime; string absTime; int relCount; int absCount; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); invocation.ReadEnd(); self.GetPositionInfo(invocation, instanceID, out track, out trackDuration, out trackMetaData, out trackURI, out relTime, out absTime, out relCount, out absCount); } catch (ActionError e) { invocation.ReportActionError(e, "GetPositionInfo"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetPositionInfo")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetPositionInfo", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Track", track); invocation.WriteString("TrackDuration", trackDuration); invocation.WriteString("TrackMetaData", trackMetaData); invocation.WriteString("TrackURI", trackURI); invocation.WriteString("RelTime", relTime); invocation.WriteString("AbsTime", absTime); invocation.WriteInt("RelCount", relCount); invocation.WriteInt("AbsCount", absCount); 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, "GetPositionInfo", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetPosition(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index; uint x; uint y; uint z; try { invocation.ReadStart(); index = invocation.ReadUint("Index"); invocation.ReadEnd(); self.GetPosition(invocation, index, out x, out y, out z); } catch (ActionError e) { invocation.ReportActionError(e, "GetPosition"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetPosition")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetPosition", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("X", x); invocation.WriteUint("Y", y); invocation.WriteUint("Z", z); 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, "GetPosition", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetOnEffectParameters(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgDimming1 self = (DvProviderUpnpOrgDimming1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string retOnEffect; uint retOnEffectLevel; try { invocation.ReadStart(); invocation.ReadEnd(); self.GetOnEffectParameters(aVersion, out retOnEffect, out retOnEffectLevel); } catch (ActionError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, "Invalid XML"); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("retOnEffect", retOnEffect); invocation.WriteUint("retOnEffectLevel", retOnEffectLevel); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); System.Diagnostics.Process.GetCurrentProcess().Kill(); } return 0; }
private static int DoSubscribe(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgSubscriptionLongPoll1 self = (DvProviderOpenhomeOrgSubscriptionLongPoll1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string clientId; string udn; string service; uint requestedDuration; string sid; uint duration; try { invocation.ReadStart(); clientId = invocation.ReadString("ClientId"); udn = invocation.ReadString("Udn"); service = invocation.ReadString("Service"); requestedDuration = invocation.ReadUint("RequestedDuration"); invocation.ReadEnd(); self.Subscribe(invocation, clientId, udn, service, requestedDuration, out sid, out duration); } catch (ActionError e) { invocation.ReportActionError(e, "Subscribe"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Subscribe" })); return -1; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Subscribe" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("Sid", sid); invocation.WriteUint("Duration", duration); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Subscribe" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoImportResource(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string sourceURI; string destinationURI; uint transferID; try { invocation.ReadStart(); sourceURI = invocation.ReadString("SourceURI"); destinationURI = invocation.ReadString("DestinationURI"); invocation.ReadEnd(); self.ImportResource(invocation, sourceURI, destinationURI, out transferID); } catch (ActionError e) { invocation.ReportActionError(e, "ImportResource"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "ImportResource")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "ImportResource", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("TransferID", transferID); 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, "ImportResource", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetMultiple(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestBasic1 self = (DvProviderOpenhomeOrgTestBasic1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint valueUint; int valueInt; bool valueBool; try { invocation.ReadStart(); invocation.ReadEnd(); self.GetMultiple(invocation, out valueUint, out valueInt, out valueBool); } catch (ActionError e) { invocation.ReportActionError(e, "GetMultiple"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetMultiple" })); return -1; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetMultiple" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("ValueUint", valueUint); invocation.WriteInt("ValueInt", valueInt); invocation.WriteBool("ValueBool", valueBool); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetMultiple" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetLoadLevelTarget(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgDimming1 self = (DvProviderUpnpOrgDimming1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint getLoadlevelTarget; try { invocation.ReadStart(); invocation.ReadEnd(); self.GetLoadLevelTarget(invocation, out getLoadlevelTarget); } catch (ActionError e) { invocation.ReportActionError(e, "GetLoadLevelTarget"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetLoadLevelTarget")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetLoadLevelTarget", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("GetLoadlevelTarget", getLoadlevelTarget); 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, "GetLoadLevelTarget", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoSourceXmlChangeCount(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgProduct1 self = (DvProviderAvOpenhomeOrgProduct1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint value; try { invocation.ReadStart(); invocation.ReadEnd(); self.SourceXmlChangeCount(invocation, out value); } catch (ActionError e) { invocation.ReportActionError(e, "SourceXmlChangeCount"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "SourceXmlChangeCount" })); return -1; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SourceXmlChangeCount" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Value", value); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SourceXmlChangeCount" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoPlaylistInsert(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPlaylistManager1 self = (DvProviderAvOpenhomeOrgPlaylistManager1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint afterId; string name; string description; uint imageId; uint newId; try { invocation.ReadStart(); afterId = invocation.ReadUint("AfterId"); name = invocation.ReadString("Name"); description = invocation.ReadString("Description"); imageId = invocation.ReadUint("ImageId"); invocation.ReadEnd(); self.PlaylistInsert(invocation, afterId, name, description, imageId, out newId); } catch (ActionError e) { invocation.ReportActionError(e, "PlaylistInsert"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "PlaylistInsert")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "PlaylistInsert", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("NewId", newId); 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, "PlaylistInsert", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoCounters(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgInfo1 self = (DvProviderAvOpenhomeOrgInfo1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint trackCount; uint detailsCount; uint metatextCount; try { invocation.ReadStart(); invocation.ReadEnd(); self.Counters(invocation, out trackCount, out detailsCount, out metatextCount); } catch (ActionError e) { invocation.ReportActionError(e, "Counters"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Counters")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Counters", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("TrackCount", trackCount); invocation.WriteUint("DetailsCount", detailsCount); invocation.WriteUint("MetatextCount", metatextCount); 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, "Counters", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetMediaInfo(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; uint nrTracks; string mediaDuration; string currentURI; string currentURIMetaData; string nextURI; string nextURIMetaData; string playMedium; string recordMedium; string writeStatus; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); invocation.ReadEnd(); self.GetMediaInfo(invocation, instanceID, out nrTracks, out mediaDuration, out currentURI, out currentURIMetaData, out nextURI, out nextURIMetaData, out playMedium, out recordMedium, out writeStatus); } catch (ActionError e) { invocation.ReportActionError(e, "GetMediaInfo"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetMediaInfo")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetMediaInfo", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("NrTracks", nrTracks); invocation.WriteString("MediaDuration", mediaDuration); invocation.WriteString("CurrentURI", currentURI); invocation.WriteString("CurrentURIMetaData", currentURIMetaData); invocation.WriteString("NextURI", nextURI); invocation.WriteString("NextURIMetaData", nextURIMetaData); invocation.WriteString("PlayMedium", playMedium); invocation.WriteString("RecordMedium", recordMedium); invocation.WriteString("WriteStatus", writeStatus); 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, "GetMediaInfo", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoDetails(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgInfo1 self = (DvProviderAvOpenhomeOrgInfo1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint duration; uint bitRate; uint bitDepth; uint sampleRate; bool lossless; string codecName; try { invocation.ReadStart(); invocation.ReadEnd(); self.Details(invocation, out duration, out bitRate, out bitDepth, out sampleRate, out lossless, out codecName); } catch (ActionError e) { invocation.ReportActionError(e, "Details"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Details")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Details", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Duration", duration); invocation.WriteUint("BitRate", bitRate); invocation.WriteUint("BitDepth", bitDepth); invocation.WriteUint("SampleRate", sampleRate); invocation.WriteBool("Lossless", lossless); invocation.WriteString("CodecName", codecName); 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, "Details", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetVolume(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgRenderingControl2 self = (DvProviderUpnpOrgRenderingControl2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string channel; uint currentVolume; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); channel = invocation.ReadString("Channel"); invocation.ReadEnd(); self.GetVolume(invocation, instanceID, channel, out currentVolume); } catch (ActionError e) { invocation.ReportActionError(e, "GetVolume"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetVolume")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetVolume", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("CurrentVolume", currentVolume); 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, "GetVolume", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoPorts(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgNetworkMonitor1 self = (DvProviderAvOpenhomeOrgNetworkMonitor1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint sender; uint receiver; uint results; try { invocation.ReadStart(); invocation.ReadEnd(); self.Ports(invocation, out sender, out receiver, out results); } catch (ActionError e) { invocation.ReportActionError(e, "Ports"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Ports")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Ports", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteUint("Sender", sender); invocation.WriteUint("Receiver", receiver); invocation.WriteUint("Results", results); 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, "Ports", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }