Ejemplo n.º 1
0
        public Brick(Protocol protocol, Protocol.BrickInfo brickinfo)
        {
            link = protocol;
            this.brickinfo = brickinfo;

            if (link == null) { throw new NXTLinkNotSupported(); }
            if (!link.IsSupported) { throw new NXTLinkNotSupported(); }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// <para>Constructor for all NXT Passive sensors.</para>
 /// </summary>
 /// <param name="type">Sensor type.</param>
 /// <param name="mode">Sensor mode.</param>
 public PassiveSensor(Protocol.SensorType type, Protocol.SensorMode mode)
     : base(type, mode)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// <para>Attaches a sensor to the NXT brick.</para>
 /// </summary>
 /// <param name="sensor">The sensor</param>
 /// <param name="port">The port to attach the sensor to</param>
 private void AttachSensor(Sensor sensor, Protocol.SensorPort port)
 {
     if (sensor != null)
     {
         sensor.brick = this;
         sensor.Port = port;
         sensorArr[port] = sensor;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// <para>Attaches a motor to the NXT brick.</para>
 /// </summary>
 /// <param name="motor">The motor</param>
 /// <param name="port">The port to attach the motor to</param>
 private void AttachMotor(Motor motor, Protocol.MotorPortSingle port)
 {
     if (motor != null)
     {
         motorArr[port] = motor;
         motor.Brick = this;
         motor.Port = port;
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Forms a valid filename from a name and type.
 /// </summary>
 /// <param name="filename">The filename, without an extension.</param>
 /// <param name="filetype">The filetype extension, as enumerated by FileType.</param>
 /// <returns>The valid filename with extension or an NXTException.</returns>
 public static string FormFilename(string filename, Protocol.FileType filetype)
 {
     return Protocol.ValidateFilename(filename, filetype, true);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// <para>Constructor for NXT Sensors.</para>
 /// </summary>
 /// <param name="type">The type of the sensor.</param>
 /// <param name="mode">The sensor's mode.</param>
 public Sensor(Protocol.SensorType type, Protocol.SensorMode mode)
 {
     this.type = type;
     this.mode = mode;
 }