Class DeviceIdentifier

    • Field Detail

      • openTime

        protected long openTime
      • port

        protected Port port
      • EV3AnalogMap

        protected static java.util.List<java.util.AbstractMap.SimpleEntry<java.lang.Integer,​java.lang.String>> EV3AnalogMap
    • Constructor Detail

      • DeviceIdentifier

        public DeviceIdentifier​(Port port)
        Create an instance of the device identifier for a particular port
        Parameters:
        port - The port to operate with
    • Method Detail

      • close

        public void close()
        Description copied from class: Device
        Close the sensor. Close associated resources.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class Device
      • openConfigPort

        protected void openConfigPort()
      • waitValid

        protected void waitValid()
        Wait until the identification data for this port is valid
      • getPortType

        public int getPortType()
        Get the type classification for the port. If a sensor is attached to the port this will identify the connection type (CONN_NONE, CONN_INPUT_UART etc.). See the class EV3SensorConstants for the actual values
        Returns:
        The type of the port
      • getDeviceType

        public int getDeviceType()
        This method returns information on the sensor/motor that is attached to the specified port. Note that only very basic sensor identification information may be available for some sensor types. It may be necessary to actually open the sensor to allow it to be identified in further detail.
        Returns:
        the sensor type
      • getNXTDumbSignature

        protected java.lang.String getNXTDumbSignature()
        Returns the signature for a dumb NXT sensor
        Returns:
        string identifying the device
      • getI2CSignature

        protected java.lang.String getI2CSignature​(boolean full)
        Returns the signature for a i2c sensor
        Returns:
        string identifying the device
      • getEV3DumbSignature

        protected java.lang.String getEV3DumbSignature()
        Returns the signature for a dumb EV3 sensor
        Returns:
        string identifying the device
      • getUARTSignature

        protected java.lang.String getUARTSignature()
        Returns the signature for a UART sensor
        Returns:
        string identifying the device
      • getMotorSignature

        protected java.lang.String getMotorSignature()
        Returns the signature for a motor/output device
        Returns:
        string identifying the device
      • getDeviceSignature

        public java.lang.String getDeviceSignature​(boolean full)
        return the signature of the attached device. This signature can be used to identify the actual device. Note that identification may require that the device is opened.
        Parameters:
        full - true to return all available information, false for basic information
        Returns:
        a string signature