Class RemoteNXTI2CPort

    • Constructor Detail

      • RemoteNXTI2CPort

        public RemoteNXTI2CPort​(NXTCommand nxtCommand)
    • Method Detail

      • getChanged

        protected boolean getChanged()
      • getStatus

        protected byte getStatus()
      • reset

        protected void reset()
      • setOperatingMode

        protected void setOperatingMode​(int typ,
                                        int mode)
      • initSensor

        protected boolean initSensor()
      • open

        public boolean open​(int t,
                            int p,
                            RemoteNXTPort r)
        allow access to the specified port
        Overrides:
        open in class RemoteNXTIOPort
        Parameters:
        p - port number to open
        t - The type of port motor/sensor
        r - the Port ref for this port
        Returns:
        true if success
      • i2cTransaction

        public void i2cTransaction​(int deviceAddress,
                                   byte[] writeBuf,
                                   int writeOffset,
                                   int writeLen,
                                   byte[] readBuf,
                                   int readOffset,
                                   int readLen)
        High level i2c interface. Perform a complete i2c transaction and return the results. Writes the specified data to the device and then reads the requested bytes from it.
        Specified by:
        i2cTransaction in interface I2CPort
        Parameters:
        deviceAddress - The I2C device address.
        writeBuf - The buffer containing data to be written to the device.
        writeOffset - The offset of the data within the write buffer
        writeLen - The number of bytes to write.
        readBuf - The buffer to use for the transaction results
        readOffset - Location to write the results to
        readLen - The length of the read
      • setTypeAndMode

        public boolean setTypeAndMode​(int type,
                                      int mode)
        Set the sensor type and mode
        Specified by:
        setTypeAndMode in interface BasicSensorPort
        Overrides:
        setTypeAndMode in class RemoteNXTIOPort
        Parameters:
        type - the sensor type
        mode - the sensor mode
        Returns:
        true if success
      • setType

        public boolean setType​(int type)
        Set the sensor type
        Specified by:
        setType in interface BasicSensorPort
        Overrides:
        setType in class RemoteNXTIOPort
        Parameters:
        type - the sensor type
        Returns:
        true if success
      • setMode

        public boolean setMode​(int mode)
        Set the sensor mode
        Specified by:
        setMode in interface BasicSensorPort
        Overrides:
        setMode in class RemoteNXTIOPort
        Parameters:
        mode - the sensor mode
        Returns:
        true if success