public Brick(Protocol protocol, Protocol.BrickInfo brickinfo) { link = protocol; this.brickinfo = brickinfo; if (link == null) { throw new NXTLinkNotSupported(); } if (!link.IsSupported) { throw new NXTLinkNotSupported(); } }
/// <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) { }
/// <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; } }
/// <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; } }
/// <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); }
/// <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; }