Package jpigpio

Class SocketLock

java.lang.Object
jpigpio.SocketLock

public class SocketLock
extends java.lang.Object
Created by Jozef on 19.04.2016.
  • Constructor Summary

    Constructors 
    Constructor Description
    SocketLock​(java.lang.String host, int port)  
  • Method Summary

    Modifier and Type Method Description
    void readBytes​(byte[] data)
    Read all remaining bytes coming from pigpiod
    void reconnect()  
    int sendCmd​(int cmd, int p1, int p2)  
    int sendCmd​(int cmd, int p1, int p2, int p3, byte[] ext)
    Send extended command to pigpiod and return result code
    void terminate()  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SocketLock

      public SocketLock​(java.lang.String host, int port) throws java.io.IOException
      Throws:
      java.io.IOException
  • Method Details

    • reconnect

      public void reconnect() throws java.io.IOException
      Throws:
      java.io.IOException
    • terminate

      public void terminate() throws java.io.IOException
      Throws:
      java.io.IOException
    • sendCmd

      public int sendCmd​(int cmd, int p1, int p2) throws java.io.IOException
      Throws:
      java.io.IOException
    • sendCmd

      public int sendCmd​(int cmd, int p1, int p2, int p3, byte[] ext) throws java.io.IOException
      Send extended command to pigpiod and return result code
      Parameters:
      cmd - Command to send
      p1 - Command parameter 1
      p2 - Command parameter 2
      p3 - Command parameter 3 (usually length of extended data - see paramater ext)
      ext - Array of bytes containing extended data
      Returns:
      Command result code
      Throws:
      java.io.IOException - in case of network connection error
    • readBytes

      public void readBytes​(byte[] data) throws java.io.IOException
      Read all remaining bytes coming from pigpiod
      Parameters:
      data - Array to store read bytes.
      Throws:
      java.io.IOException - if unbale to read from network