Class Device

All Implemented Interfaces:
Runnable

public class Device extends JposDevice implements Runnable
JposDevice based implementation of JavaPOS BumpBar and RemoteOrderDisplay device service implementations for the sample device implemented in SampleSubsystemDevice.tcl.

Supported features for RemoteOrderDisplay part are:

  • One clock per display unit.
  • One buffer per display unit.
  • No tone, no character set selection, only one (default) video mode.
  • clock overlays text, text changes do not overwrite the clock as long as clock has not been stopped.
  • text does not overwrite drawn lines. Drawn lines can only be removed by clearVideo, clearVideoRegion or resetVideo.
  • A box around the clock can become part of the clock if it was drawn before starting the clock with the clock specific dimensions (height 1, width 5, 5 or eight, depending on clock type). In that case, the box remains part of the clock, even if it will be cleared by clearVideoRegion.
  • If the simulator performs a clock update cycle between reading out the current time and restarting the clock at the new position in method controlClock with function CLK_MOVE, the time will not be updated.
For each display unit, the whole contents of the display will be buffered in the service. For each character, a foreground and background color and a character value will be stored. In addition, if a a line has been drawn above, below, on the left or right side of the character, the line color will be stored as well. This is necessary to be able to implement save, restore, copy and move instructions, for normal text as well as for the clock.

Supported features for BumpBar are:

  • No tone.
  • Key Scan codes 1 - 8, can be customized via UPOS method SetKeyTranslation.
BumpBar and RemoteOrderDisplay are two device services implemented for one simulated physical device concentrator. There is a 1:1 relationship between bump bar units and remote order display units: Each unit sample consists of a remote order display with 20x25 characters and a bump bar with 8 keys. For each unit, the bump bar unit id and the remote order display unit id are equal and if both, remote order display and bump bar, are enabled, their power states and units online are equal.

Here a full list of all device specific properties that can be changed via jpos.xml:

  • BackgroundIntensity: Background intensity, must be 0 or ROD_ATTR_INTENSITY (8). Default: ROD_ATTR_INTENSITY.
  • CharacterTimeout: Positive integer value, specifying the maximum delay between bytes that belong to the same frame. Default value: 50 milliseconds.
  • ClientPort: Integer value between 0 and 65535 specifying the TCP port used for communication with the device simulator. Default: 0 (for random port number selected by operating system).
  • CursorColor: Color and insensity of the cursor. Default: ROD_ATTR_FG_BLACK (0). Can be set to any value between 0 and 15.
  • MinClaimTimeout: Minimum timeout in milliseconds used by method Claim to ensure correct working. Must be a positive value. If this value is too small, Claim might throw a JposException even if everything is OK if the specified timeout is less than or equal to MinClaimTimeout. Default: 100.
  • Port: Operating system specific name of the TCP address to be used for communication with the device simulator. Names are of the form IPv4:port, where IPv4 is the IP address of the device and port its TCP port.
  • RequestTimeout: Maximum time, in milliseconds, between sending a command to the simulator and getting the first byte of its response. Default: 1000.
  • Field Details

    • JPOS_EROD_NOUNITS

      public static final int JPOS_EROD_NOUNITS
      Extended error code that has not yet defined within the JavaPOS framework. The value (200) must be replaced by JPOS_EROD_NOUNITS when this constant will be defined in future.
      See Also:
      Constant Field Values
  • Constructor Details

    • Device

      protected Device(String id)
      Constructor. ID is the network address of the remote order display controller. The controller is the instance that controls the communication between the application and up to 32 displays, it is some kind of hub or so. In case of the sample device, up to 5 displays of identical types are supported. Other examples might consist of a controller that controls several completely different devices, some might support touch events, some might support tone output, all might support completely different dimensions.
      Parameters:
      id - Network address of the display controller.
  • Method Details

    • checkProperties

      public void checkProperties(jpos.config.JposEntry entry) throws jpos.JposException
      Description copied from class: JposBaseDevice
      Checks whether a JposEntry belongs to a predefined property value an if so, sets the corresponding driver value
      Overrides:
      checkProperties in class JposBaseDevice
      Parameters:
      entry - Entry to be checked, contains value to be set
      Throws:
      jpos.JposException - if a property value is invalid
    • changeDefaults

      public void changeDefaults(RemoteOrderDisplayProperties props)
      Description copied from class: JposDevice
      Change defaults of properties. Must be implemented within derived classed that support remote order display services.
      Overrides:
      changeDefaults in class JposDevice
      Parameters:
      props - Property set for setting the property defaults
    • changeDefaults

      public void changeDefaults(BumpBarProperties props)
      Description copied from class: JposDevice
      Change defaults of properties. Must be implemented within derived classed that support bump bar services.
      Overrides:
      changeDefaults in class JposDevice
      Parameters:
      props - Property set for setting the property defaults
    • sendCommand

      protected jpos.JposException sendCommand(String command)
      Method to perform any command, Keep in mind that commands normally generate no response.
      Parameters:
      command - Command data to be sent, without final ETX.
      Returns:
      JposException in error case, null if no error occurred.
    • run

      public void run()
      Main thread, reads frames from simulator and generates the corresponding events (coordinates or power state for specific display unit)
      Specified by:
      run in interface Runnable
    • getBumpBarProperties

      public BumpBarProperties getBumpBarProperties(int index)
      Description copied from class: JposDevice
      Returns device implementation of BumpBarProperties.
      Overrides:
      getBumpBarProperties in class JposDevice
      Parameters:
      index - Device index, see constructor of JposCommonProperties.
      Returns:
      Instance of BumpBarProperties that matches the requirements of the corresponding device service.
    • getRemoteOrderDisplayProperties

      public RemoteOrderDisplayProperties getRemoteOrderDisplayProperties(int index)
      Description copied from class: JposDevice
      Returns device implementation of RemoteOrderDisplayProperties.
      Overrides:
      getRemoteOrderDisplayProperties in class JposDevice
      Parameters:
      index - Device index, see constructor of JposCommonProperties.
      Returns:
      Instance of RemoteOrderDisplayProperties that matches the requirements of the corresponding device service.