Class DeviceTouchSearch

java.lang.Object
de.freaklamarsch.systarest.DeviceTouchSearch

public class DeviceTouchSearch
extends java.lang.Object
A utility class for searching and interacting with DeviceTouch devices. This class provides methods to create search messages, parse responses, and extract device information.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  DeviceTouchSearch.DeviceTouchDeviceInfo
    Information returned from a device supporting the DeviceTouch protocol
  • Field Summary

    Fields
    Modifier and Type Field Description
    private static int BCAST_PORT  
    private static int MAX_DATA_LENGTH  
  • Constructor Summary

    Constructors
    Constructor Description
    DeviceTouchSearch()  
  • Method Summary

    Modifier and Type Method Description
    static java.net.DatagramPacket createPasswordRequestMessage​(java.lang.String mac, java.net.InetAddress bcastAddress)
    Creates the DatagramPacket to request the password from a DeviceTouch device.
    static java.net.DatagramPacket createPortRequestMessage​(java.lang.String mac, java.net.InetAddress bcastAddress)
    Creates the DatagramPacket to request the port number used from communication from a DeviceTouch device.
    static java.net.DatagramPacket createSearchMessage​(java.net.InetAddress bcastAddress)
    Creates a search message to broadcast on the network for discovering DeviceTouch devices.
    static java.lang.String getPasswordReplyString​(java.net.DatagramPacket receivePacket)
    Extracts the password reply string from a DatagramPacket received from a DeviceTouch device.
    static java.lang.String getPortReplyString​(java.net.DatagramPacket receivePacket)
    Extracts the search reply string from a DatagramPacket.
    static java.lang.String getSearchReplyString​(java.net.DatagramPacket receivePacket)
    Extracts the search reply string from a DatagramPacket.
    static DeviceTouchSearch.DeviceTouchDeviceInfo parseDeviceTouchInfoString​(java.lang.String deviceTouchInfoString)
    Function to parse the info string returned from a Paradigma SystaComfort The string looks like SC2 1 192.168.11.23 255.255.255.0 192.168.11.1 SystaComfort-II0 0809720001 0 V0.34 V1.00 2CBE9700BEE9
    static java.lang.String parsePasswordReplyString​(java.lang.String reply)
    Parses a password reply message received from a DeviceTouch device.
    static int parsePortReplyString​(java.lang.String reply)
    Parses a port reply message received from a DeviceTouch device.
    static DeviceTouchSearch.DeviceTouchDeviceInfo search()
    Search for devices supporting the DeviceTouch protocol.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • DeviceTouchSearch

      public DeviceTouchSearch()
  • Method Details

    • search

      Search for devices supporting the DeviceTouch protocol. The search sends UDP broadcasts and returns the DeviceTouchSearch.DeviceTouchDeviceInfo object parsed from received reply messages
      Returns:
      received DeviceTouchSearch.DeviceTouchDeviceInfo
    • parsePasswordReplyString

      public static java.lang.String parsePasswordReplyString​(java.lang.String reply)
      Parses a password reply message received from a DeviceTouch device.
      Parameters:
      reply - the reply string containing the password
      Returns:
      the extracted password
    • getPasswordReplyString

      public static java.lang.String getPasswordReplyString​(java.net.DatagramPacket receivePacket) throws java.lang.NumberFormatException
      Extracts the password reply string from a DatagramPacket received from a DeviceTouch device.
      Parameters:
      receivePacket - the DatagramPacket containing the password reply
      Returns:
      the extracted password reply string
      Throws:
      java.lang.NumberFormatException
    • createPasswordRequestMessage

      public static java.net.DatagramPacket createPasswordRequestMessage​(java.lang.String mac, java.net.InetAddress bcastAddress)
      Creates the DatagramPacket to request the password from a DeviceTouch device.
      Parameters:
      mac - the MAC address of the target DeviceTouch device
      bcastAddress - the broadcast address used for communication with the DeviceTouch device
      Returns:
      a DatagramPacket containing the password request message
    • parsePortReplyString

      public static int parsePortReplyString​(java.lang.String reply) throws java.lang.NumberFormatException
      Parses a port reply message received from a DeviceTouch device.
      Parameters:
      reply - the reply string containing the port
      Returns:
      the extracted port
      Throws:
      java.lang.NumberFormatException - if the reply dows not contain a valid Integer
    • getPortReplyString

      public static java.lang.String getPortReplyString​(java.net.DatagramPacket receivePacket)
      Extracts the search reply string from a DatagramPacket.
      Parameters:
      receivePacket - the DatagramPacket containing the port reply
      Returns:
      the extracted port reply string
    • createPortRequestMessage

      public static java.net.DatagramPacket createPortRequestMessage​(java.lang.String mac, java.net.InetAddress bcastAddress)
      Creates the DatagramPacket to request the port number used from communication from a DeviceTouch device.
      Parameters:
      mac - the MAC address of the target DeviceTouch device
      bcastAddress - the broadcast address used for communication with the DeviceTouch device
      Returns:
      a DatagramPacket containing the port request message
    • getSearchReplyString

      public static java.lang.String getSearchReplyString​(java.net.DatagramPacket receivePacket)
      Extracts the search reply string from a DatagramPacket.
      Parameters:
      receivePacket - the DatagramPacket containing the search reply
      Returns:
      the extracted search reply string
    • createSearchMessage

      public static java.net.DatagramPacket createSearchMessage​(java.net.InetAddress bcastAddress)
      Creates a search message to broadcast on the network for discovering DeviceTouch devices.
      Parameters:
      bcastAddress - the broadcast address to send the search message
      Returns:
      a DatagramPacket containing the search message
    • parseDeviceTouchInfoString

      public static DeviceTouchSearch.DeviceTouchDeviceInfo parseDeviceTouchInfoString​(java.lang.String deviceTouchInfoString)
      Function to parse the info string returned from a Paradigma SystaComfort The string looks like SC2 1 192.168.11.23 255.255.255.0 192.168.11.1 SystaComfort-II0 0809720001 0 V0.34 V1.00 2CBE9700BEE9
      Parameters:
      deviceTouchInfoString - the string received from the Paradigma SystaComfort
      Returns:
      the SCInfoString object parsed from the string