<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.mios.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.mios.com/index.php?action=history&amp;feed=atom&amp;title=LuaUPnP</id>
		<title>LuaUPnP - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.mios.com/index.php?action=history&amp;feed=atom&amp;title=LuaUPnP"/>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;action=history"/>
		<updated>2026-04-30T04:33:38Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.8</generator>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=2314&amp;oldid=prev</id>
		<title>Javier at 20:39, 17 April 2010</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=2314&amp;oldid=prev"/>
				<updated>2010-04-17T20:39:11Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:39, 17 April 2010&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Development]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This page explains how we are implementing our upcoming LuaUpNP feature in Vera. The document gets a bit technical so that users can comment on it and we can make adjustments as the feature comes closer to release. User feedback is appreciated and a sticky topic has been created in the 'Vera Developers' section of [http://forum.micasaverde.com/ forum.micasaverde.com] for comments. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This page explains how we are implementing our upcoming LuaUpNP feature in Vera. The document gets a bit technical so that users can comment on it and we can make adjustments as the feature comes closer to release. User feedback is appreciated and a sticky topic has been created in the 'Vera Developers' section of [http://forum.micasaverde.com/ forum.micasaverde.com] for comments. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:1577:newid:2314 --&gt;
&lt;/table&gt;</summary>
		<author><name>Javier</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1577&amp;oldid=prev</id>
		<title>LibraSun at 03:41, 11 August 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1577&amp;oldid=prev"/>
				<updated>2009-08-11T03:41:25Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 03:41, 11 August 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Writing the Lua Code&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Writing the Lua Code&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Whenever a command is received, it's assigned an internal &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;job &lt;/del&gt;#. This is true whether or not there's any Lua script to be run. So, calling an action results in a Job, and the Job will either send the data (the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i/r &lt;/del&gt;code, serial data, etc), or call the Lua script for that action if you wrote any. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Whenever a command is received, it's assigned an internal &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Job &lt;/ins&gt;#. This is true whether or not there's any Lua script to be run. So, calling an action results in a Job, and the Job will either send the data (the&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;IR &lt;/ins&gt;code, serial data, etc), or call the Lua script for that action if you wrote any. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;For each action, there are 3 functions, or blocks of Lua script, you can create. 1) The _Run script, which is called when the action is received and needs to run. 2) The _Callback script, when the job is waiting for some data to come back. 3) The _Timeout script, when data was not received in time. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;For each action, there are 3 functions, or blocks of Lua script, you can create. 1) The _Run script, which is called when the action is received and needs to run. 2) The _Callback script, when the job is waiting for some data to come back. 3) The _Timeout script, when data was not received in time. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If the user wrote some _Run Lua script in step 3 above, it's called and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;past &lt;/del&gt;as arguments &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/del&gt;the job number plus any parameters for the action. All Lua &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;script &lt;/del&gt;for a device run in the same instance, so they can all share global variables. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If the user wrote some _Run Lua script in step 3 above, it's called and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;passed &lt;/ins&gt;as arguments &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to &lt;/ins&gt;the job number plus any parameters for the action. All Lua &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;scripts &lt;/ins&gt;for a device run in the same instance, so they can all share global variables. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The Lua script does whatever is needed in response to the command. It can call Lua functions as well as functions which LuaUPnP exports to the Lua engine. The Lua script can also set a global variable called &amp;quot;Status&amp;quot; to some free form text, like &amp;quot;sending command&amp;quot;, or &amp;quot;device not responding&amp;quot;. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The Lua script does whatever is needed in response to the command. It can call Lua functions as well as functions which LuaUPnP exports to the Lua engine. The Lua script can also set a global variable called &amp;quot;Status&amp;quot; to some free form text, like &amp;quot;sending command&amp;quot;, or &amp;quot;device not responding&amp;quot;. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 45:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 45:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the Lua script exits, it returns 2 parameters: 1) the job status, which is: job_WaitingToStart, job_Error, job_Aborted, job_Done, or job_WaitingForCallback. 2) the second parameter is a delay, in seconds, for the job to timeout. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the Lua script exits, it returns 2 parameters: 1) the job status, which is: job_WaitingToStart, job_Error, job_Aborted, job_Done, or job_WaitingForCallback. 2) the second parameter is a delay, in seconds, for the job to timeout. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If the job status is job_Done, that is the normal situation when everything is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ok&lt;/del&gt;. The timeout is not used. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If the job status is job_Done, that is the normal situation when everything is &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;okay&lt;/ins&gt;. The timeout is not used. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If it's job_Abort or job_Error, the job is also marked as 'completed', but it ended in an error condition, or because the user aborted it. The timeout is not used. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If it's job_Abort or job_Error, the job is also marked as 'completed', but it ended in an error condition, or because the user aborted it. The timeout is not used. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 53:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 53:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If it's job_WaitingForCallback, then this means the script is waiting for some incoming data. For example, maybe the protocol requires sending something over the serial port and waiting for an &amp;quot;OK&amp;quot; to come back. If the job does not complete within [timeout] seconds, the _Timeout Lua script is called, which, if not defined, simply sets the status to &amp;quot;Timed out&amp;quot; and returns job_Error. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If it's job_WaitingForCallback, then this means the script is waiting for some incoming data. For example, maybe the protocol requires sending something over the serial port and waiting for an &amp;quot;OK&amp;quot; to come back. If the job does not complete within [timeout] seconds, the _Timeout Lua script is called, which, if not defined, simply sets the status to &amp;quot;Timed out&amp;quot; and returns job_Error. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When data comes in through the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;o &lt;/del&gt;device (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ie &lt;/del&gt;serial port, etc.), that data is first sent to the _Callback script of the job in the 'job_WaitingForCallback' state. The 'callback' code returns a) whether it processed the incoming data, b) the job status, and c) the timeout. If it returns 'false' to the first parameter, the framework will keep looking for other pending jobs that are in the 'job_WaitingForCallback' state, and if all of them return false, it goes to a generic 'Incoming data' script. If the job status returned is job_WaitingForCallback, then the job is still waiting and will be called again when data comes in. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When data comes in through the&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;I&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;O &lt;/ins&gt;device (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;i.e. &lt;/ins&gt;serial port, etc.), that data is first sent to the _Callback script of the job in the 'job_WaitingForCallback' state. The 'callback' code returns a) whether it processed the incoming data, b) the job status, and c) the timeout. If it returns 'false' to the first parameter, the framework will keep looking for other pending jobs that are in the 'job_WaitingForCallback' state, and if all of them return false, it goes to a generic 'Incoming data' script. If the job status returned is &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'&lt;/ins&gt;job_WaitingForCallback&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'&lt;/ins&gt;, then the job is still waiting and will be called again when data comes in. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The web engine takes care of creating the function names to shelter non-programmers from as much coding as possible. However, internally, all the script is stored in Lua functions. So, for example, if there's an On action, and the user adds _Run, _Timeout and _Callback script, there will be 3 Lua functions the framework creates: On_Run, On_Timeout and On_Callback. The user can also create with the web user interface a block of Lua script to run on startup (Startup), shutdown (Shutdown), as well as to run when data is received that wasn't handled by a job (IncomingData), and also an idle loop when the device is idle (IdleLoop). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The web engine takes care of creating the function names to shelter non-programmers from as much coding as possible. However, internally, all the script is stored in Lua functions. So, for example, if there's an On action, and the user adds _Run, _Timeout and _Callback script, there will be 3 Lua functions the framework creates: On_Run, On_Timeout and On_Callback. The user can also create with the web user interface a block of Lua script to run on startup (Startup), shutdown (Shutdown), as well as to run when data is received that wasn't handled by a job (IncomingData), and also an idle loop when the device is idle (IdleLoop). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So here is some pseudo code to explain the concept. Let's say that you want to add control for a TV with an RS232 interface. To turn the TV on you send the string: &amp;amp;lt;ON&amp;amp;gt; and when it's processed, it responds with &amp;amp;lt;OK&amp;amp;gt; if was processed, or &amp;amp;lt;ERR&amp;amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;of &lt;/del&gt;it couldn't be processed. The TV may also send unsolicited data on the serial port when the status changes, such as &amp;amp;lt;ON&amp;amp;gt; when the TV is turned on. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So here is some pseudo code to explain the concept. Let's say that you want to add control for a TV with an RS232 interface. To turn the TV on you send the string: &amp;amp;lt;ON&amp;amp;gt; and when it's processed, it responds with &amp;amp;lt;OK&amp;amp;gt; if was processed, or &amp;amp;lt;ERR&amp;amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if &lt;/ins&gt;it couldn't be processed. The TV may also send unsolicited data on the serial port when the status changes, such as &amp;amp;lt;ON&amp;amp;gt; when the TV is turned on. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You add the device, add the actions, &amp;quot;On&amp;quot;, &amp;quot;Off&amp;quot;, etc. Now when adding the implementation, you could take the really simple approach and next to the On action, choose &amp;quot;Send&amp;quot; from the pull down and just put &amp;amp;lt;ON&amp;amp;gt; in the input box. This would work. But, perhaps you want to write Lua script to be able to process the return values &amp;amp;lt;OK&amp;amp;gt; or &amp;amp;lt;ERR&amp;amp;gt; to know if the command went through, and maybe you want to be able to process incoming events, like &amp;amp;lt;ON&amp;amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;so &lt;/del&gt;update the state of the UPnP device so if the user turns it on by hand, the status of the UPnP device changes to On. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;So, in &lt;/del&gt;this case you'd create Lua code for the _Run, _Callback, and _Timeout as follows: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You add the device, add the actions, &amp;quot;On&amp;quot;, &amp;quot;Off&amp;quot;, etc. Now when adding the implementation, you could take the really simple approach and next to the On action, choose &amp;quot;Send&amp;quot; from the pull down and just put &amp;amp;lt;ON&amp;amp;gt; in the input box. This would work. But, perhaps you want to write Lua script to be able to process the return values &amp;amp;lt;OK&amp;amp;gt; or &amp;amp;lt;ERR&amp;amp;gt; to know if the command went through, and maybe you want to be able to process incoming events, like &amp;amp;lt;ON&amp;amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to &lt;/ins&gt;update the state of the UPnP device so if the user turns it on by hand, the status of the UPnP device changes to On. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In &lt;/ins&gt;this case you'd create Lua code for the _Run, _Callback, and _Timeout as follows: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;_Run: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; &lt;/ins&gt;_Run: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; Send(&amp;quot;&amp;amp;lt;ON&amp;amp;gt;&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; Send(&amp;quot;&amp;amp;lt;ON&amp;amp;gt;&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 67:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 67:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; return job_WaitingForCallback,3&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; return job_WaitingForCallback,3&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;_Callback: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp; &lt;/ins&gt;_Callback: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if( IncomingData==&amp;quot;&amp;amp;lt;OK&amp;amp;gt;&amp;quot; )&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; if( IncomingData==&amp;quot;&amp;amp;lt;OK&amp;amp;gt;&amp;quot; )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 76:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 76:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; return true, job_Error&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; return true, job_Error&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; else&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; else&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &lt;/del&gt;return false, job_WaitingForCallback&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160;  &lt;/ins&gt;return false, job_WaitingForCallback&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;_Timeout: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp; &lt;/ins&gt;_Timeout: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; Status=&amp;quot;Device not responding&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; Status=&amp;quot;Device not responding&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 89:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 89:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; return true&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; return true&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;So, &lt;/del&gt;the user hits 'ON' on &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;his &lt;/del&gt;UPnP control device&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. The &lt;/del&gt;_Run function is run for the 'ON' action, which sends &amp;amp;lt;ON&amp;amp;gt;, sets the status, and indicates we're waiting 3 seconds for the device to respond. Let's say that the user hit 'volume up' before that happens, so _Callback for the 'ON' action is called and Incoming data equals &amp;amp;lt;VOLUME 50&amp;amp;gt;. _Callback has no use for this, so it returns false, and indicates the job status is still 'waiting for callback'. If it wanted to increase the timeout another 3 seconds it could do: return false, job_WaitingForCallback, 3. But without the ,3, the timeout remains the same. Since it returned false, the framework will pass the volume string to the master IncomingData function which parses it and updates the UPNP state. Now, if, within 3 seconds the &amp;amp;lt;OK&amp;amp;gt; strings comes in, _Callback is called again and will set the job to 'Done', meaning the job won't get called again. If the 3 seconds passed without the job being 'Done', the _Timeout function is called, which in this case sets the job to an error state. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;When&amp;amp;nbsp;&lt;/ins&gt;the user hits 'ON' on &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/ins&gt;UPnP control device&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, the &lt;/ins&gt;_Run function is run for the 'ON' action, which sends &amp;amp;lt;ON&amp;amp;gt;, sets the status, and indicates we're waiting 3 seconds for the device to respond. Let's say that the user hit 'volume up' before that happens, so _Callback for the 'ON' action is called and Incoming data equals &amp;amp;lt;VOLUME 50&amp;amp;gt;. _Callback has no use for this, so it returns false, and indicates the job status is still 'waiting for callback'. If it wanted to increase the timeout another 3 seconds it could do: return false, job_WaitingForCallback, 3. But without the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'&lt;/ins&gt;, 3&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'&lt;/ins&gt;, the timeout remains the same. Since it returned false, the framework will pass the volume string to the master IncomingData function which parses it and updates the UPNP state. Now, if, within 3 seconds the &amp;amp;lt;OK&amp;amp;gt; strings comes in, _Callback is called again and will set the job to 'Done', meaning the job won't get called again. If the 3 seconds passed without the job being 'Done', the _Timeout function is called, which in this case sets the job to an error state. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On Vera's device page you specify for the device the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;o &lt;/del&gt;device (serial port, infrared, etc.), and for devices like the serial port, the parameters like baud rate, etc. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;So in &lt;/del&gt;the Lua code you just call Send() with whatever you want to send. Also, in the device specification, you can specify delimiters for incoming data, so the framework knows what constitutes a 'chunk' of incoming data. In this protocol, all commands end in a line feed (\n), so &amp;amp;lt;OK&amp;amp;gt;\n&amp;amp;lt;ON&amp;amp;gt; is treated as 2 blocks of incoming data and handled accordingly. For more complex protocols you can provide a Lua script that is called with each incoming character that returns a value to indicate if it's a complete chunk, a bad chunk of data, or to just keep going. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On Vera's device page you specify for the device the&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;I&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;O &lt;/ins&gt;device (serial port, infrared, etc.), and for devices like the serial port, the&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;applicable &lt;/ins&gt;parameters like baud rate, etc. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In &lt;/ins&gt;the Lua code you just call Send() with whatever you want to send. Also, in the device specification, you can specify delimiters for incoming data, so the framework knows what constitutes a 'chunk' of incoming data. In this protocol, all commands end in a line feed (\n), so &amp;amp;lt;OK&amp;amp;gt;\n&amp;amp;lt;ON&amp;amp;gt; is treated as 2 blocks of incoming data and handled accordingly. For more complex protocols you can provide a Lua script that is called with each incoming character that returns a value to indicate if it's a complete chunk, a bad chunk of data, or to just keep going.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Message Interceptors&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Message Interceptors&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:1576:newid:1577 --&gt;
&lt;/table&gt;</summary>
		<author><name>LibraSun</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1576&amp;oldid=prev</id>
		<title>LibraSun at 03:21, 11 August 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1576&amp;oldid=prev"/>
				<updated>2009-08-11T03:21:22Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 03:21, 11 August 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This page explains how we are implementing our upcoming LuaUpNP feature in Vera. The document gets a bit technical so that users can comment on it and we can make adjustments as the feature comes closer to release. User feedback is appreciated and a sticky topic has been created in the 'Vera Developers' section of forum.micasaverde.com for comments. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This page explains how we are implementing our upcoming LuaUpNP feature in Vera. The document gets a bit technical so that users can comment on it and we can make adjustments as the feature comes closer to release. User feedback is appreciated and a sticky topic has been created in the 'Vera Developers' section of &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://&lt;/ins&gt;forum.micasaverde.com&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;/ forum.micasaverde.com] &lt;/ins&gt;for comments. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This new feature is very significant for Vera because it expands the possibilities of Vera greatly, and makes it very simple to create really powerful automation systems. This one module provides infrared (IR)&amp;amp;nbsp;control for audio-visual (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;AV&lt;/del&gt;) devices, serial/USB/Ethernet control for any type of device, and a Lua scripting engine that can be used to do just about anything. And it's all based on UPnP, so anything you can create can be controlled from a standard UPnP control point. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This new feature is very significant for Vera because it expands the possibilities of Vera greatly, and makes it very simple to create really powerful automation systems. This one module provides infrared (IR)&amp;amp;nbsp;control for audio-visual (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;A/V&lt;/ins&gt;) devices, serial/USB/Ethernet control for any type of device, and a Lua scripting engine that can be used to do just about anything. And it's all based on UPnP, so anything you can create can be controlled from a standard UPnP control point. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Some background information: UPnP allows you to describe any type of device in a generic way, explaining what the device can do and how to control it. Then, there are a variety of UPnP control points, which are remote controls, such as a wall-mounted touch-panel, which are able to scan the network for UPnP devices, find out what those devices can do, and present you with a remote control. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Some background information: UPnP allows you to describe any type of device in a generic way, explaining what the device can do and how to control it. Then, there are a variety of UPnP control points, which are remote controls, such as a wall-mounted touch-panel, which are able to scan the network for UPnP devices, find out what those devices can do, and present you with a remote control. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Here is a general work flow showing how the user creates and uses devices: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Here is a general work flow showing how the user creates and uses devices: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Adding a basic infrared &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;AV &lt;/del&gt;device or RS232 that already exists in the database ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Adding a basic infrared &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;A/V &lt;/ins&gt;device or RS232 that already exists in the database &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;1. The user adds an infrared transmitter/receiver, such as plugging a Global Cache GC-100 into the LAN, or a USBUIRT into the extra USB port on Vera. The device is recognized and appears automatically on Vera's devices list. For communicating with a serial/RS232 device, the user can also connect a generic USB-&amp;amp;gt;RS232 (usb-&amp;amp;gt;serial) cable in Vera's spare USB port, or connect the device to one of the serial ports on a GC-100. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;1. The user adds an infrared transmitter/receiver, such as plugging a Global Cache GC-100 into the LAN, or a USBUIRT into the extra USB port on Vera. The device is recognized and appears automatically on Vera's devices list. For communicating with a serial/RS232 device, the user can also connect a generic USB-&amp;amp;gt;RS232 (usb-&amp;amp;gt;serial) cable in Vera's spare USB port, or connect the device to one of the serial ports on a GC-100. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The device is now broadcast as a UPnP device and can be controlled from any UPnP control point. In Vera's 'Scenes' tab, an 'Add actions' button appears next to the device, allowing a choice of action(s) to send the device as part of the scene (i.e. 'TV on', 'Mute', etc.). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The device is now broadcast as a UPnP device and can be controlled from any UPnP control point. In Vera's 'Scenes' tab, an 'Add actions' button appears next to the device, allowing a choice of action(s) to send the device as part of the scene (i.e. 'TV on', 'Mute', etc.). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Adding a new, basic infrared &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;AV &lt;/del&gt;device or RS232 that does not exist yet&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Adding a new, basic infrared &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;A/V &lt;/ins&gt;device or RS232 that does not exist yet&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Step 1 above is the same, and step 2 starts out the same, but when picking the device, choose 'Device not on the list'. Then: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Step 1 above is the same, and step 2 starts out the same, but when picking the device, choose 'Device not on the list'. Then: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 31:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 31:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;4. The user also has the option of adding, for each action, Lua code to be run when: a) incoming data is received and the command is being executed, b) the command is completed, c) the command is aborted, d) the command times out. There are a couple other options for a command, such as specifying if the command should be aborted when another one of the same or other commands comes in before it's finished (e.g. if the user wants to turn the device off, but an 'on' command comes in before the device has turned 'off', abort the 'off'). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;4. The user also has the option of adding, for each action, Lua code to be run when: a) incoming data is received and the command is being executed, b) the command is completed, c) the command is aborted, d) the command times out. There are a couple other options for a command, such as specifying if the command should be aborted when another one of the same or other commands comes in before it's finished (e.g. if the user wants to turn the device off, but an 'on' command comes in before the device has turned 'off', abort the 'off'). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After this is done, the user can add the device as described previously.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After this is done, the user can add the device as described previously. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Writing the Lua Code ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Writing the Lua Code &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Whenever a command is received, it's assigned an internal job #. This is true whether or not there's any Lua script to be run. So, calling an action results in a Job, and the Job will either send the data (the i/r code, serial data, etc), or call the Lua script for that action if you wrote any. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Whenever a command is received, it's assigned an internal job #. This is true whether or not there's any Lua script to be run. So, calling an action results in a Job, and the Job will either send the data (the i/r code, serial data, etc), or call the Lua script for that action if you wrote any. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 93:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 93:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On Vera's device page you specify for the device the i/o device (serial port, infrared, etc.), and for devices like the serial port, the parameters like baud rate, etc. So in the Lua code you just call Send() with whatever you want to send. Also, in the device specification, you can specify delimiters for incoming data, so the framework knows what constitutes a 'chunk' of incoming data. In this protocol, all commands end in a line feed (\n), so &amp;amp;lt;OK&amp;amp;gt;\n&amp;amp;lt;ON&amp;amp;gt; is treated as 2 blocks of incoming data and handled accordingly. For more complex protocols you can provide a Lua script that is called with each incoming character that returns a value to indicate if it's a complete chunk, a bad chunk of data, or to just keep going. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On Vera's device page you specify for the device the i/o device (serial port, infrared, etc.), and for devices like the serial port, the parameters like baud rate, etc. So in the Lua code you just call Send() with whatever you want to send. Also, in the device specification, you can specify delimiters for incoming data, so the framework knows what constitutes a 'chunk' of incoming data. In this protocol, all commands end in a line feed (\n), so &amp;amp;lt;OK&amp;amp;gt;\n&amp;amp;lt;ON&amp;amp;gt; is treated as 2 blocks of incoming data and handled accordingly. For more complex protocols you can provide a Lua script that is called with each incoming character that returns a value to indicate if it's a complete chunk, a bad chunk of data, or to just keep going. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Message Interceptors ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Message Interceptors &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is what allows your Lua script to do something in response to other things that are happening and not just react to commands. You can have your Lua script get called when other devices receive an action, fire an event, and so on. We're using a flexible template-driven model so you can have a script called, for example, whenever any light switch changes state, or when a particular device is turned on, or when the temperature is above a certain threshold, or any time the temperature changes on a device, and so on. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is what allows your Lua script to do something in response to other things that are happening and not just react to commands. You can have your Lua script get called when other devices receive an action, fire an event, and so on. We're using a flexible template-driven model so you can have a script called, for example, whenever any light switch changes state, or when a particular device is turned on, or when the temperature is above a certain threshold, or any time the temperature changes on a device, and so on. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 99:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 99:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Collaboration&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Collaboration&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you create new devices online you can specify if they should be shared with the community, or are private to your device. If you choose not to use our online tools you can upload to Vera directly the 3 needed XML files: 1) device description, 2) service description, 3) implementation.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you create new devices online you can specify if they should be shared with the community, or are private to your device. If you choose not to use our online tools you can upload to Vera directly the 3 needed XML files: 1) device description, 2) service description, 3) implementation. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Compound devices&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Compound devices&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device. For example, let's say you have a PVR, a TV and a Receiver. All 3 will be exposed as UPnP devices. So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports. However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV. So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, lets you uncheck any actions you don't want to see on the control point, and lets you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device. For example, let's say you have a PVR, a TV and a Receiver. All 3 will be exposed as UPnP devices. So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports. However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV. So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, lets you uncheck any actions you don't want to see on the control point, and lets you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:1564:newid:1576 --&gt;
&lt;/table&gt;</summary>
		<author><name>LibraSun</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1564&amp;oldid=prev</id>
		<title>LibraSun at 22:40, 10 August 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1564&amp;oldid=prev"/>
				<updated>2009-08-10T22:40:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:40, 10 August 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 97:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 97:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is what allows your Lua script to do something in response to other things that are happening and not just react to commands. You can have your Lua script get called when other devices receive an action, fire an event, and so on. We're using a flexible template-driven model so you can have a script called, for example, whenever any light switch changes state, or when a particular device is turned on, or when the temperature is above a certain threshold, or any time the temperature changes on a device, and so on. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is what allows your Lua script to do something in response to other things that are happening and not just react to commands. You can have your Lua script get called when other devices receive an action, fire an event, and so on. We're using a flexible template-driven model so you can have a script called, for example, whenever any light switch changes state, or when a particular device is turned on, or when the temperature is above a certain threshold, or any time the temperature changes on a device, and so on. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Collaboration ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Collaboration &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you create new devices online you can specify if they should be shared with the community, or are private to your device. If you choose not to use our online tools you can upload to Vera directly the 3 needed XML &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;file&lt;/del&gt;: 1) device description, 2) service description, 3) implementation. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you create new devices online you can specify if they should be shared with the community, or are private to your device. If you choose not to use our online tools you can upload to Vera directly the 3 needed XML &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;files&lt;/ins&gt;: 1) device description, 2) service description, 3) implementation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Compound devices&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Compound devices&amp;#160; ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device. For example, let's say you have a PVR, a TV and a Receiver. All 3 will be exposed as UPnP devices. So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports. However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV. So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, lets you uncheck any actions you don't want to see on the control point, and lets you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device. For example, let's say you have a PVR, a TV and a Receiver. All 3 will be exposed as UPnP devices. So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports. However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV. So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, lets you uncheck any actions you don't want to see on the control point, and lets you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>LibraSun</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1562&amp;oldid=prev</id>
		<title>LibraSun at 22:40, 10 August 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1562&amp;oldid=prev"/>
				<updated>2009-08-10T22:40:20Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:40, 10 August 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 101:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 101:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you create new devices online you can specify if they should be shared with the community, or are private to your device. If you choose not to use our online tools you can upload to Vera directly the 3 needed XML file: 1) device description, 2) service description, 3) implementation. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you create new devices online you can specify if they should be shared with the community, or are private to your device. If you choose not to use our online tools you can upload to Vera directly the 3 needed XML file: 1) device description, 2) service description, 3) implementation. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Compound devices ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Compound devices &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device. For example, let's say you have a PVR, a TV and a Receiver. All 3 will be exposed as UPnP devices. So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports. However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV. So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;let's &lt;/del&gt;you uncheck any actions you don't want to see on &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;you &lt;/del&gt;control point, and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;let's &lt;/del&gt;you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device. For example, let's say you have a PVR, a TV and a Receiver. All 3 will be exposed as UPnP devices. So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports. However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV. So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;lets &lt;/ins&gt;you uncheck any actions you don't want to see on &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/ins&gt;control point, and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;lets &lt;/ins&gt;you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>LibraSun</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1560&amp;oldid=prev</id>
		<title>LibraSun at 22:33, 10 August 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1560&amp;oldid=prev"/>
				<updated>2009-08-10T22:33:34Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:33, 10 August 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The device is now broadcast as a UPnP device and can be controlled from any UPnP control point. In Vera's 'Scenes' tab, an 'Add actions' button appears next to the device, allowing a choice of action(s) to send the device as part of the scene (i.e. 'TV on', 'Mute', etc.). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The device is now broadcast as a UPnP device and can be controlled from any UPnP control point. In Vera's 'Scenes' tab, an 'Add actions' button appears next to the device, allowing a choice of action(s) to send the device as part of the scene (i.e. 'TV on', 'Mute', etc.). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Adding a new, basic infrared AV device or RS232 that does not exist yet ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Adding a new, basic infrared AV device or RS232 that does not exist yet &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Step 1 above is the same, and step 2 starts out the same&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. But&lt;/del&gt;, when &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;he gets to pick &lt;/del&gt;the device, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;he chooses &lt;/del&gt;'&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;device &lt;/del&gt;not on the list'. Then: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Step 1 above is the same, and step 2 starts out the same, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;but &lt;/ins&gt;when &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;picking &lt;/ins&gt;the device, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;choose &lt;/ins&gt;'&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Device &lt;/ins&gt;not on the list'. Then: &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;1. The user fills in a form with basic information about the device, such as the manufacturer, model, type, etc. The user also picks how to send commands to the device: Infrared codes, RS232 data, network calls, etc., or &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;he &lt;/del&gt;picks 'None' if this is purely a logic device that doesn't directly control any other device&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, such as &lt;/del&gt;a &amp;quot;Cold weather logic&amp;quot; device that may wait for sunset, and then check weather.com to see if the temperature is expected to drop below freezing, and if so, turn on the thermostat. This is a &amp;quot;logic&amp;quot; device because it's not directly controlling any device (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/del&gt;Z-Wave module &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is controlling &lt;/del&gt;the thermostat), it's merely providing logic. The user can also indicate if this device will be 'public' for other users to use too, or 'private', just for his Vera. This data is stored in an &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;xml &lt;/del&gt;file that is a standard UPnP device description. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;1. The user fills in a form with basic information about the device, such as the manufacturer, model, type, etc. The user also picks how to send commands to the device: Infrared codes, RS232 data, network calls, etc., or picks 'None' if this is purely a logic device that doesn't directly control any other device&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.&amp;amp;nbsp; An example might be &lt;/ins&gt;a &amp;quot;Cold weather logic&amp;quot; device that may wait for sunset, and then check weather.com to see if the temperature is expected to drop below freezing, and if so, turn on the thermostat. This is a &amp;quot;logic&amp;quot; device because it's not directly controlling any device (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;as when a &lt;/ins&gt;Z-Wave module &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;controls &lt;/ins&gt;the thermostat), it's merely providing logic. The user can also indicate if this device will be 'public' for other users to use too, or 'private', just for his Vera. This data is stored in an &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;XML &lt;/ins&gt;file that is a standard UPnP device description. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;2. The user picks one or more of the standard service definitions (ie &amp;quot;TV&amp;quot;, &amp;quot;CD Player&amp;quot;, etc.). These have a list of actions, like &amp;quot;On&amp;quot;, &amp;quot;Off&amp;quot;, &amp;quot;Mute&amp;quot;, etc. If there is no standard service definition, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;he has the option of creating &lt;/del&gt;a new one, in which &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;case he adds &lt;/del&gt;all the actions &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;his device will support &lt;/del&gt;&amp;quot;On&amp;quot;, &amp;quot;Off&amp;quot;, &amp;quot;Dim&amp;quot;, etc., and for each action, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;adds &lt;/del&gt;any number of optional arguments. For example, &amp;quot;On&amp;quot; and &amp;quot;Off&amp;quot; may not have any arguments, but &amp;quot;Dim&amp;quot; takes a &amp;quot;Level&amp;quot; argument. This data is stored in an &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;xml &lt;/del&gt;file that is a standard UPnP service description. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;2. The user picks one or more of the standard service definitions (ie &amp;quot;TV&amp;quot;, &amp;quot;CD Player&amp;quot;, etc.). These have a list of actions, like &amp;quot;On&amp;quot;, &amp;quot;Off&amp;quot;, &amp;quot;Mute&amp;quot;, etc. If there is no standard service definition, a new one &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;can be created&lt;/ins&gt;, in which all &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;of &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;device's supported &lt;/ins&gt;actions &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(&lt;/ins&gt;&amp;quot;On&amp;quot;, &amp;quot;Off&amp;quot;, &amp;quot;Dim&amp;quot;, etc.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;) are added&lt;/ins&gt;,&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp; &lt;/ins&gt;and for each action, any number of optional arguments. For example, &amp;quot;On&amp;quot; and &amp;quot;Off&amp;quot; may not have any arguments, but &amp;quot;Dim&amp;quot; takes a &amp;quot;Level&amp;quot; argument. This data is stored in an &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;XML &lt;/ins&gt;file that is a standard UPnP service description. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;3. Now the user has a form that lists each action, and next to each action is a pull-down where the user can choose what to do in response to that action. The choices are: a) Send data to the device. There's an input box for the user to type in the data. The format of the data corresponds to the communication method picked above. If the communication is 'infrared', the user types an &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i/r &lt;/del&gt;code in the box. If it's &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;rs232&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;he types &lt;/del&gt;in the data to send to the device. b) Run some Lua code. These can be mixed and matched. For example, this may be an infrared TV and basic commands, like &amp;quot;channel up&amp;quot; just require sending a code. But other commands, like &amp;quot;input #4&amp;quot; may require some logic to toggle inputs, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;so he wants to &lt;/del&gt;write Lua script. If the device is infrared, there's also a button &amp;quot;Learn the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i/r &lt;/del&gt;code&amp;quot;, which learns the code from an infrared learner. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;3. Now the user has a form that lists each action, and next to each action is a pull-down where the user can choose what to do in response to that action. The choices are: a) Send data to the device. There's an input box for the user to type in the data. The format of the data corresponds to the communication method picked above. If the communication is 'infrared', the user types an &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;IR &lt;/ins&gt;code in the box. If it's &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;RS232&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;type &lt;/ins&gt;in the data to send to the device. b) Run some Lua code. These can be mixed and matched. For example, this may be an infrared TV and basic commands, like &amp;quot;channel up&amp;quot; just require sending a code. But other commands, like &amp;quot;input #4&amp;quot; may require some logic to toggle inputs&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;; for this&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the user might &lt;/ins&gt;write &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;a &lt;/ins&gt;Lua script. If the device is infrared, there's also a button &amp;quot;Learn the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;IR &lt;/ins&gt;code&amp;quot;, which learns the code from an infrared learner. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;4. The user also has the option of adding, for each action, Lua code to be run when: a) incoming data is received and the command is being executed, b) the command is completed, c) the command is aborted, d) the command times out. There are a couple other options for a command, such as specifying if the command should be aborted when another one of the same or other commands comes in before it's finished (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ie &lt;/del&gt;if the user wants to turn the device off, but an 'on' command comes in before the device has turned 'off', abort the 'off'). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;4. The user also has the option of adding, for each action, Lua code to be run when: a) incoming data is received and the command is being executed, b) the command is completed, c) the command is aborted, d) the command times out. There are a couple other options for a command, such as specifying if the command should be aborted when another one of the same or other commands comes in before it's finished (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;e.g. &lt;/ins&gt;if the user wants to turn the device off, but an 'on' command comes in before the device has turned 'off', abort the 'off'). &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After this is done, the user can add the device &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;like &lt;/del&gt;described previously. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After this is done, the user can add the device &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;as &lt;/ins&gt;described previously.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Writing the Lua Code ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Writing the Lua Code ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:1559:newid:1560 --&gt;
