Esempio n. 1
0
        /// <summary>
        /// slot is param.RobotCarryA or param.RobotCarryB
        /// </summary>
        /// <param name="slot"></param>
        /// <param name="jobname">"A" or "B"</param>
        private static void startJobTask(LCodeSignal slot, string jobname)
        {
            isrun = true;
            while (isrun)
            {
                // 两个任务共用一个client,故要加锁。
                lock (client) {
                    if (client.TryReadBool(slot.Signal))
                    {
                        // 加入机器人布卷队列。
                        var code1    = client.TryReadString(slot.LCode1);
                        var code2    = client.TryReadString(slot.LCode2);
                        var fullcode = LableCode.MakeCode(code1, code2);

                        pushInQueue(fullcode, jobname);

                        client.TryWrite(slot.Signal, false);
                    }
                }
                Thread.Sleep(5000);
            }
        }