Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. public interface TcpConnection
  2. {
  3.  
  4. /**
  5. * Connected.
  6. *
  7. * @throws NGException the NG exception
  8. */
  9. public void connected() throws NGException;
  10.  
  11. /**
  12. * This method will send the received data from the InputStream of the connection.
  13. *
  14. * @param data the received data
  15. * @throws NGException the NG exception
  16. */
  17. public void received( byte[] data ) throws NGException;
  18.  
  19. /**
  20. * Usable for the protocol to send data to the device.
  21. *
  22. * @param data the data to send to the device ( Will be converted to byte[] with getBytes() )
  23. * @throws NGException the NG exception
  24. */
  25. public void send( String data ) throws NGException;
  26.  
  27. /**
  28. * Usable for the protocol to send data to the device.
  29. *
  30. * @param data the data to send to the device ( Will be send as is )
  31. * @throws NGException the NG exception
  32. */
  33. public void send( byte[] data ) throws NGException;
  34.  
  35. /**
  36. * This method will inform the protocol that the connection got closed.
  37. *
  38. * @throws PilotNGException the NG exception
  39. */
  40. public void closed() throws NGException;
  41. }
  42.  
  43. /** The callback. */
  44. private TcpConnection callback;
  45. private void disconnect()
  46. {
  47. connection.disconnect();
  48. if ( !getStatus( jndiName ).equals( ConnectionStatus.FAILURE ) )
  49. {
  50. setStatus( ConnectionStatus.CLOSED );
  51. }
  52. /* TODO: Tell driver connection is closed! */
  53. callback.closed();
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement