Luup IO Device

From MiCasaVerde
Jump to: navigation, search

Most Luup plugins are simply interfaces to communicate with an external piece of hardware using infrared (A/V devices like TV's), RS232 (high-end A/V gear, alarm panels, etc.), Network (IP cameras and other IP devices), and a handful of other connections like RS485. In this case the Luup plugin will effectively act as a translator between UPnP and the device's native communication protocol (IR, RS232, etc.). All these communication methods (IR, RS232, network) can be thought of as 'input/output', or I/O, because you get data in from the device and send data out to the device. Infrared is often output-only since generally you can only send IR codes to the device. If you're writing a device that does not talk to some piece of external hardware this section doesn't apply to you.

The Luup engine handles all the low-level I/O. Your plugin only needs to specify what type of I/O to use. Then, within your plugin, when you want to send something to the device you use one of the Luup send commands, like lu_iop_send. If the device is using infrared, whatever you send needs to be in Pronto format. If the device is serial/RS232 or network based, you can send anything and Luup will send this data to the device. Generally serial and network devices have a low-level protocol to organize the data you send/receive into 'chunks'. The most basic low-level protocol is to send/receive text commands that end with a carriage return+line feed (i.e. ENTER), such as: PowerOn [ENTER] ChannelUp [ENTER]. Luup handles the low-level protocol for you, so that any incoming data is automatically divided into 'chunks' of discrete commands, and handles adding separating characters like carriage return+line feed to anything you send. This makes it much faster for you to write a plugin.

Personal tools