&lt;/table&gt;</summary>
		<author><name>LibraSun</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1559&amp;oldid=prev</id>
		<title>LibraSun at 22:26, 10 August 2009</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1559&amp;oldid=prev"/>
				<updated>2009-08-10T22:26:11Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://wiki.mios.com/index.php?title=LuaUPnP&amp;amp;diff=1559&amp;amp;oldid=1056&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>LibraSun</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1056&amp;oldid=prev</id>
		<title>Micasaverde: /* Writing the Lua Code */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1056&amp;oldid=prev"/>
				<updated>2009-04-10T00:33:46Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Writing the Lua Code&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 00:33, 10 April 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 89:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 89:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; return true&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; return true&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, the user hits 'ON' on his UPnP control device.&amp;#160; The &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;_On &lt;/del&gt;function is run, which sends &amp;lt;ON&amp;gt;, sets the status, and indicates we're waiting 3 seconds for the device to respond.&amp;#160; Let's say that the user hit 'volume up' before that happens, so _Callback is called and Incoming data equals &amp;lt;VOLUME 50&amp;gt;.&amp;#160; _Callback has no use for this, so it returns false, and indicates the job status is still 'waiting for callback'.&amp;#160; If it wanted to increase the timeout another 3 seconds it could do: return false, job_WaitingForCallback, 3.&amp;#160; But without the ,3, the timeout remains the same.&amp;#160; Since it returned false, the framework will pass the volume string to the IncomingData function which parses it and updates the UPNP state.&amp;#160; Now, if, within 3 seconds the &amp;lt;OK&amp;gt; strings comes in, _Callback is called again and will set the job to 'Done', meaning the job won't get called again.&amp;#160; If the 3 seconds passed without the job being 'Done', the _Timeout function is called, which in this case sets the job to an error state.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So, the user hits 'ON' on his UPnP control device.&amp;#160; The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;_Run &lt;/ins&gt;function is run &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;for the 'ON' action&lt;/ins&gt;, which sends &amp;lt;ON&amp;gt;, sets the status, and indicates we're waiting 3 seconds for the device to respond.&amp;#160; Let's say that the user hit 'volume up' before that happens, so _Callback &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;for the 'ON' action &lt;/ins&gt;is called and Incoming data equals &amp;lt;VOLUME 50&amp;gt;.&amp;#160; _Callback has no use for this, so it returns false, and indicates the job status is still 'waiting for callback'.&amp;#160; If it wanted to increase the timeout another 3 seconds it could do: return false, job_WaitingForCallback, 3.&amp;#160; But without the ,3, the timeout remains the same.&amp;#160; Since it returned false, the framework will pass the volume string to the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;master &lt;/ins&gt;IncomingData function which parses it and updates the UPNP state.&amp;#160; Now, if, within 3 seconds the &amp;lt;OK&amp;gt; strings comes in, _Callback is called again and will set the job to 'Done', meaning the job won't get called again.&amp;#160; If the 3 seconds passed without the job being 'Done', the _Timeout function is called, which in this case sets the job to an error state.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On Vera's device page you specify for the device the i/o device (serial port, infrared, etc.), and for devices like the serial port, the parameters like baud rate, etc.&amp;#160; So in the Lua code you just call Send() with whatever you want to send.&amp;#160; Also, in the device specification, you can specify delimiters for incoming data, so the framework knows what constitutes a 'chunk' of incoming data.&amp;#160; In this protocol, all commands end in a line feed (\n), so &amp;lt;OK&amp;gt;\n&amp;lt;ON&amp;gt; is treated as 2 blocks of incoming data and handled accordingly.&amp;#160; For more complex protocols you can provide a Lua script that is called with each incoming character that returns a value to indicate if it's a complete chunk, a bad chunk of data, or to just keep going.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On Vera's device page you specify for the device the i/o device (serial port, infrared, etc.), and for devices like the serial port, the parameters like baud rate, etc.&amp;#160; So in the Lua code you just call Send() with whatever you want to send.&amp;#160; Also, in the device specification, you can specify delimiters for incoming data, so the framework knows what constitutes a 'chunk' of incoming data.&amp;#160; In this protocol, all commands end in a line feed (\n), so &amp;lt;OK&amp;gt;\n&amp;lt;ON&amp;gt; is treated as 2 blocks of incoming data and handled accordingly.&amp;#160; For more complex protocols you can provide a Lua script that is called with each incoming character that returns a value to indicate if it's a complete chunk, a bad chunk of data, or to just keep going.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:1055:newid:1056 --&gt;
