コード例 #1
0
        private static InputAssembly ReadResponse()
        {
            var response = new InputAssembly(client.AssemblyObject.getInstance(100));

            if (debug)
            {
                LogResponse(response);
            }

            return(response);
        }
コード例 #2
0
        private static void CheckResponse(InputAssembly res)
        {
            if (res.ErrorStatus && res.ErrorCode > 0)
            {
                CheckResponseErrors(res.ErrorCode);
            }

            if (res.WarningStatus && res.WarningCode > 0)
            {
                CheckResponseWarnings(res.WarningCode);
            }
        }
コード例 #3
0
        private static void Trigger()
        {
            var oldResultUpdateComplete = ReadResponse().ResultUpdateComplete;

            Console.Error.WriteLine("Result update complete before trigger is {0}.", oldResultUpdateComplete ? 1 : 0);

            Console.Error.WriteLine("Triggering...");

            WriteRequest(new OutputAssembly()
            {
                TriggerRequest = true
            });

            var startedAt = DateTime.Now;

            while (!IsCancelled() && DateTime.Now.Subtract(startedAt).TotalMilliseconds <= TRIGGER_TIME)
            {
                var res = ReadResponse();

                CheckResponse(res);

                if (!res.TriggerResponse || !res.ResultAvailable || res.ResultUpdateComplete == oldResultUpdateComplete)
                {
                    result = null;

                    Console.Error.WriteLine("...result not available...");

                    Thread.Sleep(TRIGGER_SLEEP);

                    continue;
                }

                result = res;

                Console.Error.WriteLine("...result available!");

                return;
            }

            throw new Exception("ERR_RESULT_NOT_AVAILABLE");
        }
コード例 #4
0
        private static void LogResponse(InputAssembly response)
        {
            Console.Write("Response =");
            if (response.TriggerResponse)
            {
                Console.Write(" Trigger");
            }
            if (response.MasterImageRegistrationResponse)
            {
                Console.Write(" MasterImageRegistration");
            }
            if (response.ProgramSwitchingResponse)
            {
                Console.Write(" ProgramSwitching");
            }
            if (response.WarningClearResponse)
            {
                Console.Write(" WarningClear");
            }
            if (response.StatisticsResetResponse)
            {
                Console.Write(" StatisticsReset");
            }
            if (response.BufferClearResponse)
            {
                Console.Write(" BufferClear");
            }
            if (response.SettingValueChangeResponse)
            {
                Console.Write(" SettingValueChange");
            }
            Console.WriteLine();

            Console.Write("Failed =");
            if (response.TriggerFailed)
            {
                Console.Write(" Trigger");
            }
            if (response.MasterImageRegistrationFailed)
            {
                Console.Write(" MasterImageRegistration");
            }
            if (response.ProgramSwitchingFailed)
            {
                Console.Write(" ProgramSwitching");
            }
            if (response.SettingValueChangeFailed)
            {
                Console.Write(" SettingValueChange");
            }
            Console.WriteLine();

            Console.Write("Status =");
            if (response.ResultAvailable)
            {
                Console.Write(" ResultAvailable");
            }
            if (response.ResultUpdateComplete)
            {
                Console.Write(" ResultUpdateComplete");
            }
            if (response.Busy)
            {
                Console.Write(" Busy");
            }
            if (response.Imaging)
            {
                Console.Write(" Imaging");
            }
            if (response.Run)
            {
                Console.Write(" Run");
            }
            if (response.Ready)
            {
                Console.Write(" Ready");
            }
            if (response.BufferOverrunStatus)
            {
                Console.Write(" BufferOverrun");
            }
            if (response.WarningStatus)
            {
                Console.Write(" Warning");
            }
            if (response.ErrorStatus)
            {
                Console.Write(" Error");
            }
            Console.WriteLine();

            /*
             * Console.WriteLine("Information");
             * if (response.ErrorCode > 0) Console.WriteLine($"\tErrorCode = {response.ErrorCode}");
             * if (response.WarningCode > 0) Console.WriteLine($"\tWarningCode = {response.WarningCode}");
             * Console.WriteLine($"\tCurrentProgramNo = {response.CurrentProgramNo}");
             * Console.WriteLine($"\tProgramNoDuringJudgement = {response.ProgramNoDuringJudgement}");
             * Console.Write($"\tResultNo={response.ResultNo}");
             * Console.Write($"\tProcessingTime={response.ProcessingTime}");
             * Console.WriteLine();
             *
             * Console.Write($"OverallJudgement = {response.OverallJudgement}");
             * Console.WriteLine();
             * Console.WriteLine();
             */
        }