Ejemplo n.º 1
0
        //constructor
        public LegoSensor(Device dev)
        {
            if (Ev3Dev.DebuggText)
            {
                Console.WriteLine("Device Type Is:" + dev._type);
            }

            if (dev._type != DeviceType.lego_ev3_UltraSound && dev._type != DeviceType.lego_ev3_Gyro && dev._type != DeviceType.lego_ev3_Light && dev._type != DeviceType.lego_ev3_Touch)
            {
                throw new InvalidOperationException("this device is not a sensor");
            }

            RootToDir = dev.RootToDir;
            if (RootToDir.Contains("lego-sensor"))
            {
                MountPoint = ReadVar("address");
            }
            else if (RootToDir.Contains(":"))
            {
                MountPoint = RootToDir;
            }
            else
            {
                throw new InvalidOperationException("this uses the wrong class please re initulize the device and then try agen");
            }

            Options = new string[] {// r=readonly | rw=read+write | w=writeonly | b=byte output
                "address:r", "bin_data:r #b", "bin_data_format:r", "command:w",
                "comands:r", "direct:rw", "decimals:r", "driver_name:r",
                "fw_version", "mode:rw", "modes:r", "num_values:r",
                "poll_ms:rw", "units:r", "value<0-9>:r", "text_value"
            };
        }
Ejemplo n.º 2
0
        //constructor
        public LegoPort(Device dev)
        {
            if (dev._type != DeviceType.lego_port)
            {
                throw new InvalidOperationException("this device is not a tachno motor");
            }

            RootToDir = dev.RootToDir;

            if (RootToDir.Contains("lego-port"))
            {
                MountPoint = "??";//ReadVar("address");
            }
            else if (RootToDir.Contains(":"))
            {
                MountPoint = RootToDir;
            }
            else
            {
                throw new InvalidOperationException("this uses the wrong class please re initulize the device and then try agen");
            }

            Options = new string[] {// r=readonly | rw=read+write | w=writeonly
                "address:r", "driver_name:r", "modes:r", "set_device:w", "status:r"
            };
        }
Ejemplo n.º 3
0
        //constructorpublic
        public ServoMotor(Device dev) : base(dev)
        {
            if (dev._type != DeviceType.servo_motor)
            {
                throw new InvalidOperationException("this device is not a tachno motor");
            }

            RootToDir = dev.RootToDir;
            if (RootToDir.Contains("servo-motor"))
            {
                MountPoint = "??";//ReadVar("address");
            }
            else if (RootToDir.Contains(":"))
            {
                MountPoint = RootToDir;
            }
            else
            {
                throw new InvalidOperationException("this uses the wrong class please re initulize the device and then try agen");
            }
            _Options = new string[] {
                "MoveTo", "FLOAT", "Address", "LastCommand", "DriverName", "MaxPulse", "MidPulse", "MinPulse", "Polarity", "Rate", "RateSupported", "Position", "State"
            };
        }
Ejemplo n.º 4
0
        //constructor
        public TachoMotor(Device dev) : base(dev)
        {
            if (dev._type != DeviceType.tacho_motor)
            {
                throw new InvalidOperationException("this device is not a tachno motor");
            }

            RootToDir = dev.RootToDir;
            if (RootToDir.Contains("tacho-motor"))
            {
                MountPoint = ReadVar("address");
            }
            else if (RootToDir.Contains(":"))
            {
                MountPoint = RootToDir;
            }
            else
            {
                throw new InvalidOperationException("this uses the wrong class please re initulize the device and then try agen");
            }
            _Options = new string[] {// r=readonly | rw=read+write | w=writeonly
                "MoveTo", "MoveRelativeTo", "MoveFor", "RunOn", "RunAt", "Stop", "Reset", "Address", "MaxSpeed", "Speed", "Position", "Dutycycle", "RampUpSpeed", "RampDownSpeed", "Polarity", "RPM", "DriverName", "LastCommand", "State", "StopAction"
            };
        }