コード例 #1
0
        private static int DoGet(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgCredentials1 self = (DvProviderAvOpenhomeOrgCredentials1)gch.Target;
            DvInvocation invocation = new DvInvocation(aInvocation);
            string       id;
            string       userName;

            byte[] password;
            bool   enabled;
            string status;
            string data;

            try
            {
                invocation.ReadStart();
                id = invocation.ReadString("Id");
                invocation.ReadEnd();
                self.Get(invocation, id, out userName, out password, out enabled, out status, out data);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "Get");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Get" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Get" });
                System.Diagnostics.Debug.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteString("UserName", userName);
                invocation.WriteBinary("Password", password);
                invocation.WriteBool("Enabled", enabled);
                invocation.WriteString("Status", status);
                invocation.WriteString("Data", data);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Get" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
コード例 #2
0
ファイル: DvAvOpenhomeOrgInfo1.cs プロジェクト: fuzzy01/ohNet
        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);
        }
コード例 #3
0
        private static int DoSoftwareUpdate(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderLinnCoUkVolkano1 self = (DvProviderLinnCoUkVolkano1)gch.Target;
            DvInvocation invocation         = new DvInvocation(aInvocation);
            bool         aAvailable;
            string       aSoftwareVersion;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.SoftwareUpdate(invocation, out aAvailable, out aSoftwareVersion);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "SoftwareUpdate");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "SoftwareUpdate" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SoftwareUpdate" });
                System.Diagnostics.Debug.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteBool("aAvailable", aAvailable);
                invocation.WriteString("aSoftwareVersion", aSoftwareVersion);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SoftwareUpdate" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
コード例 #4
0
        private static int DoAudio(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgSender1 self = (DvProviderAvOpenhomeOrgSender1)gch.Target;
            DvInvocation invocation             = new DvInvocation(aInvocation);
            bool         value;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.Audio(invocation, out value);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "Audio");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Audio" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Audio" });
                System.Diagnostics.Debug.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)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Audio" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
コード例 #5
0
        private static int DoGetStatus(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderUpnpOrgSwitchPower1 self = (DvProviderUpnpOrgSwitchPower1)gch.Target;
            DvInvocation invocation            = new DvInvocation(aInvocation);
            bool         resultStatus;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.GetStatus(invocation, out resultStatus);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "GetStatus");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetStatus"));
                return(-1);
            }
            catch (Exception e)
            {
                Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetStatus", e.TargetSite.Name);
                Console.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteBool("ResultStatus", resultStatus);
                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, "GetStatus", e.TargetSite.Name);
                Console.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
コード例 #6
0
        private static int DoGetControlEnabled(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderLinnCoUkCloud1 self       = (DvProviderLinnCoUkCloud1)gch.Target;
            DvInvocation             invocation = new DvInvocation(aInvocation);
            bool enabled;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.GetControlEnabled(invocation, out enabled);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "GetControlEnabled");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetControlEnabled" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetControlEnabled" });
                System.Diagnostics.Debug.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteBool("Enabled", enabled);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetControlEnabled" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
コード例 #7
0
 private static int DoPlaylistArraysChanged(IntPtr aPtr, IntPtr aInvocation)
 {
     GCHandle gch = GCHandle.FromIntPtr(aPtr);
     DvProviderAvOpenhomeOrgPlaylistManager1 self = (DvProviderAvOpenhomeOrgPlaylistManager1)gch.Target;
     DvInvocation invocation = new DvInvocation(aInvocation);
     uint token;
     bool value;
     try
     {
         invocation.ReadStart();
         token = invocation.ReadUint("Token");
         invocation.ReadEnd();
         self.PlaylistArraysChanged(invocation, token, out value);
     }
     catch (ActionError e)
     {
         invocation.ReportActionError(e, "PlaylistArraysChanged");
         return -1;
     }
     catch (PropertyUpdateError)
     {
         invocation.ReportError(501, String.Format("Invalid value for property {0}", "PlaylistArraysChanged"));
         return -1;
     }
     catch (Exception e)
     {
         Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "PlaylistArraysChanged", 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, "PlaylistArraysChanged", e.TargetSite.Name);
         Console.WriteLine("       Only ActionError can be thrown by action response writer");
     }
     return 0;
 }
コード例 #8
0
 private static int DoGetLoudness(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;
     bool currentLoudness;
     try
     {
         invocation.ReadStart();
         instanceID = invocation.ReadUint("InstanceID");
         channel = invocation.ReadString("Channel");
         invocation.ReadEnd();
         self.GetLoudness(aVersion, instanceID, channel, out currentLoudness);
     }
     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("CurrentLoudness", currentLoudness);
         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;
 }
