Example #1
0
        public IDevice SetMotionControl_houtui()
        {
            byte[] result;
            MotionControlCommand cmd = new MotionControlCommand(0x04, eMoveDirection.BackOff, eSpeed.Speed1, eLogicalDirection.LogicalGo, 2);

            _port.Write(_serialize.Serialize <MotionControlCommand>(cmd))
            .Read(out result);
            return(this);
        }
Example #2
0
        public IDevice SettrafficControlOutPut()
        {
            byte[] result;
            MotionControlCommand cmd = new MotionControlCommand(0x03, eMoveDirection.FrontPatrol, eSpeed.Speed2, eLogicalDirection.LogicalGo, 2);

            _port.Write(_serialize.Serialize <MotionControlCommand>(cmd))
            .Read(out result);
            return(this);
        }
Example #3
0
        /// <summary>
        /// 前进
        /// </summary>
        /// <returns></returns>
        public IDevice SetMotionControl_qianjing()
        {
            byte[] result;
            MotionControlCommand cmd = new MotionControlCommand(0x03, eMoveDirection.Advancing, eSpeed.Speed1, eLogicalDirection.LogicalGo, 2);

            _port.Write(_serialize.Serialize <MotionControlCommand>(cmd))
            .Read(out result);
            return(this);
        }
Example #4
0
        /// <summary>
        /// 运动控制      ok
        /// </summary>
        /// <returns></returns>
        public IDevice SetMotionControl()
        {
            byte[] result;
            MotionControlCommand cmd = new MotionControlCommand(0x02, eMoveDirection.TurnRight, eSpeed.Speed2, eLogicalDirection.LogicalGo, 2);

            _port.Write(_serialize.Serialize <MotionControlCommand>(cmd))
            .Read(out result);
            if (null != result)
            {
                if (result.Length > 2)
                {
                    if (0xFF == result[1])
                    {
                        var res = _serialize.Deserialize <ErrorReportingResult>(result);
                    }
                    else
                    {
                        var res = _serialize.Deserialize <MotionControlResult>(result);
                    }
                }
            }
            return(this);
        }
Example #5
0
        /// <summary>
        /// 实时交通控制 (节点动作设置,断电不保存)
        /// </summary>
        /// <returns></returns>
        public IDevice SettrafficControl()
        {
            byte[] result;
            MotionControlCommand cmd = new MotionControlCommand(0x02, eMoveDirection.FrontPatrol, eSpeed.Speed2, eLogicalDirection.LogicalGo, 2);

            _port.Write(_serialize.Serialize <MotionControlCommand>(cmd))
            .Read(out result);

            trafficControlCommand cmd1 = new trafficControlCommand(0x02, eNodeNumber.Undefined, eAction.Alarm, 0x00, 0x00);

            byte[] fgfg = _serialize.Serialize <trafficControlCommand>(cmd1);
            _port.Write(_serialize.Serialize <trafficControlCommand>(cmd1))
            .Read(out result);

            trafficControlCommand cmd2 = new trafficControlCommand(0x02, eNodeNumber.Node_3, eAction.Estop, 0x00, 0x00, eAction.BackOff, 0x01, 0);

            _port.Write(_serialize.Serialize <trafficControlCommand>(cmd2))
            .Read(out result);

            //trafficControlCommand cmd3 = new trafficControlCommand(0x02, eNodeNumber.Node_2, eAction.AppointStall, 2, 0);
            //_port.Write(_serialize.Serialize<trafficControlCommand>(cmd3))
            //    .Read(out result);
            return(this);
        }