private static int DoRomDirInfo(IntPtr aPtr, IntPtr aInvocation)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            DvProviderLinnCoUkFlash1 self       = (DvProviderLinnCoUkFlash1)gch.Target;
            DvInvocation             invocation = new DvInvocation(aInvocation);
            uint aFlashIdMain;
            uint aOffsetMain;
            uint aBytesMain;
            uint aFlashIdFallback;
            uint aOffsetFallback;
            uint aBytesFallback;

            try
            {
                invocation.ReadStart();
                invocation.ReadEnd();
                self.RomDirInfo(invocation, out aFlashIdMain, out aOffsetMain, out aBytesMain, out aFlashIdFallback, out aOffsetFallback, out aBytesFallback);
            }
            catch (ActionError e)
            {
                invocation.ReportActionError(e, "RomDirInfo");
                return(-1);
            }
            catch (PropertyUpdateError)
            {
                invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "RomDirInfo" }));
                return(-1);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "RomDirInfo" });
                System.Diagnostics.Debug.WriteLine("         Only ActionError or PropertyUpdateError should be thrown by actions");
                return(-1);
            }
            try
            {
                invocation.WriteStart();
                invocation.WriteUint("aFlashIdMain", aFlashIdMain);
                invocation.WriteUint("aOffsetMain", aOffsetMain);
                invocation.WriteUint("aBytesMain", aBytesMain);
                invocation.WriteUint("aFlashIdFallback", aFlashIdFallback);
                invocation.WriteUint("aOffsetFallback", aOffsetFallback);
                invocation.WriteUint("aBytesFallback", aBytesFallback);
                invocation.WriteEnd();
            }
            catch (ActionError)
            {
                return(-1);
            }
            catch (System.Exception e)
            {
                System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "RomDirInfo" });
                System.Diagnostics.Debug.WriteLine("       Only ActionError can be thrown by action response writer");
            }
            return(0);
        }
        private static int 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);
        }