com.impinj.stp

## Class Device

- java.lang.Object
- - com.impinj.stp.Device

-     public class Device
      extends java.lang.Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `Device.CartonContentsReportListener` Defines the Interface for the CartonContentsReport Listener
    `static interface` | `Device.DeviceEventReportListener` Defines the Interface for the DeviceEventReport Listener
    `class` | `Device.DeviceException` General exception while communication with the Speedway
    `static interface` | `Device.OperationSummaryReportListener` Defines the Interface for the OperationSummaryReport Listener
    `static interface` | `Device.TagOperationReportListener` Defines the Interface for the TagOperationReport Listener

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static byte` | `FORMATTING_LENGTH`
    `protected static byte[]` | `FRAME_MARKER_BYTES`
    `static java.lang.String` | `JUNIT_TEST_TAG`
    `protected static int` | `MAX_SENSIBLE_FRAME_LENGTH`
    `protected static int` | `PORT`
    `protected static byte` | `VERSION_BYTE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Device(java.lang.String ipOrHost)` Provides the application a communication interface with the Device
    `Device(java.lang.String ipOrHost, int timeoutMS)` Provides the application a communication interface with the Device

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCartonContentsReportListener(Device.CartonContentsReportListener report)` Adds a CartonContentsReport listener
    `void` | `addDeviceEventReportListener(Device.DeviceEventReportListener report)` Adds a DeviceEventReport listener
    `void` | `addOperationSummaryReportListener(Device.OperationSummaryReportListener report)` Adds a OperationSummaryReport listener
    `void` | `addTagOperationReportListener(Device.TagOperationReportListener report)` Adds a TagOperationReport listener
    `static byte[]` | `buildPayloadBuffer(byte[] payloadBytes)`
    `StpApi.DisengageResp` | `disengage()` Takes Speedway out of Engage mode
    `StpApi.EngageResp` | `engage()` Puts Speedway into Engage mode.
    `protected byte[]` | `getNextToHost()` Used for jUnit tests so it is public
    `java.util.List<StpApi.Version>` | `getVersions()` Sends GetVersions command
    `StpApi.ConnectResp` | `handshake()` Runs a handshake command
    `java.lang.String` | `kdkVersion()` Gets version String.
    `void` | `removeCartonContentsReportListener(Device.CartonContentsReportListener report)` Removes a specified CartonContentsReport listener
    `void` | `removeDeviceEventReportListener(Device.DeviceEventReportListener report)` Removes a specified DeviceEventReport listener
    `void` | `removeOperationSummaryReportListener(Device.OperationSummaryReportListener report)` Removes a specified OperationSummaryReport listener
    `void` | `removeTagOperationReportListener(Device.TagOperationReportListener report)` Removes a specified TagOperationReport listener
    `StpApi.AddLicenseKeyResp` | `runAddLicenseKeyCommand(StpApi.AddLicenseKeyCommand cmd)` Runs AddLicenseKey proto buffer command
    `StpApi.AddOrderedListEntriesResp` | `runAddOrderedListEntriesCommand(StpApi.AddOrderedListEntriesCommand cmd)` Runs AddOrderedListEntries proto buffer command
    `StpApi.AddSerializationJobResp` | `runAddSerializationJobCommand(StpApi.AddSerializationJobCommand cmd)` Runs AddSerializationJob proto buffer command
    `StpApi.AddTIDTableEntriesResp` | `runAddTIDTableEntriesCommand(StpApi.AddTIDTableEntriesCommand cmd)` Runs AddTidTableEntries proto buffer command
    `StpApi.ConnectResp` | `runConnectCommand(StpApi.ConnectCommand cmd)` Runs Connect proto buffer command
    `StpApi.DisengageResp` | `runDisengageCommand(StpApi.DisengageCommand cmd)` Runs Disengage proto buffer command
    `StpApi.EngageResp` | `runEngageCommand(StpApi.EngageCommand cmd)` Runs Engage proto buffer command
    `StpApi.GetAntennaConfigResp` | `runGetAntennaConfigCommand(StpApi.GetAntennaConfigCommand cmd)` Runs GetAntennaConfig proto buffer command
    `StpApi.GetDeviceConfigResp` | `runGetDeviceConfigCommand(StpApi.GetDeviceConfigCommand cmd)` Runs GetDeviceConfig proto buffer command
    `StpApi.GetDeviceStateResp` | `runGetDeviceStateCommand(StpApi.GetDeviceStateCommand cmd)` Runs GetDeviceState proto buffer command
    `StpApi.GetOperationDataResp` | `runGetOperationDataCommand(StpApi.GetOperationDataCommand cmd)` Runs GetOperationData proto buffer command
    `StpApi.GetVersionsReaderResp` | `runGetVersionsReaderCommand(StpApi.GetVersionsReaderCommand cmd)` Runs GetVersionsReader proto buffer command
    `StpApi.RemoveSerializationJobResp` | `runRemoveSerializationJobCommand(StpApi.RemoveSerializationJobCommand cmd)` Runs RemoveSerializationJob proto buffer command
    `StpApi.SetAntennaConfigResp` | `runSetAntennaConfigCommand(StpApi.SetAntennaConfigCommand cmd)` Runs SetAntennaConfig proto buffer command
    `StpApi.SetCartonContentsJobResp` | `runSetCartonContentsJobCommand(StpApi.SetCartonContentsJobCommand cmd)` Runs SetCartonContentsJob proto buffer command
    `StpApi.SetDeviceConfigResp` | `runSetDeviceConfigCommand(StpApi.SetDeviceConfigCommand cmd)` Runs SetDeviceConfig proto buffer command
    `StpApi.SetInventoryJobResp` | `runSetInventoryJobCommand(StpApi.SetInventoryJobCommand cmd)` Runs SetInventoryJob proto buffer command
    `StpApi.SetOperationResultGPOResp` | `runSetOperationResultGPOCommand(StpApi.SetOperationResultGPOCommand cmd)` Runs SetOperationResultGpo proto buffer command
    `StpApi.StartResp` | `runStartCommand(StpApi.StartCommand cmd)` Runs Start proto buffer command
    `StpApi.StopResp` | `runStopCommand(StpApi.StopCommand cmd)` Runs Stop proto buffer command
    `void` | `setDebug(boolean on)` Sends debug messages to standard output.
    `StpApi.StartResp` | `start()` Puts Speedway into Start mode.
    `StpApi.StopResp` | `stop()` Takes Speedway out of Start mode
    `void` | `stpClose()` Closes connection between Speedway and the STP application
    `protected void` | `txToReader(StpApi.Command command)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### JUNIT_TEST_TAG

          public static final java.lang.String JUNIT_TEST_TAG

      See Also:
        Constant Field Values

    - #### PORT

          protected static int PORT

    - #### FRAME_MARKER_BYTES

          protected static byte[] FRAME_MARKER_BYTES

    - #### VERSION_BYTE

          protected static byte VERSION_BYTE

    - #### FORMATTING_LENGTH

          protected static byte FORMATTING_LENGTH

    - #### MAX_SENSIBLE_FRAME_LENGTH

          protected static int MAX_SENSIBLE_FRAME_LENGTH

  - ### Constructor Detail

    - #### Device

          public Device(java.lang.String ipOrHost,
                        int timeoutMS)
                 throws java.io.IOException

      Provides the application a communication interface with the Device
      Parameters:
        `ipOrHost` - of the Speedway Device. Can be an IP address or host name.
        `timeoutMS` - Connection timeout in milliseconds
      Throws:
        `java.io.IOException` - TCP/IP communication failure

    - #### Device

          public Device(java.lang.String ipOrHost)
                 throws java.io.IOException

      Provides the application a communication interface with the Device
      Parameters:
        `ipOrHost` - of the Speedway Device. Can be an IP address or host name. Default timeout 1 second.
      Throws:
        `java.io.IOException` - TCP/IP communication failure

  - ### Method Detail

    - #### buildPayloadBuffer

          public static byte[] buildPayloadBuffer(byte[] payloadBytes)

    - #### txToReader

          protected void txToReader(StpApi.Command command)
                             throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getNextToHost

          protected byte[] getNextToHost()
                                  throws com.impinj.stp.Device.BadBytesReceivedException,
                                         java.io.IOException

      Used for jUnit tests so it is public
      Returns:
        byte[] byte array containing command return data or report data
      Throws:
        `BadBytesReceivedException` - an error in CRC or reading from the data stream
        `java.io.IOException` - TCP/IP communication failure
        `com.impinj.stp.Device.BadBytesReceivedException`

    - #### setDebug

          public void setDebug(boolean on)

      Sends debug messages to standard output.
      Parameters:
        `on` - sends debug messages if true (Default: false)

    - #### stpClose

          public void stpClose()

      Closes connection between Speedway and the STP application

    - #### handshake

          public StpApi.ConnectResp handshake()
                                       throws Device.DeviceException

      Runs a handshake command
      Returns:
        ConnectResp which contain the handshake object with version information.
      Throws:
        `Device.DeviceException` - when command fails

    - #### getVersions

          public java.util.List<StpApi.Version> getVersions()
                                                     throws Device.DeviceException

      Sends GetVersions command
      Returns:
        List of Version for each software interface
      Throws:
        `Device.DeviceException` - when command fails

    - #### start

          public StpApi.StartResp start()
                                 throws Device.DeviceException

      Puts Speedway into Start mode.
      Returns:
        StartResp command repose
      Throws:
        `Device.DeviceException` - when command fails

    - #### stop

          public StpApi.StopResp stop()
                               throws Device.DeviceException

      Takes Speedway out of Start mode
      Returns:
        StopResp command repose
      Throws:
        `Device.DeviceException` - when command fails

    - #### engage

          public StpApi.EngageResp engage()
                                   throws Device.DeviceException

      Puts Speedway into Engage mode.
      Returns:
        EngageResp command repose
      Throws:
        `Device.DeviceException` - when command fails

    - #### disengage

          public StpApi.DisengageResp disengage()
                                         throws Device.DeviceException

      Takes Speedway out of Engage mode
      Returns:
        DisengageResp command repose
      Throws:
        `Device.DeviceException` - when command fails

    - #### runConnectCommand

          public StpApi.ConnectResp runConnectCommand(StpApi.ConnectCommand cmd)
                                               throws Device.DeviceException

      Runs Connect proto buffer command
      Parameters:
        `cmd` - Builder object for ConnectCommand
      Returns:
        ConnectResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runGetVersionsReaderCommand

          public StpApi.GetVersionsReaderResp runGetVersionsReaderCommand(StpApi.GetVersionsReaderCommand cmd)
                                                                   throws Device.DeviceException

      Runs GetVersionsReader proto buffer command
      Parameters:
        `cmd` - Builder object for GetVersionsReaderCommand
      Returns:
        GetVersionsReaderResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runStartCommand

          public StpApi.StartResp runStartCommand(StpApi.StartCommand cmd)
                                           throws Device.DeviceException

      Runs Start proto buffer command
      Parameters:
        `cmd` - Builder object for StartCommand
      Returns:
        StartResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runStopCommand

          public StpApi.StopResp runStopCommand(StpApi.StopCommand cmd)
                                         throws Device.DeviceException

      Runs Stop proto buffer command
      Parameters:
        `cmd` - Builder object for StopCommand
      Returns:
        StopResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runSetDeviceConfigCommand

          public StpApi.SetDeviceConfigResp runSetDeviceConfigCommand(StpApi.SetDeviceConfigCommand cmd)
                                                               throws Device.DeviceException

      Runs SetDeviceConfig proto buffer command
      Parameters:
        `cmd` - Builder object for SetDeviceConfigCommand
      Returns:
        SetDeviceConfigResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runGetDeviceConfigCommand

          public StpApi.GetDeviceConfigResp runGetDeviceConfigCommand(StpApi.GetDeviceConfigCommand cmd)
                                                               throws Device.DeviceException

      Runs GetDeviceConfig proto buffer command
      Parameters:
        `cmd` - Builder object for GetDeviceConfigCommand
      Returns:
        GetDeviceConfigResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runSetAntennaConfigCommand

          public StpApi.SetAntennaConfigResp runSetAntennaConfigCommand(StpApi.SetAntennaConfigCommand cmd)
                                                                 throws Device.DeviceException

      Runs SetAntennaConfig proto buffer command
      Parameters:
        `cmd` - Builder object for SetAntennaConfigCommand
      Returns:
        SetAntennaConfigResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runGetAntennaConfigCommand

          public StpApi.GetAntennaConfigResp runGetAntennaConfigCommand(StpApi.GetAntennaConfigCommand cmd)
                                                                 throws Device.DeviceException

      Runs GetAntennaConfig proto buffer command
      Parameters:
        `cmd` - Builder object for GetAntennaConfigCommand
      Returns:
        GetAntennaConfigResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runEngageCommand

          public StpApi.EngageResp runEngageCommand(StpApi.EngageCommand cmd)
                                             throws Device.DeviceException

      Runs Engage proto buffer command
      Parameters:
        `cmd` - Builder object for EngageCommand
      Returns:
        EngageResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runDisengageCommand

          public StpApi.DisengageResp runDisengageCommand(StpApi.DisengageCommand cmd)
                                                   throws Device.DeviceException

      Runs Disengage proto buffer command
      Parameters:
        `cmd` - Builder object for DisengageCommand
      Returns:
        DisengageResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runSetOperationResultGPOCommand

          public StpApi.SetOperationResultGPOResp runSetOperationResultGPOCommand(StpApi.SetOperationResultGPOCommand cmd)
                                                                           throws Device.DeviceException

      Runs SetOperationResultGpo proto buffer command
      Parameters:
        `cmd` - Builder object for SetOperationResultGPOCommand
      Returns:
        SetOperationResultGPOResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runAddSerializationJobCommand

          public StpApi.AddSerializationJobResp runAddSerializationJobCommand(StpApi.AddSerializationJobCommand cmd)
                                                                       throws Device.DeviceException

      Runs AddSerializationJob proto buffer command
      Parameters:
        `cmd` - Builder object for AddSerializationJobCommand
      Returns:
        AddSerializationJobResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runRemoveSerializationJobCommand

          public StpApi.RemoveSerializationJobResp runRemoveSerializationJobCommand(StpApi.RemoveSerializationJobCommand cmd)
                                                                             throws Device.DeviceException

      Runs RemoveSerializationJob proto buffer command
      Parameters:
        `cmd` - Builder object for RemoveSerializationJobCommand
      Returns:
        RemoveSerializationJobResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runAddTIDTableEntriesCommand

          public StpApi.AddTIDTableEntriesResp runAddTIDTableEntriesCommand(StpApi.AddTIDTableEntriesCommand cmd)
                                                                     throws Device.DeviceException

      Runs AddTidTableEntries proto buffer command
      Parameters:
        `cmd` - Builder object for AddTIDTableEntriesCommand
      Returns:
        AddTIDTableEntriesResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runAddOrderedListEntriesCommand

          public StpApi.AddOrderedListEntriesResp runAddOrderedListEntriesCommand(StpApi.AddOrderedListEntriesCommand cmd)
                                                                           throws Device.DeviceException

      Runs AddOrderedListEntries proto buffer command
      Parameters:
        `cmd` - Builder object for AddOrderedListEntriesCommand
      Returns:
        AddOrderedListEntriesResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runSetInventoryJobCommand

          public StpApi.SetInventoryJobResp runSetInventoryJobCommand(StpApi.SetInventoryJobCommand cmd)
                                                               throws Device.DeviceException

      Runs SetInventoryJob proto buffer command
      Parameters:
        `cmd` - Builder object for SetInventoryJobCommand
      Returns:
        SetInventoryJobResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runSetCartonContentsJobCommand

          public StpApi.SetCartonContentsJobResp runSetCartonContentsJobCommand(StpApi.SetCartonContentsJobCommand cmd)
                                                                         throws Device.DeviceException

      Runs SetCartonContentsJob proto buffer command
      Parameters:
        `cmd` - Builder object for SetCartonContentsJobCommand
      Returns:
        SetCartonContentsJobResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runGetOperationDataCommand

          public StpApi.GetOperationDataResp runGetOperationDataCommand(StpApi.GetOperationDataCommand cmd)
                                                                 throws Device.DeviceException

      Runs GetOperationData proto buffer command
      Parameters:
        `cmd` - Builder object for GetOperationDataCommand
      Returns:
        GetOperationDataResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runAddLicenseKeyCommand

          public StpApi.AddLicenseKeyResp runAddLicenseKeyCommand(StpApi.AddLicenseKeyCommand cmd)
                                                           throws Device.DeviceException

      Runs AddLicenseKey proto buffer command
      Parameters:
        `cmd` - Builder object for AddLicenseKeyCommand
      Returns:
        AddLicenseKeyResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### runGetDeviceStateCommand

          public StpApi.GetDeviceStateResp runGetDeviceStateCommand(StpApi.GetDeviceStateCommand cmd)
                                                             throws Device.DeviceException

      Runs GetDeviceState proto buffer command
      Parameters:
        `cmd` - Builder object for GetDeviceStateCommand
      Returns:
        GetDeviceStateResp contains results from command
      Throws:
        `Device.DeviceException` - when command fails (See error Message)

    - #### addOperationSummaryReportListener

          public void addOperationSummaryReportListener(Device.OperationSummaryReportListener report)

      Adds a OperationSummaryReport listener
      Parameters:
        `report` - OperationSummaryReport Listener to be added

    - #### removeOperationSummaryReportListener

          public void removeOperationSummaryReportListener(Device.OperationSummaryReportListener report)

      Removes a specified OperationSummaryReport listener
      Parameters:
        `report` - OperationSummaryReport Listener to be removed

    - #### addTagOperationReportListener

          public void addTagOperationReportListener(Device.TagOperationReportListener report)

      Adds a TagOperationReport listener
      Parameters:
        `report` - TagOperationReport Listener to be added

    - #### removeTagOperationReportListener

          public void removeTagOperationReportListener(Device.TagOperationReportListener report)

      Removes a specified TagOperationReport listener
      Parameters:
        `report` - TagOperationReport Listener to be removed

    - #### addDeviceEventReportListener

          public void addDeviceEventReportListener(Device.DeviceEventReportListener report)

      Adds a DeviceEventReport listener
      Parameters:
        `report` - DeviceEventReport Listener to be added

    - #### removeDeviceEventReportListener

          public void removeDeviceEventReportListener(Device.DeviceEventReportListener report)

      Removes a specified DeviceEventReport listener
      Parameters:
        `report` - DeviceEventReport Listener to be removed

    - #### addCartonContentsReportListener

          public void addCartonContentsReportListener(Device.CartonContentsReportListener report)

      Adds a CartonContentsReport listener
      Parameters:
        `report` - CartonContentsReport Listener to be added

    - #### removeCartonContentsReportListener

          public void removeCartonContentsReportListener(Device.CartonContentsReportListener report)

      Removes a specified CartonContentsReport listener
      Parameters:
        `report` - CartonContentsReport Listener to be removed

    - #### kdkVersion

          public java.lang.String kdkVersion()

      Gets version String.
      Returns:
        String version string