Package com.ed.edcom

Class Client

java.lang.Object
com.ed.edcom.Client
All Implemented Interfaces:
Closeable, AutoCloseable, Comparable<Client>, Runnable

public final class Client extends Object implements Comparable<Client>, Runnable, Closeable
Client implementation.
  • Field Details

  • Constructor Details

    • Client

      public Client(InetAddress devAddress, InetAddress hostAddress, int startDelay) throws Exception
      Constructor
      Parameters:
      devAddress - inverter IP address
      hostAddress - local host IP address related to desired network interface
      startDelay - communication start delay in milliseconds
      Throws:
      Exception - wrong parameters or resources, etc.
  • Method Details

    • setUserPass

      public void setUserPass(String key)
      Set user password
      Parameters:
      key - user password
    • setUserPass

      public void setUserPass(int key)
      Set password as integer
      Parameters:
      key - user password
    • setUserKey

      @Deprecated public void setUserKey(int key)
      Deprecated.
    • setUserKey

      @Deprecated public void setUserKey(String key)
      Deprecated.
    • getUserPass

      public int getUserPass()
      Get user password set by setUserKey
      Returns:
      user password
    • getUserKey

      @Deprecated public int getUserKey()
      Deprecated.
    • getUserStatus

      @Deprecated public int getUserStatus()
      Deprecated.
      Only use this with inver versions older than 8.0.

      Use

      Read current permission (up to package 7)
      Returns:
      -1 - not read (wait for server response) 0 - access denied 1 - no password required 2 - password accepted 3 - energy depot
    • getAccessFeedb

      public byte getAccessFeedb()
      Get accessFeedb (from package 8)
      Returns:
      access feedback bitfield: Bit0 = Bootloader active; Bit1 = identKey accepted; Bit2 = userKey accepted
    • isIdAccepted

      public boolean isIdAccepted()
      Check if ID is accepted by inverter
      Returns:
      true - ID accepted, false - ID not accpeted.
    • isPasswordAccepted

      public boolean isPasswordAccepted()
      Check if user password is accepted by inverter
      Returns:
      true - ID accepted, false - ID not accpeted.
    • getLastAuthentication

      public long getLastAuthentication()
      Get timestamp of last authentication
      Returns:
      Authentication timestamp
    • start

      public void start() throws IllegalThreadStateException
      Start communication
      Throws:
      IllegalThreadStateException
    • close

      public void close() throws IOException
      Close this client. Once a client has been closed, it is not available for further use. A new client needs to be created.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - according to interface definition
    • getDescriptor

      public String getDescriptor()
      Get device descriptor
      Returns:
      ip address or device serial number
    • isConnected

      public boolean isConnected()
      Connection status
      Returns:
      connection status
    • isVisible

      public boolean isVisible()
      Visibility status (hy-sys specific option)
      Returns:
      visibility status
    • reconnect

      public void reconnect()
      Restart current connection
    • addDspVar

      public void addDspVar(ADspData dv)
      Add variable
      Parameters:
      dv - dsp variable to add
    • addDspVar

      public void addDspVar(List<ADspData> dvLst)
      Add list of variables
      Parameters:
      dvLst - list of variables to add
    • removeDspVarByKey

      public void removeDspVarByKey(int key)
      Remove variable
      Parameters:
      key - remove all variables with selected key
    • removeDspVar

      public void removeDspVar(ADspData d)
      Remove variable
      Parameters:
      d - dsp variable to remove
    • removeAllDspVar

      public void removeAllDspVar()
      Remove all registered variables
    • activate

      public void activate()
      Activate client
    • isParamChanged

      public boolean isParamChanged()
      Get status of registered dsp variables
      Returns:
      true if was changed
    • setDesc

      public void setDesc(ByteBuffer buf)
      Set descriptor
      Parameters:
      buf - new descriptor
    • toString

      public String toString()
      toString implementation
      Overrides:
      toString in class Object
      Returns:
      device name
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • sendBlob

      public void sendBlob(DspBlob blob)
      Send BLOB
      Parameters:
      blob - to send
    • sendBlobList

      public void sendBlobList(List<DspBlob> blobs)
      Send list of BLOBs
      Parameters:
      blobs - to send
    • getBlobsCnt

      public int getBlobsCnt()
      Get BLOBS count
      Returns:
      blobs count
    • getBlobsState

      public int getBlobsState()
      BLOB status
      Returns:
      '0' - wait for upload, '1' - upload started, '2' - all complete, '-1' - upload error
    • removeAllBlobs

      public void removeAllBlobs()
      Remove all BLOBs.
    • run

      public void run()
      Run implementation.
      Specified by:
      run in interface Runnable
    • getClientId

      public int getClientId(int ix) throws RuntimeException
      Get connected clients
      Parameters:
      ix - client index [0..3]
      Returns:
      client id
      Throws:
      RuntimeException
    • getClientIdListRefreshTime

      public long getClientIdListRefreshTime()
      Get connected clients list refresh time
      Returns:
      time [ms]
    • getPicVersion

      public byte[] getPicVersion()
    • getRandomKey

      public byte[] getRandomKey()
    • getAccessFeedbRefreshTime

      public long getAccessFeedbRefreshTime()
    • getComVersion

      public int[] getComVersion()
    • compareTo

      public int compareTo(Client o)
      Specified by:
      compareTo in interface Comparable<Client>