{"id":110,"date":"2015-12-29T09:35:47","date_gmt":"2015-12-29T09:35:47","guid":{"rendered":"http:\/\/blogs.nrao.edu\/jmalone\/?p=110"},"modified":"2015-12-29T14:37:20","modified_gmt":"2015-12-29T14:37:20","slug":"scripting-an-aurora-lxc-200-from-the-command-line","status":"publish","type":"post","link":"https:\/\/blogs.nrao.edu\/jmalone\/2015\/12\/29\/scripting-an-aurora-lxc-200-from-the-command-line\/","title":{"rendered":"Scripting an Aurora LXC-200 from the command line"},"content":{"rendered":"<p>Aurora Multimedia produces a number of network-attached port expanders for their WACI line of A\/V control systems. Among these is their LXC-200, which provides 3 RS-232 serial ports, 2 IR ports, 2 relays and 1 GPIO in a small, POE-powered chassis. See <a href=\"http:\/\/auroramultimedia.com\/products\/lxc-200\/\">their page<\/a> for more details.<\/p>\n<p>All of their WACI devices provide an HTTP-RPC API for control. In my case, I want to use the LXC-200 as a general purpose network-attached serial output port. Eventually I&#8217;d like to find a way to use it with the FSR FLEX-LT control system but for now I just want to send some serial port output from a command line. The LXC and WACI documentation provide a list of the RPC calls, but the exact usage was a tad vague. So, time to fire up Wireshark and see how this puppy is used.<\/p>\n<p>The WACI event manager has the ability to send serial output to a remote port on another WACI, so I create a simple test event and point it at the LXC. Trigger the event and watch the packets flow!<\/p>\n<p><a href=\"http:\/\/blogs.nrao.edu\/jmalone\/files\/2015\/12\/Screen-Shot-2015-12-28-at-4.19.48-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-111\" src=\"http:\/\/blogs.nrao.edu\/jmalone\/files\/2015\/12\/Screen-Shot-2015-12-28-at-4.19.48-PM.png\" alt=\"LXC packet capture\" width=\"475\" height=\"103\" srcset=\"https:\/\/blogs.nrao.edu\/jmalone\/files\/2015\/12\/Screen-Shot-2015-12-28-at-4.19.48-PM.png 475w, https:\/\/blogs.nrao.edu\/jmalone\/files\/2015\/12\/Screen-Shot-2015-12-28-at-4.19.48-PM-300x65.png 300w\" sizes=\"(max-width: 475px) 100vw, 475px\" \/><\/a><\/p>\n<p>The URL used was http:\/\/address.of.waci.unit\/rpc\/<\/p>\n<p>According to the Aurora RPC docs, param3 is a max wait time, in ms. I&#8217;m just going to leave it at 10 as I&#8217;m not sure what it&#8217;s waiting for, exactly.<\/p>\n<p>So, let&#8217;s give curl a shot:<\/p>\n<pre>$ curl --data \"method=Serial_Send&amp;param1=1&amp;param2=TestCURL&amp;param3=10\" \"http:\/\/a.b.c.d\/rpc\/\"\r\nstatus=HTTP\/1.1 200 OK\r\nConnection: close\r\n<\/pre>\n<p>And, sure enough, the serial strings pop out the port. What if we want to send raw binary data via the serial port (for controlling, say a <a href=\"http:\/\/www.roomieremote.com\/forums\/topic\/samsung-ex-link\/\">Samsung EX-Link TV<\/a>)? Well, the HTTP request is encoded with x-www-form-urlencoded, which is an old but still valid encoding mechanism. We just need to use the WACI syntax for sending binary data:<\/p>\n<pre>$ curl --data \"method=Serial_Send&amp;param1=1&amp;param2=%08%22%00%00%00%02%d4&amp;param3=10\" \"http:\/\/a.b.c.d\/rpc\/\"<\/pre>\n<p>And the &#8220;Power On&#8221; command emerges from the serial port.<\/p>\n<p>Now, how to make the FSR talk HTTP&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Aurora Multimedia produces a number of network-attached port expanders for their WACI line of A\/V control systems. Among these is their LXC-200, which provides 3 RS-232 serial ports, 2 IR ports, 2 relays and 1 GPIO in a small, POE-powered &hellip; <a class=\"more-link\" href=\"https:\/\/blogs.nrao.edu\/jmalone\/2015\/12\/29\/scripting-an-aurora-lxc-200-from-the-command-line\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-110","post","type-post","status-publish","format-standard","hentry","category-audiovisual"],"_links":{"self":[{"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/posts\/110"}],"collection":[{"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":3,"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"predecessor-version":[{"id":114,"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/posts\/110\/revisions\/114"}],"wp:attachment":[{"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.nrao.edu\/jmalone\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}