&lt;/table&gt;</summary>
		<author><name>Micasaverde</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1055&amp;oldid=prev</id>
		<title>Micasaverde: /* Compound devices */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1055&amp;oldid=prev"/>
				<updated>2009-04-10T00:21:53Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Compound devices&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 00:21, 10 April 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 104:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 104:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device.&amp;#160; For example, let's say you have a PVR, a TV and a Receiver.&amp;#160; All 3 will be exposed as UPnP devices.&amp;#160; So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports.&amp;#160; However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV.&amp;#160; So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, let's you uncheck any actions you don't want to see on you control point, and let's you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We are creating a visual web page within Vera to merge actions from different devices into one device.&amp;#160; For example, let's say you have a PVR, a TV and a Receiver.&amp;#160; All 3 will be exposed as UPnP devices.&amp;#160; So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports.&amp;#160; However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV.&amp;#160; So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, let's you uncheck any actions you don't want to see on you control point, and let's you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;test receive&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Pipes replacement in the device data&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:1054:newid:1055 --&gt;
&lt;/table&gt;</summary>
		<author><name>Micasaverde</name></author>	</entry>

	<entry>
		<id>http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1054&amp;oldid=prev</id>
		<title>Micasaverde: /* Message Interceptors */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=LuaUPnP&amp;diff=1054&amp;oldid=prev"/>
				<updated>2009-04-10T00:21:42Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Message Interceptors&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 00:21, 10 April 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 95:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 95:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Message Interceptors==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Message Interceptors==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This is what allows your Lua script to do something in response to other things that are happening and not just react to commands.&amp;#160; You can have your Lua script get called when other devices receive an action, fire an event, and so on.&amp;#160; We're using a flexible template-driven model so you can have a script called, for example, whenever any light switch changes state, or when a particular device is turned on, or when the temperature is above a certain threshold, or any time the temperature changes on a device, and so on.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;==Collaboration==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;test receive&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;When you create new devices online you can specify if they should be shared with the community, or are private to your device.&amp;#160; If you choose not to use our online tools you can upload to Vera directly the 3 needed XML file: 1) device description, 2) service description, 3) implementation.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;==Compound devices==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;We are creating a visual web page within Vera to merge actions from different devices into one device.&amp;#160; For example, let's say you have a PVR, a TV and a Receiver.&amp;#160; All 3 will be exposed as UPnP devices.&amp;#160; So with the UPnP control point you can pick the PVR as the device you want to control, and you'll see the actions the PVR supports.&amp;#160; However, even though you're controlling the PVR, you'll probably also want to be able to control the volume, on, off, and input select on the receiver, as well as the on, off and maybe brightness on the TV.&amp;#160; So in Vera's devices page we're adding a &amp;quot;Compound&amp;quot; button that shows you the actions for the PVR, let's you uncheck any actions you don't want to see on you control point, and let's you add other commands from other devices, like the on/off from the TV, so that when the control point shows the actions of the PVR, it will include the on/off for the tv, and volume for receiver, etc.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;test receive&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Pipes replacement in the device data&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Pipes replacement in the device data&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key micasaverde_wiki:diff:version:1.11a:oldid:1053:newid:1054 --&gt;
&lt;/table&gt;</summary>
		<author><name>Micasaverde</name></author>	</entry>

	</feed>