Class DevLirc

java.lang.Object
org.harctoolbox.harchardware.ir.DevLirc
All Implemented Interfaces:
Closeable, AutoCloseable, IHarcHardware, ICapture, IIrReader, IIrSenderStop, IRawIrSender, IReceive, ITransmitter

public class DevLirc extends Object implements IRawIrSender, IReceive, ICapture, ITransmitter, IIrSenderStop
  • Field Details

  • Constructor Details

    • DevLirc

      public DevLirc(String deviceName, boolean verbose) throws org.harctoolbox.devslashlirc.LircDeviceException
      Throws:
      org.harctoolbox.devslashlirc.LircDeviceException
    • DevLirc

      public DevLirc(String deviceName, boolean verbose, Integer timeout) throws org.harctoolbox.devslashlirc.LircDeviceException
      Throws:
      org.harctoolbox.devslashlirc.LircDeviceException
    • DevLirc

      public DevLirc(String deviceName) throws org.harctoolbox.devslashlirc.LircDeviceException
      Throws:
      org.harctoolbox.devslashlirc.LircDeviceException
    • DevLirc

      public DevLirc() throws org.harctoolbox.devslashlirc.LircDeviceException
      Throws:
      org.harctoolbox.devslashlirc.LircDeviceException
  • Method Details

    • getCandidates

      public static File[] getCandidates()
    • main

      public static void main(String[] args)
    • canSend

      public boolean canSend()
      Returns:
      the canSend
    • canReceive

      public boolean canReceive()
      Returns:
      the canReceive
    • getNumberTransmitters

      public int getNumberTransmitters()
      Returns:
      the numberTransmitters
    • canSetCarrier

      public boolean canSetCarrier()
      Returns:
      the canSetCarrier
    • canSetTransmitter

      public boolean canSetTransmitter()
      Returns:
      the canSetTransmitter
    • sendIr

      public boolean sendIr(org.harctoolbox.ircore.IrSignal irSignal, int count, Transmitter transmitter) throws HarcHardwareException
      Specified by:
      sendIr in interface IRawIrSender
      Returns:
      if false, command failed.
      Throws:
      NoSuchTransmitterException
      HarcHardwareException
    • sendIr

      public boolean sendIr(org.harctoolbox.ircore.IrSignal irSignal, int count, LircTransmitter transmitter) throws HarcHardwareException
      Throws:
      HarcHardwareException
    • receive

      public org.harctoolbox.ircore.IrSequence receive() throws HarcHardwareException, org.harctoolbox.ircore.OddSequenceLengthException
      Description copied from interface: IReceive
      Listens to the device and returns a sequence. Requires the device to be previously opened. Should itself neither open or close the device.
      Specified by:
      receive in interface IReceive
      Returns:
      Captured sequence, or null by timeout.
      Throws:
      HarcHardwareException - if the device is not in valid/open state.
      org.harctoolbox.ircore.OddSequenceLengthException
    • stopReceive

      public boolean stopReceive()
      Description copied from interface: IReceive
      Signals the receiving device that it should stop receiving. May not be implemented in all hardware.
      Specified by:
      stopReceive in interface IReceive
      Returns:
      status
    • stopIr

      public boolean stopIr(Transmitter transmitter)
      Description copied from interface: IIrSenderStop
      Stops ongoing IR transmission.
      Specified by:
      stopIr in interface IIrSenderStop
      Returns:
      if false, command failed.
    • getVersion

      public String getVersion() throws IOException
      Description copied from interface: IHarcHardware
      Returns the hardware version (not the version of the driver software). May be null if no relevant information available.
      Specified by:
      getVersion in interface IHarcHardware
      Returns:
      Version string. Semantics can vary.
      Throws:
      IOException
    • setVerbose

      public void setVerbose(boolean verbose)
      Description copied from interface: IHarcHardware
      Sets a verbosity flag, causing commands to be executed verbosely. Exact semantic depends on the implementation. Typically, all communication with the device is echoed to stderr.
      Specified by:
      setVerbose in interface IHarcHardware
      Parameters:
      verbose - on or off
    • setDebug

      public void setDebug(int debug)
      Description copied from interface: IHarcHardware
      Sets a debug parameter. Exact semantic depends on the implementation.
      Specified by:
      setDebug in interface IHarcHardware
    • isValid

      public boolean isValid()
      Description copied from interface: IHarcHardware
      Checks validity of an instance. Exact meaning can vary.
      Specified by:
      isValid in interface IHarcHardware
      Returns:
      validity of the instance.
    • setTimeout

      @Deprecated public void setTimeout(int timeout) throws IOException
      Deprecated.
      Description copied from interface: IHarcHardware
      Set timeout in milliseconds. Exact semantics may be dependent on the hardware.
      Specified by:
      setTimeout in interface IHarcHardware
      Parameters:
      timeout - Timeout in milliseconds.
      Throws:
      IOException
    • setBeginTimeout

      public void setBeginTimeout(int timeout) throws IOException
      Specified by:
      setBeginTimeout in interface IIrReader
      Throws:
      IOException
    • setCaptureMaxSize

      public void setCaptureMaxSize(int integer)
      Specified by:
      setCaptureMaxSize in interface IIrReader
    • setEndingTimeout

      public void setEndingTimeout(int integer)
      Specified by:
      setEndingTimeout in interface IIrReader
    • open

      public void open() throws HarcHardwareException
      Description copied from interface: IHarcHardware
      Opens the device with previously set parameters.
      Specified by:
      open in interface IHarcHardware
      Throws:
      HarcHardwareException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getTransmitter

      public Transmitter getTransmitter()
      Description copied from interface: IRawIrSender
      Returns a default Transmitter for the device. May be null if the device ignores the Transmitter argument in sendIr.
      Specified by:
      getTransmitter in interface IRawIrSender
      Specified by:
      getTransmitter in interface ITransmitter
      Returns:
      Transmitter
    • getTransmitter

      public LircTransmitter getTransmitter(String connector) throws NoSuchTransmitterException
      Description copied from interface: ITransmitter
      Parses the String argument, and returns a transmitter accordingly. Syntax and semantics may vary.
      Specified by:
      getTransmitter in interface ITransmitter
      Parameters:
      connector - String describing desired port. Syntax is dependent on the implementing class.
      Returns:
      Transmitter
      Throws:
      NoSuchTransmitterException
    • getTransmitter

      public LircTransmitter getTransmitter(int number) throws NoSuchTransmitterException
      Throws:
      NoSuchTransmitterException
    • getTransmitterNames

      public String[] getTransmitterNames()
      Description copied from interface: ITransmitter
      Return possible name of transmitters, that are guaranteed to work with the getTransmitter(String). This may be generated by inquiring the device, producing correct result, or it may be some static function, describing transmitters not necessarily present on the actually deployed device.
      Specified by:
      getTransmitterNames in interface ITransmitter
      Returns:
      Array of strings that are guaranteed to work with the getTransmitter(String)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • capture

      public org.harctoolbox.ircore.ModulatedIrSequence capture() throws HarcHardwareException, org.harctoolbox.ircore.OddSequenceLengthException
      Description copied from interface: ICapture
      Listens to the device and returns a sequence. Requires the device to be previously opened. Should itself neither open or close the device.
      Specified by:
      capture in interface ICapture
      Returns:
      Captured sequence, or null by timeout.
      Throws:
      HarcHardwareException - if the device is not in valid/open state.
      org.harctoolbox.ircore.OddSequenceLengthException
    • stopCapture

      public boolean stopCapture()
      Description copied from interface: ICapture
      Signals the capturing device that it should stop capturing. May not be implemented in all hardware.
      Specified by:
      stopCapture in interface ICapture
      Returns:
      status