Example #1
0
        private static int DoSet(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgExakt1 self = (DvProviderAvOpenhomeOrgExakt1)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}", new object[] { "Set" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Set" });
                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, "Set" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
Example #2
0
        private static int DoDeviceSettings(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgExakt1 self = (DvProviderAvOpenhomeOrgExakt1)gch.Target;
            DvInvocation invocation            = new DvInvocation(aInvocation);
            string       deviceId;
            string       settings;

            try
            {
                invocation.ReadStart();
                deviceId = invocation.ReadString("DeviceId");
                invocation.ReadEnd();
                self.DeviceSettings(invocation, deviceId, out settings);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "DeviceSettings");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "DeviceSettings" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "DeviceSettings" });
                System.Diagnostics.Debug.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteString("Settings", settings);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "DeviceSettings" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
Example #3
0
        private static int DoReprogramFallback(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderAvOpenhomeOrgExakt1 self = (DvProviderAvOpenhomeOrgExakt1)gch.Target;
            DvInvocation invocation            = new DvInvocation(aInvocation);
            string       deviceId;
            string       fileUri;

            try
            {
                invocation.ReadStart();
                deviceId = invocation.ReadString("DeviceId");
                fileUri  = invocation.ReadString("FileUri");
                invocation.ReadEnd();
                self.ReprogramFallback(invocation, deviceId, fileUri);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "ReprogramFallback");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", "ReprogramFallback"));
                return(-1);
            }
            catch (Exception e)
            {
                Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "ReprogramFallback", 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, "ReprogramFallback", e.TargetSite.Name);
                Console.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }