private static int DoRead(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderLinnCoUkFlash1 self = (DvProviderLinnCoUkFlash1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint aId; uint aAddress; uint aLength; byte[] aBuffer; try { invocation.ReadStart(); aId = invocation.ReadUint("aId"); aAddress = invocation.ReadUint("aAddress"); aLength = invocation.ReadUint("aLength"); invocation.ReadEnd(); self.Read(invocation, aId, aAddress, aLength, out aBuffer); } catch (ActionError e) { invocation.ReportActionError(e, "Read"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Read" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Read" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteBinary("aBuffer", aBuffer); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Read" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoEraseSectors(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderLinnCoUkFlash1 self = (DvProviderLinnCoUkFlash1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint aId; uint aFirstSector; uint aLastSector; try { invocation.ReadStart(); aId = invocation.ReadUint("aId"); aFirstSector = invocation.ReadUint("aFirstSector"); aLastSector = invocation.ReadUint("aLastSector"); invocation.ReadEnd(); self.EraseSectors(invocation, aId, aFirstSector, aLastSector); } catch (ActionError e) { invocation.ReportActionError(e, "EraseSectors"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "EraseSectors" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "EraseSectors" }); 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, "EraseSectors" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSwap(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPins1 self = (DvProviderAvOpenhomeOrgPins1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index1; uint index2; try { invocation.ReadStart(); index1 = invocation.ReadUint("Index1"); index2 = invocation.ReadUint("Index2"); invocation.ReadEnd(); self.Swap(invocation, index1, index2); } catch (ActionError e) { invocation.ReportActionError(e, "Swap"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Swap" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Swap" }); 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, "Swap" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSetColor(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index; uint color; try { invocation.ReadStart(); index = invocation.ReadUint("Index"); color = invocation.ReadUint("Color"); invocation.ReadEnd(); self.SetColor(invocation, index, color); } catch (ActionError e) { invocation.ReportActionError(e, "SetColor"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "SetColor")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetColor", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetColor", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSetAccount(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPins1 self = (DvProviderAvOpenhomeOrgPins1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index; string mode; string type; string uri; string title; string description; string artworkUri; bool shuffle; try { invocation.ReadStart(); index = invocation.ReadUint("Index"); mode = invocation.ReadString("Mode"); type = invocation.ReadString("Type"); uri = invocation.ReadString("Uri"); title = invocation.ReadString("Title"); description = invocation.ReadString("Description"); artworkUri = invocation.ReadString("ArtworkUri"); shuffle = invocation.ReadBool("Shuffle"); invocation.ReadEnd(); self.SetAccount(invocation, index, mode, type, uri, title, description, artworkUri, shuffle); } catch (ActionError e) { invocation.ReportActionError(e, "SetAccount"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "SetAccount" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SetAccount" }); 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, "SetAccount" }); 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 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}", new object[] { "GetColorComponents" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetColorComponents" }); System.Diagnostics.Debug.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) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetColorComponents" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSet(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgExakt2 self = (DvProviderAvOpenhomeOrgExakt2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string deviceId; uint bankId; string fileUri; bool mute; bool persist; try { invocation.ReadStart(); deviceId = invocation.ReadString("DeviceId"); bankId = invocation.ReadUint("BankId"); fileUri = invocation.ReadString("FileUri"); mute = invocation.ReadBool("Mute"); persist = invocation.ReadBool("Persist"); invocation.ReadEnd(); self.Set(invocation, deviceId, bankId, fileUri, mute, persist); } catch (ActionError e) { invocation.ReportActionError(e, "Set"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Set")); return(-1); } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Set", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Set", 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}", new object[] { "GetPosition" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetPosition" }); System.Diagnostics.Debug.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) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetPosition" }); System.Diagnostics.Debug.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 DoBoardType(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderLinnCoUkVolkano1 self = (DvProviderLinnCoUkVolkano1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint aIndex; string aBoardNumber; try { invocation.ReadStart(); aIndex = invocation.ReadUint("aIndex"); invocation.ReadEnd(); self.BoardType(invocation, aIndex, out aBoardNumber); } catch (ActionError e) { invocation.ReportActionError(e, "BoardType"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "BoardType" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "BoardType" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return(-1); } try { invocation.WriteStart(); invocation.WriteString("aBoardNumber", aBoardNumber); invocation.WriteEnd(); } catch (ActionError) { return(-1); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "BoardType" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSetAssociation(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderLinnCoUkExaktInputs1 self = (DvProviderLinnCoUkExaktInputs1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint inputIndex; string deviceId; try { invocation.ReadStart(); inputIndex = invocation.ReadUint("InputIndex"); deviceId = invocation.ReadString("DeviceId"); invocation.ReadEnd(); self.SetAssociation(invocation, inputIndex, deviceId); } catch (ActionError e) { invocation.ReportActionError(e, "SetAssociation"); return(-1); } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "SetAssociation" })); return(-1); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SetAssociation" }); 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, "SetAssociation" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return(0); }
private static int DoSetNextAVTransportURI(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgAVTransport2 self = (DvProviderUpnpOrgAVTransport2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string nextURI; string nextURIMetaData; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); nextURI = invocation.ReadString("NextURI"); nextURIMetaData = invocation.ReadString("NextURIMetaData"); invocation.ReadEnd(); self.SetNextAVTransportURI(invocation, instanceID, nextURI, nextURIMetaData); } catch (ActionError e) { invocation.ReportActionError(e, "SetNextAVTransportURI"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "SetNextAVTransportURI")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetNextAVTransportURI", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetNextAVTransportURI", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } 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 DoSetVolumeDB(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgRenderingControl1 self = (DvProviderUpnpOrgRenderingControl1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string channel; int desiredVolume; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); channel = invocation.ReadString("Channel"); desiredVolume = invocation.ReadInt("DesiredVolume"); invocation.ReadEnd(); self.SetVolumeDB(aVersion, instanceID, channel, desiredVolume); } 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.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 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 DoStartRampToLevel(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgDimming1 self = (DvProviderUpnpOrgDimming1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint newLoadLevelTarget; uint newRampTime; try { invocation.ReadStart(); newLoadLevelTarget = invocation.ReadUint("newLoadLevelTarget"); newRampTime = invocation.ReadUint("newRampTime"); invocation.ReadEnd(); self.StartRampToLevel(aVersion, newLoadLevelTarget, newRampTime); } 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.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 DoGetRoom(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index; string roomName; try { invocation.ReadStart(); index = invocation.ReadUint("Index"); invocation.ReadEnd(); self.GetRoom(invocation, index, out roomName); } catch (ActionError e) { invocation.ReportActionError(e, "GetRoom"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetRoom")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetRoom", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("RoomName", roomName); 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, "GetRoom", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoSetSourceIndex(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgProduct1 self = (DvProviderAvOpenhomeOrgProduct1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint value; try { invocation.ReadStart(); value = invocation.ReadUint("Value"); invocation.ReadEnd(); self.SetSourceIndex(invocation, value); } catch (ActionError e) { invocation.ReportActionError(e, "SetSourceIndex"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "SetSourceIndex" })); return -1; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SetSourceIndex" }); 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, "SetSourceIndex" }); System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoStartRampToLevel(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgDimming1 self = (DvProviderUpnpOrgDimming1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint newLoadLevelTarget; uint newRampTime; try { invocation.ReadStart(); newLoadLevelTarget = invocation.ReadUint("newLoadLevelTarget"); newRampTime = invocation.ReadUint("newRampTime"); invocation.ReadEnd(); self.StartRampToLevel(invocation, newLoadLevelTarget, newRampTime); } catch (ActionError e) { invocation.ReportActionError(e, "StartRampToLevel"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "StartRampToLevel")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "StartRampToLevel", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "StartRampToLevel", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoSet(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgExakt2 self = (DvProviderAvOpenhomeOrgExakt2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); string deviceId; uint bankId; string fileUri; bool mute; bool persist; try { invocation.ReadStart(); deviceId = invocation.ReadString("DeviceId"); bankId = invocation.ReadUint("BankId"); fileUri = invocation.ReadString("FileUri"); mute = invocation.ReadBool("Mute"); persist = invocation.ReadBool("Persist"); invocation.ReadEnd(); self.Set(invocation, deviceId, bankId, fileUri, mute, persist); } catch (ActionError e) { invocation.ReportActionError(e, "Set"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "Set")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Set", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Set", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoSource(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgProduct1 self = (DvProviderAvOpenhomeOrgProduct1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index; string systemName; string type; string name; bool visible; try { invocation.ReadStart(); index = invocation.ReadUint("Index"); invocation.ReadEnd(); self.Source(aVersion, index, out systemName, out type, out name, out visible); } 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("SystemName", systemName); invocation.WriteString("Type", type); invocation.WriteString("Name", name); invocation.WriteBool("Visible", visible); 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 DoStopTransferResource(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint transferID; try { invocation.ReadStart(); transferID = invocation.ReadUint("TransferID"); invocation.ReadEnd(); self.StopTransferResource(aVersion, 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.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 DoIdArrayChanged(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgRadio1 self = (DvProviderAvOpenhomeOrgRadio1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint token; bool value; try { invocation.ReadStart(); token = invocation.ReadUint("Token"); invocation.ReadEnd(); self.IdArrayChanged(invocation, token, out value); } catch (ActionError e) { invocation.ReportActionError(e, "IdArrayChanged"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "IdArrayChanged")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "IdArrayChanged", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteBool("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, "IdArrayChanged", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoSource(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgProduct1 self = (DvProviderAvOpenhomeOrgProduct1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint index; string systemName; string type; string name; bool visible; try { invocation.ReadStart(); index = invocation.ReadUint("Index"); invocation.ReadEnd(); self.Source(invocation, index, out systemName, out type, out name, out visible); } catch (ActionError e) { invocation.ReportActionError(e, "Source"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Source" })); return -1; } catch (Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Source" }); System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("SystemName", systemName); invocation.WriteString("Type", type); invocation.WriteString("Name", name); invocation.WriteBool("Visible", visible); invocation.WriteEnd(); } catch (ActionError) { return -1; } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Source" }); System.Diagnostics.Debug.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 DoDeleteAll(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPlaylistManager1 self = (DvProviderAvOpenhomeOrgPlaylistManager1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint id; try { invocation.ReadStart(); id = invocation.ReadUint("Id"); invocation.ReadEnd(); self.DeleteAll(invocation, id); } catch (ActionError e) { invocation.ReportActionError(e, "DeleteAll"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "DeleteAll")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "DeleteAll", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "DeleteAll", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoGetTransportInfo(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string currentTransportState; string currentTransportStatus; string currentSpeed; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); invocation.ReadEnd(); self.GetTransportInfo(aVersion, instanceID, out currentTransportState, out currentTransportStatus, out currentSpeed); } 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("CurrentTransportState", currentTransportState); invocation.WriteString("CurrentTransportStatus", currentTransportStatus); invocation.WriteString("CurrentSpeed", currentSpeed); 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 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 DoStopTransferResource(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint transferID; try { invocation.ReadStart(); transferID = invocation.ReadUint("TransferID"); invocation.ReadEnd(); self.StopTransferResource(invocation, transferID); } catch (ActionError e) { invocation.ReportActionError(e, "StopTransferResource"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "StopTransferResource")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "StopTransferResource", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "StopTransferResource", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoSetStateVariables(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgRenderingControl2 self = (DvProviderUpnpOrgRenderingControl2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string renderingControlUDN; string serviceType; string serviceId; string stateVariableValuePairs; string stateVariableList; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); renderingControlUDN = invocation.ReadString("RenderingControlUDN"); serviceType = invocation.ReadString("ServiceType"); serviceId = invocation.ReadString("ServiceId"); stateVariableValuePairs = invocation.ReadString("StateVariableValuePairs"); invocation.ReadEnd(); self.SetStateVariables(invocation, instanceID, renderingControlUDN, serviceType, serviceId, stateVariableValuePairs, out stateVariableList); } catch (ActionError e) { invocation.ReportActionError(e, "SetStateVariables"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "SetStateVariables")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetStateVariables", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("StateVariableList", stateVariableList); 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, "SetStateVariables", 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 DoSetStateVariables(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgAVTransport2 self = (DvProviderUpnpOrgAVTransport2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string aVTransportUDN; string serviceType; string serviceId; string stateVariableValuePairs; string stateVariableList; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); aVTransportUDN = invocation.ReadString("AVTransportUDN"); serviceType = invocation.ReadString("ServiceType"); serviceId = invocation.ReadString("ServiceId"); stateVariableValuePairs = invocation.ReadString("StateVariableValuePairs"); invocation.ReadEnd(); self.SetStateVariables(aVersion, instanceID, aVTransportUDN, serviceType, serviceId, stateVariableValuePairs, out stateVariableList); } 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("StateVariableList", stateVariableList); 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 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 DoGetDeviceCapabilities(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgAVTransport2 self = (DvProviderUpnpOrgAVTransport2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string playMedia; string recMedia; string recQualityModes; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); invocation.ReadEnd(); self.GetDeviceCapabilities(aVersion, instanceID, out playMedia, out recMedia, out recQualityModes); } 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("PlayMedia", playMedia); invocation.WriteString("RecMedia", recMedia); invocation.WriteString("RecQualityModes", recQualityModes); 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 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 DoIdArrayChanged(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgPlaylist1 self = (DvProviderAvOpenhomeOrgPlaylist1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint token; bool value; try { invocation.ReadStart(); token = invocation.ReadUint("Token"); invocation.ReadEnd(); self.IdArrayChanged(aVersion, token, 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.WriteBool("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 DoGetTransportSettings(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string playMode; string recQualityMode; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); invocation.ReadEnd(); self.GetTransportSettings(invocation, instanceID, out playMode, out recQualityMode); } catch (ActionError e) { invocation.ReportActionError(e, "GetTransportSettings"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetTransportSettings")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetTransportSettings", e.TargetSite.Name); Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions"); return -1; } try { invocation.WriteStart(); invocation.WriteString("PlayMode", playMode); invocation.WriteString("RecQualityMode", recQualityMode); 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, "GetTransportSettings", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } 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 DoSetVolumeDB(IntPtr aPtr, IntPtr aInvocation) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderUpnpOrgRenderingControl2 self = (DvProviderUpnpOrgRenderingControl2)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint instanceID; string channel; int desiredVolume; try { invocation.ReadStart(); instanceID = invocation.ReadUint("InstanceID"); channel = invocation.ReadString("Channel"); desiredVolume = invocation.ReadInt("DesiredVolume"); invocation.ReadEnd(); self.SetVolumeDB(invocation, instanceID, channel, desiredVolume); } catch (ActionError e) { invocation.ReportActionError(e, "SetVolumeDB"); return -1; } catch (PropertyUpdateError) { invocation.ReportError(501, String.Format("Invalid value for property {0}", "SetVolumeDB")); return -1; } catch (Exception e) { Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetVolumeDB", e.TargetSite.Name); Console.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) { Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetVolumeDB", e.TargetSite.Name); Console.WriteLine(" Only ActionError can be thrown by action response writer"); } return 0; }
private static int DoSetId(IntPtr aPtr, IntPtr aInvocation, uint aVersion) { GCHandle gch = GCHandle.FromIntPtr(aPtr); DvProviderAvOpenhomeOrgRadio1 self = (DvProviderAvOpenhomeOrgRadio1)gch.Target; DvInvocation invocation = new DvInvocation(aInvocation); uint value; string uri; try { invocation.ReadStart(); value = invocation.ReadUint("Value"); uri = invocation.ReadString("Uri"); invocation.ReadEnd(); self.SetId(aVersion, value, uri); } 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.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; }