コード例 #9
0
ファイル: DvUpnpOrgDimming1.cs プロジェクト: wifigeek/ohNet
 private static int DoGetIsRamping(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
 {
     GCHandle gch = GCHandle.FromIntPtr(aPtr);
     DvProviderUpnpOrgDimming1 self = (DvProviderUpnpOrgDimming1)gch.Target;
     DvInvocation invocation = new DvInvocation(aInvocation);
     bool retIsRamping;
     try
     {
         invocation.ReadStart();
         invocation.ReadEnd();
         self.GetIsRamping(aVersion, out retIsRamping);
     }
     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("retIsRamping", retIsRamping);
         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;
 }
コード例 #10
0
 private static int DoAudio(IntPtr aPtr, IntPtr aInvocation)
 {
     GCHandle gch = GCHandle.FromIntPtr(aPtr);
     DvProviderAvOpenhomeOrgSender1 self = (DvProviderAvOpenhomeOrgSender1)gch.Target;
     DvInvocation invocation = new DvInvocation(aInvocation);
     bool value;
     try
     {
         invocation.ReadStart();
         invocation.ReadEnd();
         self.Audio(invocation, out value);
     }
     catch (ActionError e)
     {
         invocation.ReportActionError(e, "Audio");
         return -1;
     }
     catch (PropertyUpdateError)
     {
         invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Audio" }));
         return -1;
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Audio" });
         System.Diagnostics.Debug.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)
     {
         System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Audio" });
         System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
     }
     return 0;
 }
コード例 #11
0
ファイル: DvAvOpenhomeOrgInfo1.cs プロジェクト: Wodath/ohNet
 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;
 }
コード例 #12
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;
 }
コード例 #13
0
ファイル: DvUpnpOrgDimming1.cs プロジェクト: nterry/ohNet
 private static int DoGetIsRamping(IntPtr aPtr, IntPtr aInvocation)
 {
     GCHandle gch = GCHandle.FromIntPtr(aPtr);
     DvProviderUpnpOrgDimming1 self = (DvProviderUpnpOrgDimming1)gch.Target;
     DvInvocation invocation = new DvInvocation(aInvocation);
     bool retIsRamping;
     try
     {
         invocation.ReadStart();
         invocation.ReadEnd();
         self.GetIsRamping(invocation, out retIsRamping);
     }
     catch (ActionError e)
     {
         invocation.ReportActionError(e, "GetIsRamping");
         return -1;
     }
     catch (PropertyUpdateError)
     {
         invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetIsRamping"));
         return -1;
     }
     catch (Exception e)
     {
         Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetIsRamping", e.TargetSite.Name);
         Console.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
         return -1;
     }
     try
     {
         invocation.WriteStart();
         invocation.WriteBool("retIsRamping", retIsRamping);
         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, "GetIsRamping", e.TargetSite.Name);
         Console.WriteLine("       Only ActionError can be thrown by action response writer");
     }
     return 0;
 }
コード例 #14
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;
 }
コード例 #15
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}", "GetMultiple"));
         return -1;
     }
     catch (Exception e)
     {
         Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetMultiple", e.TargetSite.Name);
         Console.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)
     {
         Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetMultiple", e.TargetSite.Name);
         Console.WriteLine("       Only ActionError can be thrown by action response writer");
     }
     return 0;
 }
コード例 #16
0
 private static int DoIdArrayChanged(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
 {
     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(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;
 }
コード例 #17
0
 private static int DoGetMute(IntPtr aPtr, IntPtr aInvocation)
 {
     GCHandle gch = GCHandle.FromIntPtr(aPtr);
     DvProviderUpnpOrgRenderingControl2 self = (DvProviderUpnpOrgRenderingControl2)gch.Target;
     DvInvocation invocation = new DvInvocation(aInvocation);
     uint instanceID;
     string channel;
     bool currentMute;
     try
     {
         invocation.ReadStart();
         instanceID = invocation.ReadUint("InstanceID");
         channel = invocation.ReadString("Channel");
         invocation.ReadEnd();
         self.GetMute(invocation, instanceID, channel, out currentMute);
     }
     catch (ActionError e)
     {
         invocation.ReportActionError(e, "GetMute");
         return -1;
     }
     catch (PropertyUpdateError)
     {
         invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetMute"));
         return -1;
     }
     catch (Exception e)
     {
         Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetMute", e.TargetSite.Name);
         Console.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
         return -1;
     }
     try
     {
         invocation.WriteStart();
         invocation.WriteBool("CurrentMute", currentMute);
         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, "GetMute", e.TargetSite.Name);
         Console.WriteLine("       Only ActionError can be thrown by action response writer");
     }
     return 0;
 }
コード例 #18
0
 private static int DoGet(IntPtr aPtr, IntPtr aInvocation)
 {
     GCHandle gch = GCHandle.FromIntPtr(aPtr);
     DvProviderAvOpenhomeOrgCredentials1 self = (DvProviderAvOpenhomeOrgCredentials1)gch.Target;
     DvInvocation invocation = new DvInvocation(aInvocation);
     string id;
     string userName;
     byte[] password;
     bool enabled;
     string status;
     string data;
     try
     {
         invocation.ReadStart();
         id = invocation.ReadString("Id");
         invocation.ReadEnd();
         self.Get(invocation, id, out userName, out password, out enabled, out status, out data);
     }
     catch (ActionError e)
     {
         invocation.ReportActionError(e, "Get");
         return -1;
     }
     catch (PropertyUpdateError)
     {
         invocation.ReportError(501, String.Format("Invalid value for property {0}", "Get"));
         return -1;
     }
     catch (Exception e)
     {
         Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Get", e.TargetSite.Name);
         Console.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
         return -1;
     }
     try
     {
         invocation.WriteStart();
         invocation.WriteString("UserName", userName);
         invocation.WriteBinary("Password", password);
         invocation.WriteBool("Enabled", enabled);
         invocation.WriteString("Status", status);
         invocation.WriteString("Data", data);
         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, "Get", e.TargetSite.Name);
         Console.WriteLine("       Only ActionError can be thrown by action response writer");
     }
     return 0;
 }