Ejemplo n.º 1
0
Archivo: Api.cs Proyecto: fw2568/YaNco
        public static void AllowStartOfPrograms(ConnectionHandle connectionHandle, StartProgramDelegate callback, out
                                                RfcErrorInfo errorInfo)
        {
            var descriptionHandle = new FunctionDescriptionHandle(Interopt.RfcCreateFunctionDesc("RFC_START_PROGRAM", out errorInfo));

            if (descriptionHandle.Ptr == IntPtr.Zero)
            {
                return;
            }

            var paramDesc = new Interopt.RFC_PARAMETER_DESC {
                Name = "COMMAND", Type = RfcType.CHAR, Direction = RfcDirection.Import, NucLength = 512, UcLength = 1024
            };
            var rc = Interopt.RfcAddParameter(descriptionHandle.Ptr, ref paramDesc, out errorInfo);

            if (rc != RfcRc.RFC_OK)
            {
                return;
            }

            rc = Interopt.RfcInstallServerFunction(null, descriptionHandle.Ptr, StartProgramHandler, out errorInfo);
            if (rc != RfcRc.RFC_OK)
            {
                return;
            }

            RegisteredCallbacks.AddOrUpdate(connectionHandle.Ptr, callback, (c, v) => v);
        }