openc3-cosmos-tool-docs 5.16.1 → 5.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/tools/staticdocs/404.html +5 -5
  3. data/tools/staticdocs/assets/css/styles.8a0f1b26.css +1 -0
  4. data/tools/staticdocs/assets/js/{019369f3.3a124fd7.js → 019369f3.34291acc.js} +1 -1
  5. data/tools/staticdocs/assets/js/{058ffc22.c85ad785.js → 058ffc22.8d9049f4.js} +1 -1
  6. data/tools/staticdocs/assets/js/{0686a885.4d6b8154.js → 0686a885.dde7b18b.js} +1 -1
  7. data/tools/staticdocs/assets/js/{078dbab0.45ea4593.js → 078dbab0.b275e04c.js} +1 -1
  8. data/tools/staticdocs/assets/js/{0f5d161c.dda04dbb.js → 0f5d161c.ca02c5b2.js} +1 -1
  9. data/tools/staticdocs/assets/js/{0ff569c9.317b47d0.js → 0ff569c9.ad025a56.js} +1 -1
  10. data/tools/staticdocs/assets/js/103cc3be.6b6cd0fa.js +1 -0
  11. data/tools/staticdocs/assets/js/{13196248.d8f8ef9f.js → 13196248.9e7794e3.js} +1 -1
  12. data/tools/staticdocs/assets/js/13c1b4e4.cec67b9c.js +1 -0
  13. data/tools/staticdocs/assets/js/1e02e6a3.e6ef8665.js +1 -0
  14. data/tools/staticdocs/assets/js/{2047b354.75fe47dd.js → 2047b354.bdd2586a.js} +1 -1
  15. data/tools/staticdocs/assets/js/{22b3ac48.299bf4d6.js → 22b3ac48.0f4fbe9d.js} +1 -1
  16. data/tools/staticdocs/assets/js/{2bb7bf90.c642620c.js → 2bb7bf90.043455de.js} +1 -1
  17. data/tools/staticdocs/assets/js/{3dd7ef3b.f84c6956.js → 3dd7ef3b.c7c1d93f.js} +1 -1
  18. data/tools/staticdocs/assets/js/{40365d27.c318f801.js → 40365d27.7eb3f7b1.js} +1 -1
  19. data/tools/staticdocs/assets/js/{411898ad.f103f64b.js → 411898ad.d5f62a27.js} +1 -1
  20. data/tools/staticdocs/assets/js/{42170351.15f2f1e3.js → 42170351.69a8ed02.js} +1 -1
  21. data/tools/staticdocs/assets/js/{43652efd.4e7d6a97.js → 43652efd.be2c1d02.js} +1 -1
  22. data/tools/staticdocs/assets/js/4650.292aca67.js +1 -0
  23. data/tools/staticdocs/assets/js/{54d0d530.769f5473.js → 54d0d530.28ba5be7.js} +1 -1
  24. data/tools/staticdocs/assets/js/5b233ba7.9c621552.js +1 -0
  25. data/tools/staticdocs/assets/js/{5bc719f6.84f6ce9e.js → 5bc719f6.7fa17221.js} +1 -1
  26. data/tools/staticdocs/assets/js/{5c6ce5ec.8667906a.js → 5c6ce5ec.5e6ca46b.js} +1 -1
  27. data/tools/staticdocs/assets/js/5e3ed378.77db7b87.js +1 -0
  28. data/tools/staticdocs/assets/js/{5fe211ef.1d991947.js → 5fe211ef.71dc8326.js} +1 -1
  29. data/tools/staticdocs/assets/js/62df909c.906d9999.js +1 -0
  30. data/tools/staticdocs/assets/js/630e5448.6fea087c.js +1 -0
  31. data/tools/staticdocs/assets/js/{6831b732.bbf2813b.js → 6831b732.5714d508.js} +1 -1
  32. data/tools/staticdocs/assets/js/696b4199.0335bd94.js +1 -0
  33. data/tools/staticdocs/assets/js/{6b210247.074332a1.js → 6b210247.2cbd59e6.js} +1 -1
  34. data/tools/staticdocs/assets/js/{6b65133b.109a6bef.js → 6b65133b.87dc7da6.js} +1 -1
  35. data/tools/staticdocs/assets/js/6f92e431.300a9857.js +1 -0
  36. data/tools/staticdocs/assets/js/{72c6d8a8.5fca8d68.js → 72c6d8a8.cfccace6.js} +1 -1
  37. data/tools/staticdocs/assets/js/{2923e883.ed90d0a7.js → 75897369.7b31b03e.js} +1 -1
  38. data/tools/staticdocs/assets/js/75e64983.932fbc0e.js +1 -0
  39. data/tools/staticdocs/assets/js/7f5b2696.60735273.js +1 -0
  40. data/tools/staticdocs/assets/js/{867640d5.a8f59357.js → 867640d5.ffd4cf4c.js} +1 -1
  41. data/tools/staticdocs/assets/js/89e76475.97389cc5.js +1 -0
  42. data/tools/staticdocs/assets/js/{8f7843ee.0f25fdc3.js → 8f7843ee.d1ffd5ee.js} +1 -1
  43. data/tools/staticdocs/assets/js/9424f0b3.29299bde.js +1 -0
  44. data/tools/staticdocs/assets/js/{97535711.ddc0f5af.js → 97535711.fc45ced1.js} +1 -1
  45. data/tools/staticdocs/assets/js/{99581c43.0767018a.js → 99581c43.8e571df8.js} +1 -1
  46. data/tools/staticdocs/assets/js/{9fb6059a.30085d79.js → 9fb6059a.42881e94.js} +1 -1
  47. data/tools/staticdocs/assets/js/a507c363.04b98d2c.js +1 -0
  48. data/tools/staticdocs/assets/js/{a677c089.48b6c791.js → a677c089.b2928bac.js} +1 -1
  49. data/tools/staticdocs/assets/js/{a9987364.cfb3492e.js → a9987364.8f065f19.js} +1 -1
  50. data/tools/staticdocs/assets/js/{aa6b6c1b.a13cb467.js → aa6b6c1b.d78e5212.js} +1 -1
  51. data/tools/staticdocs/assets/js/{b4596165.b4c6c1b8.js → b4596165.6806d46b.js} +1 -1
  52. data/tools/staticdocs/assets/js/b6d70f94.f5514e8b.js +1 -0
  53. data/tools/staticdocs/assets/js/{b9f60ba6.655a4097.js → b9f60ba6.c3b3046d.js} +1 -1
  54. data/tools/staticdocs/assets/js/{bd0034eb.ff7f6265.js → bd0034eb.b4e3d6c1.js} +1 -1
  55. data/tools/staticdocs/assets/js/{c24eae19.98857ebf.js → c24eae19.6b084c7c.js} +1 -1
  56. data/tools/staticdocs/assets/js/c2598f55.c5a1bac3.js +1 -0
  57. data/tools/staticdocs/assets/js/{d797a795.5725bf2b.js → c5388ca4.f526bb0c.js} +1 -1
  58. data/tools/staticdocs/assets/js/{cb8c3f08.f669adda.js → cb8c3f08.a0ef4b5f.js} +1 -1
  59. data/tools/staticdocs/assets/js/{cd879be4.6ee752c7.js → cd879be4.6f19050a.js} +1 -1
  60. data/tools/staticdocs/assets/js/ce89ef36.aa518a52.js +1 -0
  61. data/tools/staticdocs/assets/js/d1b923aa.3f3e186d.js +1 -0
  62. data/tools/staticdocs/assets/js/d1bfc316.2d823a88.js +1 -0
  63. data/tools/staticdocs/assets/js/{d24bf9b6.31d82456.js → d24bf9b6.53eca5e8.js} +1 -1
  64. data/tools/staticdocs/assets/js/{d57a4b5d.905988ec.js → d57a4b5d.aaa48891.js} +1 -1
  65. data/tools/staticdocs/assets/js/d5d77c37.be6fe7b6.js +1 -0
  66. data/tools/staticdocs/assets/js/{d8ca4191.56c22a69.js → d8ca4191.c6632184.js} +1 -1
  67. data/tools/staticdocs/assets/js/{d9b92eba.16d983a0.js → d9b92eba.c6a2c7e5.js} +1 -1
  68. data/tools/staticdocs/assets/js/{db8fa1d0.c35b153c.js → db8fa1d0.f078bc02.js} +1 -1
  69. data/tools/staticdocs/assets/js/dc5f7beb.a4afe7cd.js +1 -0
  70. data/tools/staticdocs/assets/js/dfbae5fd.d1484e14.js +1 -0
  71. data/tools/staticdocs/assets/js/{e501b0d1.3aa571ae.js → e501b0d1.d108a8a9.js} +1 -1
  72. data/tools/staticdocs/assets/js/{ebec1ccb.a801549e.js → ebec1ccb.1ded1149.js} +1 -1
  73. data/tools/staticdocs/assets/js/{f15615f1.0a240e68.js → f15615f1.f9b655a6.js} +1 -1
  74. data/tools/staticdocs/assets/js/fd886806.a21dd400.js +1 -0
  75. data/tools/staticdocs/assets/js/main.67ed58e2.js +2 -0
  76. data/tools/staticdocs/assets/js/runtime~main.2bb31799.js +1 -0
  77. data/tools/staticdocs/docs/configuration/command.html +7 -7
  78. data/tools/staticdocs/docs/configuration/format.html +6 -6
  79. data/tools/staticdocs/docs/configuration/interfaces.html +6 -6
  80. data/tools/staticdocs/docs/configuration/plugins.html +6 -6
  81. data/tools/staticdocs/docs/configuration/protocols.html +6 -6
  82. data/tools/staticdocs/docs/configuration/ssl-tls.html +6 -6
  83. data/tools/staticdocs/docs/configuration/table.html +6 -6
  84. data/tools/staticdocs/docs/configuration/target.html +6 -6
  85. data/tools/staticdocs/docs/configuration/telemetry-screens.html +19 -6
  86. data/tools/staticdocs/docs/configuration/telemetry.html +6 -6
  87. data/tools/staticdocs/docs/configuration.html +5 -5
  88. data/tools/staticdocs/docs/development/curl.html +6 -6
  89. data/tools/staticdocs/docs/development/developing.html +6 -6
  90. data/tools/staticdocs/docs/development/host-install.html +6 -6
  91. data/tools/staticdocs/docs/development/json-api.html +6 -6
  92. data/tools/staticdocs/docs/development/log-structure.html +6 -6
  93. data/tools/staticdocs/docs/development/roadmap.html +6 -6
  94. data/tools/staticdocs/docs/development/streaming-api.html +6 -6
  95. data/tools/staticdocs/docs/development/testing.html +6 -6
  96. data/tools/staticdocs/docs/development.html +5 -5
  97. data/tools/staticdocs/docs/getting-started/generators.html +6 -6
  98. data/tools/staticdocs/docs/getting-started/gettingstarted.html +6 -6
  99. data/tools/staticdocs/docs/getting-started/installation.html +7 -7
  100. data/tools/staticdocs/docs/getting-started/key_concepts.html +6 -6
  101. data/tools/staticdocs/docs/getting-started/podman.html +6 -6
  102. data/tools/staticdocs/docs/getting-started/requirements.html +6 -6
  103. data/tools/staticdocs/docs/getting-started/upgrading.html +6 -6
  104. data/tools/staticdocs/docs/getting-started.html +5 -5
  105. data/tools/staticdocs/docs/guides/bridges.html +6 -6
  106. data/tools/staticdocs/docs/guides/cfs.html +6 -6
  107. data/tools/staticdocs/docs/guides/custom-widgets.html +6 -6
  108. data/tools/staticdocs/docs/guides/little-endian-bitfields.html +6 -6
  109. data/tools/staticdocs/docs/guides/local-mode.html +6 -6
  110. data/tools/staticdocs/docs/guides/logging.html +6 -6
  111. data/tools/staticdocs/docs/guides/monitoring.html +6 -6
  112. data/tools/staticdocs/docs/guides/performance.html +7 -6
  113. data/tools/staticdocs/docs/guides/raspberrypi.html +6 -6
  114. data/tools/staticdocs/docs/guides/script-writing.html +19 -16
  115. data/tools/staticdocs/docs/guides/scripting-api.html +6 -6
  116. data/tools/staticdocs/docs/guides.html +5 -5
  117. data/tools/staticdocs/docs/meta/contributing.html +6 -6
  118. data/tools/staticdocs/docs/meta/licenses.html +6 -6
  119. data/tools/staticdocs/docs/meta/philosophy.html +6 -6
  120. data/tools/staticdocs/docs/meta/xtce.html +6 -6
  121. data/tools/staticdocs/docs/meta.html +5 -5
  122. data/tools/staticdocs/docs/privacy.html +6 -6
  123. data/tools/staticdocs/docs/tools/autonomic.html +6 -6
  124. data/tools/staticdocs/docs/tools/bucket-explorer.html +6 -6
  125. data/tools/staticdocs/docs/tools/calendar.html +6 -6
  126. data/tools/staticdocs/docs/tools/cmd-sender.html +6 -6
  127. data/tools/staticdocs/docs/tools/cmd-tlm-server.html +6 -6
  128. data/tools/staticdocs/docs/tools/data-extractor.html +6 -6
  129. data/tools/staticdocs/docs/tools/data-viewer.html +6 -6
  130. data/tools/staticdocs/docs/tools/handbooks.html +6 -6
  131. data/tools/staticdocs/docs/tools/limits-monitor.html +6 -6
  132. data/tools/staticdocs/docs/tools/packet-viewer.html +6 -6
  133. data/tools/staticdocs/docs/tools/script-runner.html +9 -9
  134. data/tools/staticdocs/docs/tools/table-manager.html +6 -6
  135. data/tools/staticdocs/docs/tools/tlm-grapher.html +6 -6
  136. data/tools/staticdocs/docs/tools/tlm-viewer.html +6 -6
  137. data/tools/staticdocs/docs/tools.html +5 -5
  138. data/tools/staticdocs/docs.html +6 -6
  139. data/tools/staticdocs/index.html +5 -5
  140. data/tools/staticdocs/lunr-index-1719382003776.json +1 -0
  141. data/tools/staticdocs/lunr-index.json +1 -1
  142. data/tools/staticdocs/markdown-page.html +5 -5
  143. data/tools/staticdocs/search-doc-1719382003776.json +1 -0
  144. data/tools/staticdocs/search-doc.json +1 -1
  145. metadata +79 -79
  146. data/tools/staticdocs/assets/css/styles.a9c55efa.css +0 -1
  147. data/tools/staticdocs/assets/js/07876b9c.b8d12431.js +0 -1
  148. data/tools/staticdocs/assets/js/103cc3be.a946540f.js +0 -1
  149. data/tools/staticdocs/assets/js/13c1b4e4.50ee3d02.js +0 -1
  150. data/tools/staticdocs/assets/js/1b2b4b61.2556cd65.js +0 -1
  151. data/tools/staticdocs/assets/js/3df159b4.ff98bfab.js +0 -1
  152. data/tools/staticdocs/assets/js/55cdbca5.695875ea.js +0 -1
  153. data/tools/staticdocs/assets/js/5b233ba7.0029b2f5.js +0 -1
  154. data/tools/staticdocs/assets/js/5e3ed378.91d6735f.js +0 -1
  155. data/tools/staticdocs/assets/js/64630c4f.a229ae1d.js +0 -1
  156. data/tools/staticdocs/assets/js/696b4199.2700ad91.js +0 -1
  157. data/tools/staticdocs/assets/js/6f92e431.67f5a7a4.js +0 -1
  158. data/tools/staticdocs/assets/js/75373ac0.6a0a4fa2.js +0 -1
  159. data/tools/staticdocs/assets/js/75e64983.e31793e1.js +0 -1
  160. data/tools/staticdocs/assets/js/7918.25ec42db.js +0 -1
  161. data/tools/staticdocs/assets/js/89e76475.de702714.js +0 -1
  162. data/tools/staticdocs/assets/js/9424f0b3.b24d0393.js +0 -1
  163. data/tools/staticdocs/assets/js/99b59eea.d4dd9989.js +0 -1
  164. data/tools/staticdocs/assets/js/a507c363.198e9246.js +0 -1
  165. data/tools/staticdocs/assets/js/b6d70f94.20a403bf.js +0 -1
  166. data/tools/staticdocs/assets/js/d1b923aa.e7ee188a.js +0 -1
  167. data/tools/staticdocs/assets/js/d1bfc316.963c2477.js +0 -1
  168. data/tools/staticdocs/assets/js/d5d77c37.80e1a28b.js +0 -1
  169. data/tools/staticdocs/assets/js/dc5f7beb.88b0f00b.js +0 -1
  170. data/tools/staticdocs/assets/js/fd886806.57eeb84b.js +0 -1
  171. data/tools/staticdocs/assets/js/main.1b0c8317.js +0 -2
  172. data/tools/staticdocs/assets/js/runtime~main.49989116.js +0 -1
  173. data/tools/staticdocs/lunr-index-1715219995308.json +0 -1
  174. data/tools/staticdocs/search-doc-1715219995308.json +0 -1
  175. /data/tools/staticdocs/assets/js/{main.1b0c8317.js.LICENSE.txt → main.67ed58e2.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkdocs_openc3_com=self.webpackChunkdocs_openc3_com||[]).push([[7452],{5917:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>a,contentTitle:()=>o,default:()=>h,frontMatter:()=>s,metadata:()=>c,toc:()=>d});var n=r(1085),i=r(1184);const s={sidebar_position:6,title:"Interfaces"},o=void 0,c={id:"configuration/interfaces",title:"Interfaces",description:"Interfaces are the connection to the external embedded systems called targets. Interfaces are defined by the top level INTERFACE keyword in the plugin.txt file.",source:"@site/docs/configuration/interfaces.md",sourceDirName:"configuration",slug:"/configuration/interfaces",permalink:"/tools/staticdocs/docs/configuration/interfaces",draft:!1,unlisted:!1,editUrl:"https://github.com/OpenC3/cosmos/tree/main/docs.openc3.com/docs/configuration/interfaces.md",tags:[],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,title:"Interfaces"},sidebar:"defaultSidebar",previous:{title:"Telemetry",permalink:"/tools/staticdocs/docs/configuration/telemetry"},next:{title:"Protocols",permalink:"/tools/staticdocs/docs/configuration/protocols"}},a={},d=[{value:"Provided Interfaces",id:"provided-interfaces",level:2},{value:"TCPIP Client Interface",id:"tcpip-client-interface",level:3},{value:"TCPIP Server Interface",id:"tcpip-server-interface",level:3},{value:"UDP Interface",id:"udp-interface",level:3},{value:"Serial Interface",id:"serial-interface",level:3},{value:"Streams",id:"streams",level:2},{value:"Protocols",id:"protocols",level:2}];function l(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.p,{children:["Interfaces are the connection to the external embedded systems called targets. Interfaces are defined by the top level ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-1",children:"INTERFACE"})," keyword in the plugin.txt file."]}),"\n",(0,n.jsxs)(t.p,{children:["Interface classes provide the code that COSMOS uses to receive real-time telemetry from targets and to send commands to targets. The interface that a target uses could be anything (TCP/IP, serial, GPIB, Firewire, etc.), therefore it is important that this is a customizable portion of any reusable Command and Telemetry System. Fortunately the most common form of interfaces are over TCP/IP sockets, and COSMOS provides interface solutions for these. This guide will discuss how to use these interface classes, and how to create your own. Note that in most cases you can extend interfaces with ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols",children:"Protocols"})," rather than implementing a new interface."]}),"\n",(0,n.jsx)(t.admonition,{title:"Interface and Routers Are Very Similar",type:"info",children:(0,n.jsx)(t.p,{children:"Note that Interfaces and Routers are very similar and share the same configuration parameters. Routers are simply Interfaces which route an existing Interface's telemetry data out to the connected target and routes the connected target's commands back to the original Interface's target."})}),"\n",(0,n.jsx)(t.p,{children:"Interfaces have the following methods that must be implemented:"}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"connect"})," - Open the socket or port or somehow establish the connection to the target. Note: This method may not block indefinitely. Be sure to call super() in your implementation."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"connected?"})," - Return true or false depending on the connection state. Note: This method should return immediately."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"disconnect"})," - Close the socket or port of somehow disconnect from the target. Note: This method may not block indefinitely. Be sure to call super() in your implementation."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"read_interface"})," - Lowest level read of data on the interface. Note: This method should block until data is available or the interface disconnects. On a clean disconnect it should return nil."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write_interface"})," - Lowest level write of data on the interface. Note: This method may not block indefinitely."]}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:"Interfaces also have the following methods that exist and have default implementations. They can be overridden if necessary but be sure to call super() to allow the default implementation to be executed."}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"read_interface_base"})," - This method should always be called from read_interface(). It updates interface specific variables that are displayed by CmdTLmServer including the bytes read count, the most recent raw data read, and it handles raw logging if enabled."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write_interface_base"})," - This method should always be called from write_interface(). It updates interface specific variables that are displayed by CmdTLmServer including the bytes written count, the most recent raw data written, and it handles raw logging if enabled."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"read"})," - Read the next packet from the interface. COSMOS implements this method to allow the Protocol system to operate on the data and the packet before it is returned."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write"})," - Send a packet to the interface. COSMOS implements this method to allow the Protocol system to operate on the packet and the data before it is sent."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write_raw"})," - Send a raw binary string of data to the target. COSMOS implements this method by basically calling write_interface with the raw data."]}),"\n"]}),"\n",(0,n.jsx)(t.admonition,{title:"Naming Conventions",type:"warning",children:(0,n.jsx)(t.p,{children:'When creating your own interfaces, in most cases they will be subclasses of one of the built-in interfaces described below. It is important to know that both the filename and class name of the interface files must match with correct capitalization or you will receive "class not found" errors when trying to load your new interface. For example, an interface file called labview_interface.rb must contain the class LabviewInterface. If the class was named, LabVIEWInterface, for example, COSMOS would not be able to find the class because of the unexpected capitalization.'})}),"\n",(0,n.jsx)(t.h2,{id:"provided-interfaces",children:"Provided Interfaces"}),"\n",(0,n.jsxs)(t.p,{children:["COSMOS provides the following interfaces for use: TCPIP Client, TCPIP Server, UDP, and Serial. The interface to use is defined by the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," and ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#router",children:"ROUTER"})," keywords."]}),"\n",(0,n.jsx)(t.h3,{id:"tcpip-client-interface",children:"TCPIP Client Interface"}),"\n",(0,n.jsx)(t.p,{children:"The TCPIP client interface connects to a TCPIP socket to send commands and receive telemetry. This interface is used for targets which open a socket and wait for a connection. This is the most common type of interface."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Host"}),(0,n.jsx)(t.td,{children:"Machine name to connect to"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Port"}),(0,n.jsx)(t.td,{children:"Port to write commands to (can be the same as read port). Pass nil / None to make the interface read only."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Port to read telemetry from (can be the same as write port). Pass nil / None to make the interface write only."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read. Pass nil / None to block on read."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Type"}),(0,n.jsx)(t.td,{children:"See Protocols."}),(0,n.jsx)(t.td,{children:"No"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Arguments"}),(0,n.jsx)(t.td,{children:"See Protocols for the arguments each stream protocol takes."}),(0,n.jsx)(t.td,{children:"No"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Python Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 None LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None FIXED 6 0 None true\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword."]}),"\n",(0,n.jsx)(t.h3,{id:"tcpip-server-interface",children:"TCPIP Server Interface"}),"\n",(0,n.jsx)(t.p,{children:"The TCPIP server interface creates a TCPIP server which listens for incoming connections and dynamically creates sockets which communicate with the target. This interface is used for targets which open a socket and try to connect to a server."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Port"}),(0,n.jsx)(t.td,{children:"Port to write commands to (can be the same as read port)"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Port to read telemetry from (can be the same as write port)"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read. Pass nil / None to block on read."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Type"}),(0,n.jsx)(t.td,{children:"See Protocols."}),(0,n.jsx)(t.td,{children:"No"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Arguments"}),(0,n.jsx)(t.td,{children:"See Protocols for the arguments each stream protocol takes."}),(0,n.jsx)(t.td,{children:"No"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8081 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 nil PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Python Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8081 10.0 None LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 None BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 None FIXED 6 0 None true\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 None PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword. Note, TcpipServerInterface processes the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#option",children:"OPTION"})," modifier."]}),"\n",(0,n.jsx)(t.h3,{id:"udp-interface",children:"UDP Interface"}),"\n",(0,n.jsx)(t.p,{children:"The UDP interface uses UDP packets to send and receive telemetry from the target."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"}),(0,n.jsx)(t.th,{children:"Default"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Host"}),(0,n.jsx)(t.td,{children:"Host name or IP address of the machine to send and receive data with"}),(0,n.jsx)(t.td,{children:"Yes"}),(0,n.jsx)(t.td,{})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Dest Port"}),(0,n.jsx)(t.td,{children:"Port on the remote machine to send commands to"}),(0,n.jsx)(t.td,{children:"Yes"}),(0,n.jsx)(t.td,{})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Port on the remote machine to read telemetry from"}),(0,n.jsx)(t.td,{children:"Yes"}),(0,n.jsx)(t.td,{})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Source Port"}),(0,n.jsx)(t.td,{children:"Port on the local machine to send commands from"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"nil (socket is not bound to an outgoing port)"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Interface Address"}),(0,n.jsx)(t.td,{children:"If the remote machine supports multicast the interface address is used to configure the outgoing multicast address"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"nil (not used)"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"TTL"}),(0,n.jsx)(t.td,{children:"Time to Live. The number of intermediate routers allowed before dropping the packet."}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"128 (Windows)"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"10.0"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"nil (block on read)"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Example:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME udp_interface.rb host.docker.internal 8080 8081 8082 nil 128 10.0 nil\n"})}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Python Example:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/udp_interface.py host.docker.internal 8080 8081 8082 None 128 10.0 None\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword."]}),"\n",(0,n.jsx)(t.h3,{id:"serial-interface",children:"Serial Interface"}),"\n",(0,n.jsx)(t.p,{children:"The serial interface connects to a target over a serial port. COSMOS provides drivers for both Windows and POSIX drivers for UNIX based systems. The Serial Interface is currently only implemented in Ruby."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Port"}),(0,n.jsx)(t.td,{children:"Name of the serial port to write, e.g. 'COM1' or '/dev/ttyS0'. Pass nil / None to disable writing."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Name of the serial port to read, e.g. 'COM1' or '/dev/ttyS0'. Pass nil / None to disable reading."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Baud Rate"}),(0,n.jsx)(t.td,{children:"Baud rate to read and write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Parity"}),(0,n.jsx)(t.td,{children:"Serial port parity. Must be 'NONE', 'EVEN', or 'ODD'."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Stop Bits"}),(0,n.jsx)(t.td,{children:"Number of stop bits, e.g. 1."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read. Pass nil / None to block on read."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Type"}),(0,n.jsx)(t.td,{children:"See Protocols."}),(0,n.jsx)(t.td,{children:"No"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Arguments"}),(0,n.jsx)(t.td,{children:"See Protocols for the arguments each stream protocol takes."}),(0,n.jsx)(t.td,{children:"No"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME serial_interface.rb COM1 COM1 9600 NONE 1 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME serial_interface.rb /dev/ttyS1 /dev/ttyS1 38400 ODD 1 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME serial_interface.rb COM2 COM2 19200 EVEN 1 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME serial_interface.rb COM4 COM4 115200 NONE 1 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME serial_interface.rb COM4 COM4 115200 NONE 1 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME serial_interface.rb /dev/ttyS0 /dev/ttyS0 57600 NONE 1 10.0 nil PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME serial_interface.rb COM4 COM4 115200 NONE 1 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword. Note, SerialInterface processes the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#option",children:"OPTION"})," modifier."]}),"\n",(0,n.jsx)(t.h2,{id:"streams",children:"Streams"}),"\n",(0,n.jsx)(t.p,{children:"Streams are low level classes that implement read, read_nonblock, write, connect, connected? and disconnect methods. The build-in Stream classes are SerialStream, TcpipSocketStream and TcpipClientStream and they are automatically used when creating a Serial Interface, TCP/IP Server Interface, or TCP/IP Client Interface."}),"\n",(0,n.jsx)(t.h2,{id:"protocols",children:"Protocols"}),"\n",(0,n.jsx)(t.p,{children:"Protocols define the behaviour of an Interface, including differentiating packet boundaries and modifying data as necessary. COSMOS defines the following built-in protocols which can be used with the above interfaces:"}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Name"}),(0,n.jsx)(t.th,{children:"Description"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#burst-protocol",children:"Burst"})}),(0,n.jsx)(t.td,{children:"Reads as much data as possible from the interface"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#fixed-protocol",children:"Fixed"})}),(0,n.jsx)(t.td,{children:"Processes fixed length packets with a known ID position"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#length-protocol",children:"Length"})}),(0,n.jsx)(t.td,{children:"Processes a length field at a fixed location and then reads the remainder of the data"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#terminated-protocol",children:"Terminated"})}),(0,n.jsx)(t.td,{children:"Delineates packets uses termination characters at the end of each packet"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#template-protocol",children:"Template"})}),(0,n.jsx)(t.td,{children:"Processes text based command / response data such as SCPI interfaces"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#preidentified-protocol",children:"Preidentified"})}),(0,n.jsx)(t.td,{children:"Internal COSMOS protocol used by COSMOS tools"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"These protocols are declared directly after the interface:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil PREIDENTIFIED 0xCAFEBABE\n"})}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None FIXED 6 0 None true\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 None LENGTH 0 16 0 1 BIG_ENDIAN 4\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None PREIDENTIFIED 0xCAFEBABE\n"})}),"\n",(0,n.jsx)(t.p,{children:"COSMOS also defines the following helper protocols:"}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Name"}),(0,n.jsx)(t.th,{children:"Description"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#crc-protocol",children:"CRC"})}),(0,n.jsx)(t.td,{children:"Adds CRCs to outgoing packets and verifies CRCs on incoming packets"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#ignore-packet-protocol",children:"Ignore"})}),(0,n.jsx)(t.td,{children:"Ignores the specified packet by dropping it"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"These protocols are declared after the INTERFACE:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil BURST 4 0xDEADBEEF\n TARGET TGT\n PROTOCOL WRITE CrcProtocol CRC # See the documentation for parameters\n"})}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 None BURST 4 0xDEADBEEF\n TARGET TGT\n PROTOCOL WRITE CrcProtocol CRC # See the documentation for parameters\n"})}),"\n",(0,n.jsx)(t.p,{children:"Note the first parameter after the PROTOCOL keyword is how to apply the protocol: READ, WRITE, or READ_WRITE. Read applies the protocol on incoming packets (telemetry) and write on outgoing packets (commands). The next parameter is the protocol filename or class name. All other parameters are protocol specific."}),"\n",(0,n.jsxs)(t.p,{children:["In addition, you can define your own protocols which are declared like the COSMOS helper protocols after your interface. See the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#custom-protocols",children:"Custom Protocols"})," documentation for more information."]}),"\n",(0,n.jsx)(t.admonition,{title:"Protocol Run Order",type:"info",children:(0,n.jsx)(t.p,{children:"Read protocols execute in the order specified (First specified runs first). Write protocols execute in the reverse order (Last specified executes first)."})})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},1184:(e,t,r)=>{r.d(t,{R:()=>o});var n=r(4041);const i={},s=n.createContext(i);function o(e){const t=n.useContext(s);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}}}]);
1
+ "use strict";(self.webpackChunkdocs_openc3_com=self.webpackChunkdocs_openc3_com||[]).push([[7452],{5703:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>a,contentTitle:()=>o,default:()=>h,frontMatter:()=>s,metadata:()=>c,toc:()=>d});var n=r(1085),i=r(1184);const s={sidebar_position:6,title:"Interfaces"},o=void 0,c={id:"configuration/interfaces",title:"Interfaces",description:"Interfaces are the connection to the external embedded systems called targets. Interfaces are defined by the top level INTERFACE keyword in the plugin.txt file.",source:"@site/docs/configuration/interfaces.md",sourceDirName:"configuration",slug:"/configuration/interfaces",permalink:"/tools/staticdocs/docs/configuration/interfaces",draft:!1,unlisted:!1,editUrl:"https://github.com/OpenC3/cosmos/tree/main/docs.openc3.com/docs/configuration/interfaces.md",tags:[],version:"current",sidebarPosition:6,frontMatter:{sidebar_position:6,title:"Interfaces"},sidebar:"defaultSidebar",previous:{title:"Telemetry",permalink:"/tools/staticdocs/docs/configuration/telemetry"},next:{title:"Protocols",permalink:"/tools/staticdocs/docs/configuration/protocols"}},a={},d=[{value:"Provided Interfaces",id:"provided-interfaces",level:2},{value:"TCPIP Client Interface",id:"tcpip-client-interface",level:3},{value:"TCPIP Server Interface",id:"tcpip-server-interface",level:3},{value:"UDP Interface",id:"udp-interface",level:3},{value:"Serial Interface",id:"serial-interface",level:3},{value:"Streams",id:"streams",level:2},{value:"Protocols",id:"protocols",level:2}];function l(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.p,{children:["Interfaces are the connection to the external embedded systems called targets. Interfaces are defined by the top level ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-1",children:"INTERFACE"})," keyword in the plugin.txt file."]}),"\n",(0,n.jsxs)(t.p,{children:["Interface classes provide the code that COSMOS uses to receive real-time telemetry from targets and to send commands to targets. The interface that a target uses could be anything (TCP/IP, serial, GPIB, Firewire, etc.), therefore it is important that this is a customizable portion of any reusable Command and Telemetry System. Fortunately the most common form of interfaces are over TCP/IP sockets, and COSMOS provides interface solutions for these. This guide will discuss how to use these interface classes, and how to create your own. Note that in most cases you can extend interfaces with ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols",children:"Protocols"})," rather than implementing a new interface."]}),"\n",(0,n.jsx)(t.admonition,{title:"Interface and Routers Are Very Similar",type:"info",children:(0,n.jsx)(t.p,{children:"Note that Interfaces and Routers are very similar and share the same configuration parameters. Routers are simply Interfaces which route an existing Interface's telemetry data out to the connected target and routes the connected target's commands back to the original Interface's target."})}),"\n",(0,n.jsx)(t.p,{children:"Interfaces have the following methods that must be implemented:"}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"connect"})," - Open the socket or port or somehow establish the connection to the target. Note: This method may not block indefinitely. Be sure to call super() in your implementation."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"connected?"})," - Return true or false depending on the connection state. Note: This method should return immediately."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"disconnect"})," - Close the socket or port of somehow disconnect from the target. Note: This method may not block indefinitely. Be sure to call super() in your implementation."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"read_interface"})," - Lowest level read of data on the interface. Note: This method should block until data is available or the interface disconnects. On a clean disconnect it should return nil."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write_interface"})," - Lowest level write of data on the interface. Note: This method may not block indefinitely."]}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:"Interfaces also have the following methods that exist and have default implementations. They can be overridden if necessary but be sure to call super() to allow the default implementation to be executed."}),"\n",(0,n.jsxs)(t.ol,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"read_interface_base"})," - This method should always be called from read_interface(). It updates interface specific variables that are displayed by CmdTLmServer including the bytes read count, the most recent raw data read, and it handles raw logging if enabled."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write_interface_base"})," - This method should always be called from write_interface(). It updates interface specific variables that are displayed by CmdTLmServer including the bytes written count, the most recent raw data written, and it handles raw logging if enabled."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"read"})," - Read the next packet from the interface. COSMOS implements this method to allow the Protocol system to operate on the data and the packet before it is returned."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write"})," - Send a packet to the interface. COSMOS implements this method to allow the Protocol system to operate on the packet and the data before it is sent."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.strong,{children:"write_raw"})," - Send a raw binary string of data to the target. COSMOS implements this method by basically calling write_interface with the raw data."]}),"\n"]}),"\n",(0,n.jsx)(t.admonition,{title:"Naming Conventions",type:"warning",children:(0,n.jsx)(t.p,{children:'When creating your own interfaces, in most cases they will be subclasses of one of the built-in interfaces described below. It is important to know that both the filename and class name of the interface files must match with correct capitalization or you will receive "class not found" errors when trying to load your new interface. For example, an interface file called labview_interface.rb must contain the class LabviewInterface. If the class was named, LabVIEWInterface, for example, COSMOS would not be able to find the class because of the unexpected capitalization.'})}),"\n",(0,n.jsx)(t.h2,{id:"provided-interfaces",children:"Provided Interfaces"}),"\n",(0,n.jsxs)(t.p,{children:["COSMOS provides the following interfaces for use: TCPIP Client, TCPIP Server, UDP, and Serial. The interface to use is defined by the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," and ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#router",children:"ROUTER"})," keywords."]}),"\n",(0,n.jsx)(t.h3,{id:"tcpip-client-interface",children:"TCPIP Client Interface"}),"\n",(0,n.jsx)(t.p,{children:"The TCPIP client interface connects to a TCPIP socket to send commands and receive telemetry. This interface is used for targets which open a socket and wait for a connection. This is the most common type of interface."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Host"}),(0,n.jsx)(t.td,{children:"Machine name to connect to"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Port"}),(0,n.jsx)(t.td,{children:"Port to write commands to (can be the same as read port). Pass nil / None to make the interface read only."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Port to read telemetry from (can be the same as write port). Pass nil / None to make the interface write only."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read. Pass nil / None to block on read."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Type"}),(0,n.jsx)(t.td,{children:"See Protocols."}),(0,n.jsx)(t.td,{children:"No"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Arguments"}),(0,n.jsx)(t.td,{children:"See Protocols for the arguments each stream protocol takes."}),(0,n.jsx)(t.td,{children:"No"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Python Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 None LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None FIXED 6 0 None true\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword."]}),"\n",(0,n.jsx)(t.h3,{id:"tcpip-server-interface",children:"TCPIP Server Interface"}),"\n",(0,n.jsx)(t.p,{children:"The TCPIP server interface creates a TCPIP server which listens for incoming connections and dynamically creates sockets which communicate with the target. This interface is used for targets which open a socket and try to connect to a server."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Port"}),(0,n.jsx)(t.td,{children:"Port to write commands to (can be the same as read port)"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Port to read telemetry from (can be the same as write port)"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read. Pass nil / None to block on read."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Type"}),(0,n.jsx)(t.td,{children:"See Protocols."}),(0,n.jsx)(t.td,{children:"No"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Arguments"}),(0,n.jsx)(t.td,{children:"See Protocols for the arguments each stream protocol takes."}),(0,n.jsx)(t.td,{children:"No"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8081 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME tcpip_server_interface.rb 8080 8080 10.0 nil PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Python Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8081 10.0 None LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 None BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 None FIXED 6 0 None true\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_server_interface.py 8080 8080 10.0 None PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py 8080 8080 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword. Note, TcpipServerInterface processes the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#option",children:"OPTION"})," modifier."]}),"\n",(0,n.jsx)(t.h3,{id:"udp-interface",children:"UDP Interface"}),"\n",(0,n.jsx)(t.p,{children:"The UDP interface uses UDP packets to send and receive telemetry from the target."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"}),(0,n.jsx)(t.th,{children:"Default"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Host"}),(0,n.jsx)(t.td,{children:"Host name or IP address of the machine to send and receive data with"}),(0,n.jsx)(t.td,{children:"Yes"}),(0,n.jsx)(t.td,{})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Dest Port"}),(0,n.jsx)(t.td,{children:"Port on the remote machine to send commands to"}),(0,n.jsx)(t.td,{children:"Yes"}),(0,n.jsx)(t.td,{})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Port on the remote machine to read telemetry from"}),(0,n.jsx)(t.td,{children:"Yes"}),(0,n.jsx)(t.td,{})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Source Port"}),(0,n.jsx)(t.td,{children:"Port on the local machine to send commands from"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"nil (socket is not bound to an outgoing port)"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Interface Address"}),(0,n.jsx)(t.td,{children:"If the remote machine supports multicast the interface address is used to configure the outgoing multicast address"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"nil (not used)"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"TTL"}),(0,n.jsx)(t.td,{children:"Time to Live. The number of intermediate routers allowed before dropping the packet."}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"128 (Windows)"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"10.0"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read"}),(0,n.jsx)(t.td,{children:"No"}),(0,n.jsx)(t.td,{children:"nil (block on read)"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Example:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME udp_interface.rb host.docker.internal 8080 8081 8082 nil 128 10.0 nil\n"})}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Python Example:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/udp_interface.py host.docker.internal 8080 8081 8082 None 128 10.0 None\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword."]}),"\n",(0,n.jsx)(t.h3,{id:"serial-interface",children:"Serial Interface"}),"\n",(0,n.jsx)(t.p,{children:"The serial interface connects to a target over a serial port. COSMOS provides drivers for both Windows and POSIX drivers for UNIX based systems. The Serial Interface is currently only implemented in Ruby."}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Parameter"}),(0,n.jsx)(t.th,{children:"Description"}),(0,n.jsx)(t.th,{children:"Required"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Port"}),(0,n.jsx)(t.td,{children:"Name of the serial port to write, e.g. 'COM1' or '/dev/ttyS0'. Pass nil / None to disable writing."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Port"}),(0,n.jsx)(t.td,{children:"Name of the serial port to read, e.g. 'COM1' or '/dev/ttyS0'. Pass nil / None to disable reading."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Baud Rate"}),(0,n.jsx)(t.td,{children:"Baud rate to read and write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Parity"}),(0,n.jsx)(t.td,{children:"Serial port parity. Must be 'NONE', 'EVEN', or 'ODD'."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Stop Bits"}),(0,n.jsx)(t.td,{children:"Number of stop bits, e.g. 1."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Write Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the write"}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Read Timeout"}),(0,n.jsx)(t.td,{children:"Number of seconds to wait before aborting the read. Pass nil / None to block on read."}),(0,n.jsx)(t.td,{children:"Yes"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Type"}),(0,n.jsx)(t.td,{children:"See Protocols."}),(0,n.jsx)(t.td,{children:"No"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:"Protocol Arguments"}),(0,n.jsx)(t.td,{children:"See Protocols for the arguments each stream protocol takes."}),(0,n.jsx)(t.td,{children:"No"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"plugin.txt Ruby Examples:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME serial_interface.rb COM1 COM1 9600 NONE 1 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11\nINTERFACE INTERFACE_NAME serial_interface.rb /dev/ttyS1 /dev/ttyS1 38400 ODD 1 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME serial_interface.rb COM2 COM2 19200 EVEN 1 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME serial_interface.rb COM4 COM4 115200 NONE 1 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME serial_interface.rb COM4 COM4 115200 NONE 1 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME serial_interface.rb /dev/ttyS0 /dev/ttyS0 57600 NONE 1 10.0 nil PREIDENTIFIED 0xCAFEBABE\nINTERFACE INTERFACE_NAME serial_interface.rb COM4 COM4 115200 NONE 1 10.0 10.0 # no built-in protocol\n"})}),"\n",(0,n.jsxs)(t.p,{children:["See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface",children:"INTERFACE"})," for a description of the INTERFACE keyword. See ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#interface-modifiers",children:"Interface Modifiers"})," for a description of the keywords which can follow the INTERFACE keyword. Note, SerialInterface processes the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#option",children:"OPTION"})," modifier."]}),"\n",(0,n.jsx)(t.h2,{id:"streams",children:"Streams"}),"\n",(0,n.jsx)(t.p,{children:"Streams are low level classes that implement read, read_nonblock, write, connect, connected? and disconnect methods. The build-in Stream classes are SerialStream, TcpipSocketStream and TcpipClientStream and they are automatically used when creating a Serial Interface, TCP/IP Server Interface, or TCP/IP Client Interface."}),"\n",(0,n.jsx)(t.h2,{id:"protocols",children:"Protocols"}),"\n",(0,n.jsx)(t.p,{children:"Protocols define the behaviour of an Interface, including differentiating packet boundaries and modifying data as necessary. COSMOS defines the following built-in protocols which can be used with the above interfaces:"}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Name"}),(0,n.jsx)(t.th,{children:"Description"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#burst-protocol",children:"Burst"})}),(0,n.jsx)(t.td,{children:"Reads as much data as possible from the interface"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#fixed-protocol",children:"Fixed"})}),(0,n.jsx)(t.td,{children:"Processes fixed length packets with a known ID position"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#length-protocol",children:"Length"})}),(0,n.jsx)(t.td,{children:"Processes a length field at a fixed location and then reads the remainder of the data"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#terminated-protocol",children:"Terminated"})}),(0,n.jsx)(t.td,{children:"Delineates packets uses termination characters at the end of each packet"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#template-protocol",children:"Template"})}),(0,n.jsx)(t.td,{children:"Processes text based command / response data such as SCPI interfaces"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#preidentified-protocol",children:"Preidentified"})}),(0,n.jsx)(t.td,{children:"Internal COSMOS protocol used by COSMOS tools"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"These protocols are declared directly after the interface:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil FIXED 6 0 nil true\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil LENGTH 0 16 0 1 BIG_ENDIAN 4\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil PREIDENTIFIED 0xCAFEBABE\n"})}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None BURST 4 0xDEADBEEF\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None FIXED 6 0 None true\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 None LENGTH 0 16 0 1 BIG_ENDIAN 4\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TERMINATED 0x0D0A 0x0D0A true 0 0xF005BA11\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 10.0 TEMPLATE 0xA 0xA\nINTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8080 10.0 None PREIDENTIFIED 0xCAFEBABE\n"})}),"\n",(0,n.jsx)(t.p,{children:"COSMOS also defines the following helper protocols:"}),"\n",(0,n.jsxs)(t.table,{children:[(0,n.jsx)(t.thead,{children:(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.th,{children:"Name"}),(0,n.jsx)(t.th,{children:"Description"})]})}),(0,n.jsxs)(t.tbody,{children:[(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#crc-protocol",children:"CRC"})}),(0,n.jsx)(t.td,{children:"Adds CRCs to outgoing packets and verifies CRCs on incoming packets"})]}),(0,n.jsxs)(t.tr,{children:[(0,n.jsx)(t.td,{children:(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#ignore-packet-protocol",children:"Ignore"})}),(0,n.jsx)(t.td,{children:"Ignores the specified packet by dropping it"})]})]})]}),"\n",(0,n.jsx)(t.p,{children:"These protocols are declared after the INTERFACE:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 nil BURST 4 0xDEADBEEF\n TARGET TGT\n PROTOCOL WRITE CrcProtocol CRC # See the documentation for parameters\n"})}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-ruby",children:"INTERFACE INTERFACE_NAME openc3/interfaces/tcpip_client_interface.rb host.docker.internal 8080 8080 10.0 None BURST 4 0xDEADBEEF\n TARGET TGT\n PROTOCOL WRITE CrcProtocol CRC # See the documentation for parameters\n"})}),"\n",(0,n.jsx)(t.p,{children:"Note the first parameter after the PROTOCOL keyword is how to apply the protocol: READ, WRITE, or READ_WRITE. Read applies the protocol on incoming packets (telemetry) and write on outgoing packets (commands). The next parameter is the protocol filename or class name. All other parameters are protocol specific."}),"\n",(0,n.jsxs)(t.p,{children:["In addition, you can define your own protocols which are declared like the COSMOS helper protocols after your interface. See the ",(0,n.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#custom-protocols",children:"Custom Protocols"})," documentation for more information."]}),"\n",(0,n.jsx)(t.admonition,{title:"Protocol Run Order",type:"info",children:(0,n.jsx)(t.p,{children:"Read protocols execute in the order specified (First specified runs first). Write protocols execute in the reverse order (Last specified executes first)."})})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},1184:(e,t,r)=>{r.d(t,{R:()=>o});var n=r(4041);const i={},s=n.createContext(i);function o(e){const t=n.useContext(s);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkdocs_openc3_com=self.webpackChunkdocs_openc3_com||[]).push([[6830],{8934:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>c});var i=n(1085),o=n(1184);const a={sidebar_position:2,title:"Getting Started"},s=void 0,r={id:"getting-started/gettingstarted",title:"Getting Started",description:"Welcome to the OpenC3 COSMOS system... Let's get started! This guide is a high level overview that will help with setting up your first COSMOS project.",source:"@site/docs/getting-started/gettingstarted.md",sourceDirName:"getting-started",slug:"/getting-started/gettingstarted",permalink:"/tools/staticdocs/docs/getting-started/gettingstarted",draft:!1,unlisted:!1,editUrl:"https://github.com/OpenC3/cosmos/tree/main/docs.openc3.com/docs/getting-started/gettingstarted.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"Getting Started"},sidebar:"defaultSidebar",previous:{title:"Installation",permalink:"/tools/staticdocs/docs/getting-started/installation"},next:{title:"Code Generators",permalink:"/tools/staticdocs/docs/getting-started/generators"}},l={},c=[{value:"Interfacing with Your Hardware",id:"interfacing-with-your-hardware",level:2},{value:"Building Your Plugin",id:"building-your-plugin",level:2}];function d(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"Welcome to the OpenC3 COSMOS system... Let's get started! This guide is a high level overview that will help with setting up your first COSMOS project."}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["Get COSMOS Installed onto your computer by following the ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/getting-started/installation",children:"Installation Guide"}),".","\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"You should now have COSMOS installed and a Demo project available that we can make changes to."}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["Browse to ",(0,i.jsx)(t.a,{href:"http://localhost:2900",children:"http://localhost:2900"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:'The COSMOS Command and Telemetry Server will appear. This tool provides real-time information about each "target" in the system. Targets are external systems that receive commands and generate telemetry, often over ethernet or serial connections.'}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["Experiment with other COSMOS tools. This is a DEMO environment so you can't break anything. Some things to try:","\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Use Command Sender to send individual commands."}),"\n",(0,i.jsx)(t.li,{children:"Use Limits Monitor to watch for telemetry limits violations"}),"\n",(0,i.jsx)(t.li,{children:"Run some of the example scripts in Script Runner and Test Runner"}),"\n",(0,i.jsx)(t.li,{children:"View individual Telemetry packets in Packet Viewer"}),"\n",(0,i.jsx)(t.li,{children:"View detailed telemetry displays in Telemetry Viewer"}),"\n",(0,i.jsx)(t.li,{children:"Graph some data in Telemetry Grapher"}),"\n",(0,i.jsx)(t.li,{children:"View log type data in Data Viewer"}),"\n",(0,i.jsx)(t.li,{children:"Process log data with Data Extractor"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.admonition,{title:"Browser Version Issue",type:"info",children:[(0,i.jsxs)(t.p,{children:["When you try to load the page and it fails to load, check with the built-in web development tools / DevTools. We have seen some strange things with version of browsers. You can build to a version of browser if you need to by reading about the ",(0,i.jsx)(t.a,{href:"https://github.com/browserslist/browserslist",children:"browserslist"}),". A typical failure results in:"]}),(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"unexpected token ||=\n"})}),(0,i.jsxs)(t.p,{children:["To fix this make sure your browsers is compliant with the current settings in the ",(0,i.jsx)(t.a,{href:"https://github.com/OpenC3/cosmos/blob/main/openc3-cosmos-init/plugins/openc3-tool-base/.browserslistrc",children:".browserlistrc"})," file. You can change this and rebuild the image. Note: This can cause build speeds to increase or decrease."]})]}),"\n",(0,i.jsx)(t.h2,{id:"interfacing-with-your-hardware",children:"Interfacing with Your Hardware"}),"\n",(0,i.jsx)(t.p,{children:"Playing with the COSMOS Demo is fun and all, but now you want to talk to your own real hardware? Let's do it!"}),"\n",(0,i.jsx)(t.admonition,{title:"Install and Platform",type:"info",children:(0,i.jsx)(t.p,{children:"This guide assumes we're on Windows and COSMOS is installed in C:\\COSMOS. Adjust scripts and paths as necessary to match your platform and COSMOS installation directory."})}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Before creating your own configuration you should uninstall the COSMOS Demo so you're working with a clean COSMOS system. Click the Admin button and the PLUGINS tab. Then click the Trash can icon next to openc3-cosmos-demo to delete it. When you go back to the Command and Telemetry Server you should have a blank table with no interfaces."}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["If you followed the ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/getting-started/installation",children:"Installation Guide"})," you should already be inside a cloned ",(0,i.jsx)(t.a,{href:"https://github.com/OpenC3/cosmos-project",children:"openc3-project"})," which is in your PATH (necessary for openc3.bat / openc3.sh to be resolved). Inside this project it's recommended to edit the README.md (",(0,i.jsx)(t.a,{href:"https://www.markdownguide.org/",children:"Markdown"}),") to describe your program / project."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now we need to create a plugin. Plugins are how we add targets and microservices to COSMOS. Our plugin will contain a single target which contains all the information defining the packets (command and telemetry) that are needed to communicate with the target. Use the COSMOS plugin generator to create the correct structure:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\openc3-project> openc3.bat cli generate plugin BOB\n"})}),"\n",(0,i.jsxs)(t.p,{children:['This should create a new directory called "openc3-cosmos-bob" with a bunch of files in it. The full description of all the files is explained by the ',(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#plugin-directory-structure",children:"Plugin Structure"})," page."]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(t.admonition,{title:"Run as the Root user",type:"info",children:(0,i.jsxs)(t.p,{children:["The cli runs as the default COSMOS container user which is the recommended practice. If you're having issues running as that user you can run as the root user (effectively ",(0,i.jsx)(t.code,{children:"docker run --user=root"})," ) by running ",(0,i.jsx)(t.code,{children:"cliroot"})," instead of ",(0,i.jsx)(t.code,{children:"cli"})," in any of the examples."]})}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["Starting with ",(0,i.jsx)(t.a,{href:"https://openc3.com/news/2023/02/23/openc3-cosmos-5-5-0-released/",children:"COSMOS v5.5.0"}),", the plugin generator creates just the plugin framework (previously it would also create a target). From within the newly created plugin directory, we generate a target."]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\openc3-project> cd openc3-cosmos-bob\nopenc3-cosmos-bob> openc3.bat cli generate target BOB\n"})}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(t.admonition,{title:"Generators",type:"info",children:(0,i.jsxs)(t.p,{children:["There are a number of generators available. Run ",(0,i.jsx)(t.code,{children:"openc3.bat cli generate"})," to see all the avilable options."]})}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"The target generator creates a single target named BOB. Best practice is to create a single target per plugin to make it easier to share targets and upgrade them individually. Lets see what the target generator created for us. Open the openc3-cosmos-bob/targets/BOB/cmd_tlm/cmd.txt:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:'COMMAND BOB EXAMPLE BIG_ENDIAN "Packet description"\n # Keyword Name BitSize Type Min Max Default Description\n APPEND_ID_PARAMETER ID 16 INT 1 1 1 "Identifier"\n APPEND_PARAMETER VALUE 32 FLOAT 0 10.5 2.5 "Value"\n APPEND_PARAMETER BOOL 8 UINT MIN MAX 0 "Boolean"\n STATE FALSE 0\n STATE TRUE 1\n APPEND_PARAMETER LABEL 0 STRING "OpenC3" "The label to apply"\n'})}),"\n",(0,i.jsx)(t.p,{children:"What does this all mean?"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"We created a COMMAND for target BOB named EXAMPLE."}),"\n",(0,i.jsx)(t.li,{children:'The command is made up of BIG_ENDIAN parameters and is described by "Packet description". Here we are using the append flavor of defining parameters which stacks them back to back as it builds up the packet and you don\'t have to worry about defining the bit offset into the packet.'}),"\n",(0,i.jsx)(t.li,{children:'First we APPEND_ID_PARAMETER a parameter that is used to identify the packet called ID that is an 16-bit signed integer (INT) with a minimum value of 1, a maximum value of 1, and a default value of 1, that is described as the "Identifier".'}),"\n",(0,i.jsx)(t.li,{children:"Next we APPEND_PARAMETER a parameter called VALUE that is a 32-bit float (FLOAT) that has a minimum value of 0, a maximum value of 10.5, and a default value of 2.5."}),"\n",(0,i.jsx)(t.li,{children:"Then we APPEND_PARAMETER a third parameter called BOOL which is a 8-bit unsigned integer (UINT) with a minimum value of MIN (meaning the smallest value a UINT supports, e.g 0), a maximum value of MAX (largest value a UINT supports, e.g. 255), and a default value of 0. BOOL has two states which are just a fancy way of giving meaning to the integer values 0 and 1. The STATE FALSE has a value of 0 and the STATE TRUE has a value of 1."}),"\n",(0,i.jsx)(t.li,{children:"Finally we APPEND_PARAMETER called LABEL which is a 0-bit (meaning it takes up all the remaining space in the packet) string (STRING) with a default value of \"OpenC3\". Strings don't have minimum or maximum values as that doesn't make sense for STRING types."}),"\n"]}),"\n",(0,i.jsxs)(t.p,{children:["Check out the full ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/command",children:"Command"})," documention for more."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now open the openc3-cosmos-bob/targets/BOB/cmd_tlm/tlm.txt:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:'TELEMETRY BOB STATUS BIG_ENDIAN "Telemetry description"\n # Keyword Name BitSize Type ID Description\n APPEND_ID_ITEM ID 16 INT 1 "Identifier"\n APPEND_ITEM VALUE 32 FLOAT "Value"\n APPEND_ITEM BOOL 8 UINT "Boolean"\n STATE FALSE 0\n STATE TRUE 1\n APPEND_ITEM LABEL 0 STRING "The label to apply"\n'})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:'This time we created a TELEMETRY packet for target BOB called STATUS that contains BIG_ENDIAN items and is described as "Telemetry description".'}),"\n",(0,i.jsx)(t.li,{children:'We start by defininig an ID_ITEM called ID that is a 16-bit signed integer (INT) with an id value of 1 and described as "Identifier". Id items are used to take unidentified blobs of bytes and determine which packet they are. In this case if a blob comes in with a value of 1, at bit offset 0 (since we APPEND this item first), interpreted as a 16-bit integer, then this packet will be "identified" as STATUS. Note the first packet defined without any ID_ITEMS is a "catch-all" packet that matches all incoming data (even if the data lengths don\'t match).'}),"\n",(0,i.jsx)(t.li,{children:"Next we define three items similar to the command definition above."}),"\n"]}),"\n",(0,i.jsxs)(t.p,{children:["Check out the full ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/telemetry",children:"Telemetry"})," documention for more."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["COSMOS has defined an example command and telemetry packet for our target. Most targets will obviously have more than one command and telemetry packet. To add more simply create additional COMMAND and TELEMETRY lines in your text files. Actual packets should match the structure of your command and telemetry. Be sure to add at least one unique ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/command#id_parameter",children:"ID_PARAMETER"})," and ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/telemetry#id_item",children:"ID_ITEM"})," so your packets can be distinguished from each other."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now we need to tell COSMOS how to connect to our BOB target. Open the openc3-cosmos-bob/plugin.txt file:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:"# Set VARIABLEs here to allow variation in your plugin\n# See [Plugins](../configuration/plugins.md) for more information\nVARIABLE bob_target_name BOB\n\n# Modify this according to your actual target connection\n# See [Interfaces](../configuration/interfaces.md) for more information\nTARGET BOB <%= bob_target_name %>\nINTERFACE <%= bob_target_name %>_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST\n MAP_TARGET <%= bob_target_name %>\n"})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:'This configures the plugin with a VARIABLE called bob_target_name with a default of "BOB". When you install this plugin you will have the option to change the name of this target to something other than "BOB". This is useful to avoid name conflicts and allows you to have multiple copies of the BOB target in your COSMOS system.'}),"\n",(0,i.jsx)(t.li,{children:"The TARGET line declares the new BOB target using the name from the variable. The <%= %> syntax is called ERB (embedded Ruby) and allows us to put variables into our text files, in this case referencing our bob_target_name."}),"\n",(0,i.jsxs)(t.li,{children:["The last line declares a new INTERFACE called (by default) BOB_INT that will connect as a TCP/IP client using the code in tcpip_client_interface.rb to address host.docker.internal (This adds an /etc/hosts entry to the correct IP address for the host's gateway) using port 8080 for writing and 8081 for reading. It also has a write timeout of 10 seconds and reads will never timeout (nil). The TCP/IP stream will be interpreted using the COSMOS ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#burst-protocol",children:"BURST"})," protocol which means it will read as much data as it can from the interface. For all the details on how to configure COSMOS interfaces please see the ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/interfaces",children:"Interface Guide"}),". The MAP_TARGET line tells COSMOS that it will receive telemetry from and send commands to the BOB target using the BOB_INT interface."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(t.admonition,{title:"Variables Support Reusability",type:"note",children:(0,i.jsx)(t.p,{children:"In a plugin that you plan to reuse you should make things like hostnames and ports variables"})}),"\n",(0,i.jsx)(t.h2,{id:"building-your-plugin",children:"Building Your Plugin"}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now we need to build our plugin and upload it to COSMOS."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\cosmos-project> cd openc3-cosmos-bob\nC:\\cosmos-project\\openc3-cosmos-bob> ..\\openc3.bat cli rake build VERSION=1.0.0\n Successfully built RubyGem\n Name: openc3-cosmos-bob\n Version: 1.0.0.20210618174517\n File: openc3-cosmos-bob-1.0.0.20210618174517.gem\n"})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:["Note that the VERSION is required to specify the version to build. We recommend ",(0,i.jsx)(t.a,{href:"https://semver.org/",children:"sematic versioning"})," when building your plugin so people using your plugin (including you) know when there are breaking changes."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Once our plugin is built we need to upload it to COSMOS. Go back to the Admin page and click the Plugins Tab. Click on \"Click to Select Plugin\" and select the openc3-cosmos-bob-1.0.0.20210618174517.gem file. Then click Upload. Go back to the CmdTlmServer and you should see the plugin being deployed at which point the BOB_INT interface should appear and try to connect. Go ahead and click 'Cancel' because unless you really have something listening on port 8080 this will never connect. At this point you can explore the other CmdTlmServer tabs and other tools to see your newly defined BOB target."}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:'Let\'s modify our BOB target and then update the copy in COSMOS. If you open Command Sender in COSMOS to BOB EXAMPLE you should see the VALUE parameter has value 2.5. Open the openc3-cosmos-bob/targets/BOB/cmd_tlm/cmd.txt and change the Default value for VALUE to 5 and the description to "New Value".'}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:'COMMAND BOB EXAMPLE BIG_ENDIAN "Packet description"\n # Keyword Name BitSize Type Min Max Default Description\n APPEND_ID_PARAMETER ID 16 INT 1 1 1 "Identifier"\n APPEND_PARAMETER VALUE 32 FLOAT 0 10.5 5 "New Value"\n APPEND_PARAMETER BOOL 8 UINT MIN MAX 0 "Boolean"\n STATE FALSE 0\n STATE TRUE 1\n APPEND_PARAMETER LABEL 0 STRING "OpenC3" "The label to apply"\n'})}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Rebuild the plugin with a new VERSION number. Since we didn't make any breaking changes we simply bump the patch release number:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\cosmos-project\\openc3-cosmos-bob> ..\\openc3.bat cli rake build VERSION=1.0.1\n Successfully built RubyGem\n Name: openc3-cosmos-bob\n Version: 1.0.1.20210618202504\n File: openc3-cosmos-bob-1.0.1.20210618202504.gem\n"})}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:'Go back to the Admin page and click the Plugins Tab. This time click the clock icon next to openc3-cosmos-bob-1.0.0 to Upgrade the plugin. Browse to the newly built plugin gem and select it. This will re-prompt for the plugin variables (bob_target_name) so don\'t change the name and just click OK. You should see a message about the plugin being installed at which point the plugins list will change to openc3-cosmos-bob-1.0.1.20210618202504.gem. Go back to Command Sender and you should see the new Default value for VALUE is 5 and the description is "New Value". We have upgraded our plugin!'}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["At this point you can create a new plugin named after your real target and start modifying the interface and command and telemetry definitions to enable COSMOS to connect to and drive your target. If you run into trouble look for solutions on our ",(0,i.jsx)(t.a,{href:"https://github.com/OpenC3/cosmos/issues",children:"Github Issues"})," page. If you would like to enquire about support contracts or professional COSMOS development please contact us at ",(0,i.jsx)(t.a,{href:"mailto:support@openc3.com",children:"support@openc3.com"}),"."]}),"\n"]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},1184:(e,t,n)=>{n.d(t,{R:()=>s});var i=n(4041);const o={},a=i.createContext(o);function s(e){const t=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}}}]);
1
+ "use strict";(self.webpackChunkdocs_openc3_com=self.webpackChunkdocs_openc3_com||[]).push([[6830],{9876:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>c});var i=n(1085),o=n(1184);const a={sidebar_position:2,title:"Getting Started"},s=void 0,r={id:"getting-started/gettingstarted",title:"Getting Started",description:"Welcome to the OpenC3 COSMOS system... Let's get started! This guide is a high level overview that will help with setting up your first COSMOS project.",source:"@site/docs/getting-started/gettingstarted.md",sourceDirName:"getting-started",slug:"/getting-started/gettingstarted",permalink:"/tools/staticdocs/docs/getting-started/gettingstarted",draft:!1,unlisted:!1,editUrl:"https://github.com/OpenC3/cosmos/tree/main/docs.openc3.com/docs/getting-started/gettingstarted.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"Getting Started"},sidebar:"defaultSidebar",previous:{title:"Installation",permalink:"/tools/staticdocs/docs/getting-started/installation"},next:{title:"Code Generators",permalink:"/tools/staticdocs/docs/getting-started/generators"}},l={},c=[{value:"Interfacing with Your Hardware",id:"interfacing-with-your-hardware",level:2},{value:"Building Your Plugin",id:"building-your-plugin",level:2}];function d(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.p,{children:"Welcome to the OpenC3 COSMOS system... Let's get started! This guide is a high level overview that will help with setting up your first COSMOS project."}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["Get COSMOS Installed onto your computer by following the ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/getting-started/installation",children:"Installation Guide"}),".","\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"You should now have COSMOS installed and a Demo project available that we can make changes to."}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["Browse to ",(0,i.jsx)(t.a,{href:"http://localhost:2900",children:"http://localhost:2900"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:'The COSMOS Command and Telemetry Server will appear. This tool provides real-time information about each "target" in the system. Targets are external systems that receive commands and generate telemetry, often over ethernet or serial connections.'}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["Experiment with other COSMOS tools. This is a DEMO environment so you can't break anything. Some things to try:","\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Use Command Sender to send individual commands."}),"\n",(0,i.jsx)(t.li,{children:"Use Limits Monitor to watch for telemetry limits violations"}),"\n",(0,i.jsx)(t.li,{children:"Run some of the example scripts in Script Runner and Test Runner"}),"\n",(0,i.jsx)(t.li,{children:"View individual Telemetry packets in Packet Viewer"}),"\n",(0,i.jsx)(t.li,{children:"View detailed telemetry displays in Telemetry Viewer"}),"\n",(0,i.jsx)(t.li,{children:"Graph some data in Telemetry Grapher"}),"\n",(0,i.jsx)(t.li,{children:"View log type data in Data Viewer"}),"\n",(0,i.jsx)(t.li,{children:"Process log data with Data Extractor"}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.admonition,{title:"Browser Version Issue",type:"info",children:[(0,i.jsxs)(t.p,{children:["When you try to load the page and it fails to load, check with the built-in web development tools / DevTools. We have seen some strange things with version of browsers. You can build to a version of browser if you need to by reading about the ",(0,i.jsx)(t.a,{href:"https://github.com/browserslist/browserslist",children:"browserslist"}),". A typical failure results in:"]}),(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"unexpected token ||=\n"})}),(0,i.jsxs)(t.p,{children:["To fix this make sure your browsers is compliant with the current settings in the ",(0,i.jsx)(t.a,{href:"https://github.com/OpenC3/cosmos/blob/main/openc3-cosmos-init/plugins/openc3-tool-base/.browserslistrc",children:".browserlistrc"})," file. You can change this and rebuild the image. Note: This can cause build speeds to increase or decrease."]})]}),"\n",(0,i.jsx)(t.h2,{id:"interfacing-with-your-hardware",children:"Interfacing with Your Hardware"}),"\n",(0,i.jsx)(t.p,{children:"Playing with the COSMOS Demo is fun and all, but now you want to talk to your own real hardware? Let's do it!"}),"\n",(0,i.jsx)(t.admonition,{title:"Install and Platform",type:"info",children:(0,i.jsx)(t.p,{children:"This guide assumes we're on Windows and COSMOS is installed in C:\\COSMOS. Adjust scripts and paths as necessary to match your platform and COSMOS installation directory."})}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Before creating your own configuration you should uninstall the COSMOS Demo so you're working with a clean COSMOS system. Click the Admin button and the PLUGINS tab. Then click the Trash can icon next to openc3-cosmos-demo to delete it. When you go back to the Command and Telemetry Server you should have a blank table with no interfaces."}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["If you followed the ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/getting-started/installation",children:"Installation Guide"})," you should already be inside a cloned ",(0,i.jsx)(t.a,{href:"https://github.com/OpenC3/cosmos-project",children:"openc3-project"})," which is in your PATH (necessary for openc3.bat / openc3.sh to be resolved). Inside this project it's recommended to edit the README.md (",(0,i.jsx)(t.a,{href:"https://www.markdownguide.org/",children:"Markdown"}),") to describe your program / project."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now we need to create a plugin. Plugins are how we add targets and microservices to COSMOS. Our plugin will contain a single target which contains all the information defining the packets (command and telemetry) that are needed to communicate with the target. Use the COSMOS plugin generator to create the correct structure:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\openc3-project> openc3.bat cli generate plugin BOB\n"})}),"\n",(0,i.jsxs)(t.p,{children:['This should create a new directory called "openc3-cosmos-bob" with a bunch of files in it. The full description of all the files is explained by the ',(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/plugins#plugin-directory-structure",children:"Plugin Structure"})," page."]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(t.admonition,{title:"Run as the Root user",type:"info",children:(0,i.jsxs)(t.p,{children:["The cli runs as the default COSMOS container user which is the recommended practice. If you're having issues running as that user you can run as the root user (effectively ",(0,i.jsx)(t.code,{children:"docker run --user=root"})," ) by running ",(0,i.jsx)(t.code,{children:"cliroot"})," instead of ",(0,i.jsx)(t.code,{children:"cli"})," in any of the examples."]})}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["Starting with ",(0,i.jsx)(t.a,{href:"https://openc3.com/news/2023/02/23/openc3-cosmos-5-5-0-released/",children:"COSMOS v5.5.0"}),", the plugin generator creates just the plugin framework (previously it would also create a target). From within the newly created plugin directory, we generate a target."]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\openc3-project> cd openc3-cosmos-bob\nopenc3-cosmos-bob> openc3.bat cli generate target BOB\n"})}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(t.admonition,{title:"Generators",type:"info",children:(0,i.jsxs)(t.p,{children:["There are a number of generators available. Run ",(0,i.jsx)(t.code,{children:"openc3.bat cli generate"})," to see all the avilable options."]})}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"The target generator creates a single target named BOB. Best practice is to create a single target per plugin to make it easier to share targets and upgrade them individually. Lets see what the target generator created for us. Open the openc3-cosmos-bob/targets/BOB/cmd_tlm/cmd.txt:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:'COMMAND BOB EXAMPLE BIG_ENDIAN "Packet description"\n # Keyword Name BitSize Type Min Max Default Description\n APPEND_ID_PARAMETER ID 16 INT 1 1 1 "Identifier"\n APPEND_PARAMETER VALUE 32 FLOAT 0 10.5 2.5 "Value"\n APPEND_PARAMETER BOOL 8 UINT MIN MAX 0 "Boolean"\n STATE FALSE 0\n STATE TRUE 1\n APPEND_PARAMETER LABEL 0 STRING "OpenC3" "The label to apply"\n'})}),"\n",(0,i.jsx)(t.p,{children:"What does this all mean?"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"We created a COMMAND for target BOB named EXAMPLE."}),"\n",(0,i.jsx)(t.li,{children:'The command is made up of BIG_ENDIAN parameters and is described by "Packet description". Here we are using the append flavor of defining parameters which stacks them back to back as it builds up the packet and you don\'t have to worry about defining the bit offset into the packet.'}),"\n",(0,i.jsx)(t.li,{children:'First we APPEND_ID_PARAMETER a parameter that is used to identify the packet called ID that is an 16-bit signed integer (INT) with a minimum value of 1, a maximum value of 1, and a default value of 1, that is described as the "Identifier".'}),"\n",(0,i.jsx)(t.li,{children:"Next we APPEND_PARAMETER a parameter called VALUE that is a 32-bit float (FLOAT) that has a minimum value of 0, a maximum value of 10.5, and a default value of 2.5."}),"\n",(0,i.jsx)(t.li,{children:"Then we APPEND_PARAMETER a third parameter called BOOL which is a 8-bit unsigned integer (UINT) with a minimum value of MIN (meaning the smallest value a UINT supports, e.g 0), a maximum value of MAX (largest value a UINT supports, e.g. 255), and a default value of 0. BOOL has two states which are just a fancy way of giving meaning to the integer values 0 and 1. The STATE FALSE has a value of 0 and the STATE TRUE has a value of 1."}),"\n",(0,i.jsx)(t.li,{children:"Finally we APPEND_PARAMETER called LABEL which is a 0-bit (meaning it takes up all the remaining space in the packet) string (STRING) with a default value of \"OpenC3\". Strings don't have minimum or maximum values as that doesn't make sense for STRING types."}),"\n"]}),"\n",(0,i.jsxs)(t.p,{children:["Check out the full ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/command",children:"Command"})," documention for more."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now open the openc3-cosmos-bob/targets/BOB/cmd_tlm/tlm.txt:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:'TELEMETRY BOB STATUS BIG_ENDIAN "Telemetry description"\n # Keyword Name BitSize Type ID Description\n APPEND_ID_ITEM ID 16 INT 1 "Identifier"\n APPEND_ITEM VALUE 32 FLOAT "Value"\n APPEND_ITEM BOOL 8 UINT "Boolean"\n STATE FALSE 0\n STATE TRUE 1\n APPEND_ITEM LABEL 0 STRING "The label to apply"\n'})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:'This time we created a TELEMETRY packet for target BOB called STATUS that contains BIG_ENDIAN items and is described as "Telemetry description".'}),"\n",(0,i.jsx)(t.li,{children:'We start by defininig an ID_ITEM called ID that is a 16-bit signed integer (INT) with an id value of 1 and described as "Identifier". Id items are used to take unidentified blobs of bytes and determine which packet they are. In this case if a blob comes in with a value of 1, at bit offset 0 (since we APPEND this item first), interpreted as a 16-bit integer, then this packet will be "identified" as STATUS. Note the first packet defined without any ID_ITEMS is a "catch-all" packet that matches all incoming data (even if the data lengths don\'t match).'}),"\n",(0,i.jsx)(t.li,{children:"Next we define three items similar to the command definition above."}),"\n"]}),"\n",(0,i.jsxs)(t.p,{children:["Check out the full ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/telemetry",children:"Telemetry"})," documention for more."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["COSMOS has defined an example command and telemetry packet for our target. Most targets will obviously have more than one command and telemetry packet. To add more simply create additional COMMAND and TELEMETRY lines in your text files. Actual packets should match the structure of your command and telemetry. Be sure to add at least one unique ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/command#id_parameter",children:"ID_PARAMETER"})," and ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/telemetry#id_item",children:"ID_ITEM"})," so your packets can be distinguished from each other."]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now we need to tell COSMOS how to connect to our BOB target. Open the openc3-cosmos-bob/plugin.txt file:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:"# Set VARIABLEs here to allow variation in your plugin\n# See [Plugins](../configuration/plugins.md) for more information\nVARIABLE bob_target_name BOB\n\n# Modify this according to your actual target connection\n# See [Interfaces](../configuration/interfaces.md) for more information\nTARGET BOB <%= bob_target_name %>\nINTERFACE <%= bob_target_name %>_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST\n MAP_TARGET <%= bob_target_name %>\n"})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:'This configures the plugin with a VARIABLE called bob_target_name with a default of "BOB". When you install this plugin you will have the option to change the name of this target to something other than "BOB". This is useful to avoid name conflicts and allows you to have multiple copies of the BOB target in your COSMOS system.'}),"\n",(0,i.jsx)(t.li,{children:"The TARGET line declares the new BOB target using the name from the variable. The <%= %> syntax is called ERB (embedded Ruby) and allows us to put variables into our text files, in this case referencing our bob_target_name."}),"\n",(0,i.jsxs)(t.li,{children:["The last line declares a new INTERFACE called (by default) BOB_INT that will connect as a TCP/IP client using the code in tcpip_client_interface.rb to address host.docker.internal (This adds an /etc/hosts entry to the correct IP address for the host's gateway) using port 8080 for writing and 8081 for reading. It also has a write timeout of 10 seconds and reads will never timeout (nil). The TCP/IP stream will be interpreted using the COSMOS ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/protocols#burst-protocol",children:"BURST"})," protocol which means it will read as much data as it can from the interface. For all the details on how to configure COSMOS interfaces please see the ",(0,i.jsx)(t.a,{href:"/tools/staticdocs/docs/configuration/interfaces",children:"Interface Guide"}),". The MAP_TARGET line tells COSMOS that it will receive telemetry from and send commands to the BOB target using the BOB_INT interface."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(t.admonition,{title:"Variables Support Reusability",type:"note",children:(0,i.jsx)(t.p,{children:"In a plugin that you plan to reuse you should make things like hostnames and ports variables"})}),"\n",(0,i.jsx)(t.h2,{id:"building-your-plugin",children:"Building Your Plugin"}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Now we need to build our plugin and upload it to COSMOS."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\cosmos-project> cd openc3-cosmos-bob\nC:\\cosmos-project\\openc3-cosmos-bob> ..\\openc3.bat cli rake build VERSION=1.0.0\n Successfully built RubyGem\n Name: openc3-cosmos-bob\n Version: 1.0.0.20210618174517\n File: openc3-cosmos-bob-1.0.0.20210618174517.gem\n"})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:["Note that the VERSION is required to specify the version to build. We recommend ",(0,i.jsx)(t.a,{href:"https://semver.org/",children:"sematic versioning"})," when building your plugin so people using your plugin (including you) know when there are breaking changes."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Once our plugin is built we need to upload it to COSMOS. Go back to the Admin page and click the Plugins Tab. Click on \"Click to Select Plugin\" and select the openc3-cosmos-bob-1.0.0.20210618174517.gem file. Then click Upload. Go back to the CmdTlmServer and you should see the plugin being deployed at which point the BOB_INT interface should appear and try to connect. Go ahead and click 'Cancel' because unless you really have something listening on port 8080 this will never connect. At this point you can explore the other CmdTlmServer tabs and other tools to see your newly defined BOB target."}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:'Let\'s modify our BOB target and then update the copy in COSMOS. If you open Command Sender in COSMOS to BOB EXAMPLE you should see the VALUE parameter has value 2.5. Open the openc3-cosmos-bob/targets/BOB/cmd_tlm/cmd.txt and change the Default value for VALUE to 5 and the description to "New Value".'}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ruby",children:'COMMAND BOB EXAMPLE BIG_ENDIAN "Packet description"\n # Keyword Name BitSize Type Min Max Default Description\n APPEND_ID_PARAMETER ID 16 INT 1 1 1 "Identifier"\n APPEND_PARAMETER VALUE 32 FLOAT 0 10.5 5 "New Value"\n APPEND_PARAMETER BOOL 8 UINT MIN MAX 0 "Boolean"\n STATE FALSE 0\n STATE TRUE 1\n APPEND_PARAMETER LABEL 0 STRING "OpenC3" "The label to apply"\n'})}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:"Rebuild the plugin with a new VERSION number. Since we didn't make any breaking changes we simply bump the patch release number:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-batch",children:"C:\\cosmos-project\\openc3-cosmos-bob> ..\\openc3.bat cli rake build VERSION=1.0.1\n Successfully built RubyGem\n Name: openc3-cosmos-bob\n Version: 1.0.1.20210618202504\n File: openc3-cosmos-bob-1.0.1.20210618202504.gem\n"})}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsx)(t.p,{children:'Go back to the Admin page and click the Plugins Tab. This time click the clock icon next to openc3-cosmos-bob-1.0.0 to Upgrade the plugin. Browse to the newly built plugin gem and select it. This will re-prompt for the plugin variables (bob_target_name) so don\'t change the name and just click OK. You should see a message about the plugin being installed at which point the plugins list will change to openc3-cosmos-bob-1.0.1.20210618202504.gem. Go back to Command Sender and you should see the new Default value for VALUE is 5 and the description is "New Value". We have upgraded our plugin!'}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["\n",(0,i.jsxs)(t.p,{children:["At this point you can create a new plugin named after your real target and start modifying the interface and command and telemetry definitions to enable COSMOS to connect to and drive your target. If you run into trouble look for solutions on our ",(0,i.jsx)(t.a,{href:"https://github.com/OpenC3/cosmos/issues",children:"Github Issues"})," page. If you would like to enquire about support contracts or professional COSMOS development please contact us at ",(0,i.jsx)(t.a,{href:"mailto:support@openc3.com",children:"support@openc3.com"}),"."]}),"\n"]}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},1184:(e,t,n)=>{n.d(t,{R:()=>s});var i=n(4041);const o={},a=i.createContext(o);function s(e){const t=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}}}]);