Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. %|
  2. | File: serial
  3. |
  4. | Provides access to physical serial ports, and USB to Serial adapters, allowing Neon
  5. | the ability to interface with many devices.
  6. |%
  7. EXPORT Port
  8.  
  9. TYPE Port IS POINTER
  10.  
  11. EXPORT InvalidPortException
  12. EXPORT ConnectionLostException
  13. EXPORT PortOpenException
  14. EXPORT PortInUseException
  15. EXPORT GetPortNamesException
  16.  
  17. EXPORT WritePortException
  18. EXPORT ReadPortException
  19. EXPORT GetPortSettingsException
  20. EXPORT SetPortSettingsException
  21. EXPORT SetCommLineException
  22.  
  23. %EXPORT PortError
  24.  
  25. EXPORT Parity
  26. EXPORT StopBits
  27. EXPORT DataBits
  28. EXPORT FlowControl
  29. EXPORT BaudRate
  30.  
  31. %|
  32. | Exception: InvalidPortException
  33. |
  34. | Indicates an invalid serial port was attempted to be opened.
  35. |%
  36. DECLARE EXCEPTION InvalidPortException
  37. %|
  38. | Exception: ConnectionLostException
  39. |
  40. | Indicates that a connection to a serial port has been disconnected
  41. | and any further calls to it will result in this exception.
  42. |%
  43. DECLARE EXCEPTION ConnectionLostException
  44. %|
  45. | Exception: PortOpenException
  46. |
  47. | Indicates that some kind of error occurred while attempting to
  48. | open the desired serial port.
  49. |%
  50. DECLARE EXCEPTION PortOpenException
  51. %|
  52. | Exception: PortInUseException
  53. |
  54. | Indicates that some other program had the port open at the time
  55. | <open> was called on this serial device.
  56. |%
  57. DECLARE EXCEPTION PortInUseException
  58. %|
  59. | Exception: GetPortNamesException
  60. |
  61. | Indicates an error occurred while attempting to gather up the
  62. | available port names.
  63. |%
  64.  
  65. DECLARE EXCEPTION PortNotOpenedException
  66.  
  67. DECLARE EXCEPTION GetPortNamesException
  68.  
  69. DECLARE EXCEPTION WritePortException
  70.  
  71. DECLARE EXCEPTION ReadPortException
  72.  
  73. DECLARE EXCEPTION GetPortSettingsException
  74.  
  75. DECLARE EXCEPTION SetPortSettingsException
  76.  
  77. DECLARE EXCEPTION SetPortTimeoutsException
  78.  
  79. DECLARE EXCEPTION UnsupportedBaudRateException
  80.  
  81. DECLARE EXCEPTION SetCommLineException
  82.  
  83.  
  84.  
  85. TYPE Parity IS ENUM
  86. None
  87. Odd
  88. Even
  89. Mark
  90. Space
  91. END ENUM
  92.  
  93. TYPE StopBits IS ENUM
  94. One
  95. OnePointFive
  96. Two
  97. END ENUM
  98.  
  99. TYPE DataBits IS ENUM
  100. Five
  101. Six
  102. Seven
  103. Eight
  104. END ENUM
  105.  
  106. TYPE FlowControl IS ENUM
  107. Disable
  108. Enable
  109. Handshake
  110. DSR_DTR
  111. RTS_CTS
  112. Toggle
  113. END ENUM
  114.  
  115. TYPE BaudRate IS ENUM
  116. 110BPS
  117. 300BPS
  118. 600BPS
  119. 1200BPS
  120. 2400BPS
  121. 4800BPS
  122. 9600BPS
  123. 14400BPS
  124. 19200BPS
  125. 38400BPS
  126. 57600BPS
  127. 115200BPS
  128. 230400BPS
  129. 460800BPS
  130. 921600BPS
  131. END ENUM
  132.  
  133.  
  134. DECLARE NATIVE FUNCTION getPortNames(): Array<String>
  135.  
  136. DECLARE NATIVE FUNCTION isCarrierDetect(p: Port): Boolean
  137. DECLARE NATIVE FUNCTION isRingIndicator(p: Port): Boolean
  138. DECLARE NATIVE FUNCTION isClearToSend(p: Port): Boolean
  139. DECLARE NATIVE FUNCTION isDataTerminalReady(p: Port): Boolean
  140. DECLARE NATIVE FUNCTION isReadyToSend(p: Port): Boolean
  141.  
  142. DECLARE NATIVE FUNCTION setDataTerminalReadyLine(p: Port, signal: Boolean)
  143.  
  144. DECLARE NATIVE FUNCTION open(name: String, baud: Number, softwareFlowControl: FlowControl, hardwareFlowControl: FlowControl): Port
  145. DECLARE NATIVE FUNCTION configurePort(baud: Number, parity: Parity, stopbits: StopBits, databits: DataBits, softwareFlowControl: FlowControl, xonChar, xoffChar: String, hardwareFlowControl: FlowControl)
  146. DECLARE NATIVE FUNCTION settimeouts(readTimeout, writeTimeout: Number)
  147. DECLARE NATIVE FUNCTION read(p: Port): Bytes
  148. DECLARE NATIVE FUNCTION readString(p: Port, count: Number): String
  149. DECLARE NATIVE FUNCTION write(p: Port, s: String): Boolean
  150. DECLARE NATIVE FUNCTION writeString(p: Port, s: String): Boolean
  151. DECLARE NATIVE FUNCTION close(INOUT p: Port)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement