Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Small changes, documentation updates, rockspec, batch file for distri…

…bution
  • Loading branch information...
commit 6daaae98a8a9350a93a59fea09aa843510d9afa0 1 parent c0a39c7
@Tieske authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+
+/distr
View
5 2_package_and_docs.bat
@@ -16,7 +16,6 @@ rem copies the (modified) files into the project directory source
rem directory.
rem Then it starts the LuaDoc generator on the source directory.
-
rem copy main files back to project directory
copy "%LUA_SOURCEPATH%\xpl*.lua" src\
xcopy "%LUA_SOURCEPATH%\xpl\*.*" src\xpl\ /Y/E
@@ -25,6 +24,10 @@ del src\xplhal.lua
rem start LuaDoc
"%LUA_SOURCEPATH%\luadoc_start.lua" -d doc src
+
+echo.
+echo Documentation generation completed. Now starting browser...
+echo.
start doc\index.html
pause
View
67 3_create_tar.bat
@@ -0,0 +1,67 @@
+@echo off
+cls
+rem ===============================================================
+rem Update the lines below with newest version information
+rem and files/directories to be included
+rem ===============================================================
+set my_version=0.1.0
+set my_rsrev=1
+set my_name=luaxpl
+set my_dir=distr
+set my_filelist=doc src test rockspec readme.txt
+rem ===============================================================
+
+echo Creating distribution files;
+echo ==============================================================
+echo Creating application: %my_name%
+echo Using version : %my_version%
+echo Rockspec revision : %my_rsrev%
+echo.
+echo If this is not correct, stop and update the initial lines of this batchfile
+echo.
+echo.
+pause
+
+rem first make sure we've got the latest and greatest...
+echo Getting the latest and greatest and starting documentation generation...
+call 2_package_and_docs.bat
+
+rem setup names and directories
+set my_target=%my_dir%\%my_name%
+set my_fileversion=%my_target%-%my_version%
+set my_fullversion=%my_fileversion%-%my_rsrev%
+
+rem delete old files
+del %my_fileversion%.tar.gz
+del %my_fileversion%.tar.gz.md5.txt
+
+rem pack files in named tar
+md %my_dir%
+"c:\program files\unxutils\tar" -c %my_filelist% > %my_target%.tar
+
+rem create dir with version and unpack there, remove intermediate file
+md %my_fileversion%
+cd %my_fileversion%
+"c:\program files\unxutils\tar" -x < ..\..\%my_target%.tar
+del ..\..\%my_target%.tar
+
+rem pack again in tar, now with initial dir including version, delete intermediate directory
+cd ..
+"c:\program files\unxutils\tar" -c %my_name%-%my_version% > ..\%my_fileversion%.tar
+rmdir /S /Q %my_name%-%my_version%
+
+
+rem now compress using gzip and delete intermediate tar file
+cd ..
+"c:\program files\unxutils\gzip" -c %my_fileversion%.tar > %my_fileversion%.tar.gz
+del %my_fileversion%.tar
+
+rem create an MD5 checksum
+"c:\program files\unxutils\md5sum" %my_fileversion%.tar.gz > %my_fileversion%.tar.gz.md5.txt
+
+echo.
+echo.
+echo Created archive : %my_fileversion%.tar.gz
+echo.
+
+pause
View
2  doc/files/src/xpl/classes/xplfilter.html
@@ -143,7 +143,7 @@
<h1>File <code>src/xpl/classes/xplfilter.lua</code></h1>
-<p>The filter object for xPL devices. It maintains a list of filters for matching incoming messages. <br/>No global will be created, it just returns the filter class. The main xPL module will create a global <code>xpl.classes.xplfilters</code> to access it.<br/>&nbsp<br/>An xpl filter is a set of xpl message elements; <code>[msgtype].[vendor].[device].[instance].[schema-class].[schema-type]</code> For each element a '<code>*</code>' can be used as a wildcard. Only arriving messages that match at least 1 filter entry will be dealt with by an xpl device.</p>
+<p>The filter object for xPL devices. It maintains a list of filters for matching incoming messages. <br/>No global will be created, it just returns the filter class. The main xPL module will create a global <code>xpl.classes.xplfilters</code> to access it.<br/>&nbsp<br/>An xpl filter is a set of xpl message elements; <code>[msgtype].[vendor].[device].[instance].[schema-class].[schema-type]</code> For each element a '<code>*</code>' can be used as a wildcard. Only arriving messages that match at least 1 filter entry will be dealt with by an xpl device.<br/>&nbsp<br/>&nbspExample (assuming <code>self</code> is an <code>xpldevice</code> object) <code><br/>&nbspself.filter = xpl.classes.xplfilters:new({})<br/>&nbspself.filter:add("xpl-cmnd.*.*.*.homeeasy.basic")<br/>&nbspself.filter:add("xpl-cmnd.*.*.*.x10.*")<br/>&nbsp</code></p>
View
2  doc/files/src/xplnetpresence.html
@@ -143,7 +143,7 @@
<h1>File <code>src/xplnetpresence.lua</code></h1>
-<p>Scans syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL. Use option <code>-help</code> for a description.<br/>&nbsp<br/>Example: <code><br/>xplnetpresence.lua -timeout=120 -hub<br/></code></p>
+<p>Commandline utility to scan syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL. Use option <code>-help</code> for a description.<br/>&nbsp<br/>Example: <code><br/>xplnetpresence.lua -timeout=240 -port=53000 -instance=RANDOM -hub<br/></code><br/>Example setup using a wireless router with DD-WRT firmware (version 'DD-WRT v24-sp2 (08/12/10) std');<br/><ul><br/><li>Enable systemlog on tab 'service / services' of the admin console and set the target ip address where xplnetpresence.lua is listening.</li><br/><li>On tab 'security / firewall' enable logging, set level 'low' and all three options (Dropped/Rejected/Accepted) to 'Enabled'.</li><br/><li>Start xplnetpresence.lua using defaults</li><br/></ul></p>
View
2  doc/files/src/xplsender.html
@@ -143,7 +143,7 @@
<h1>File <code>src/xplsender.lua</code></h1>
-<p>Commandline utility for sending xPL messages, message can be specified on the commandline (<code>-m</code> option) or send from files (<code>-f</code> option). Use option <code>-help</code> for a full description.<br/>&nbsp<br/>Example: <code><br/>xplsender.lua -f="C:\samplemsg.txt" -m="xpl-trig\n{\nhop=1\nsource=tieske-upnp.somedev\ntarget=*\n}\nsome.schema\n{\ncommand=unknown\n}\n"<br/></code></p>
+<p>Commandline utility for sending xPL messages, message can be specified on the commandline (<code>-m</code> option) or send from files (<code>-f</code> option). Use option <code>-help</code> for a full description.<br/>&nbsp<br/>Example: <code><br/>xplsender.lua -f="C:\samplemsg.txt" -m="xpl-trig\n{\nhop=1\nsource=tieske-upnp.somedev\ntarget=*\n}\nsome.schema\n{\ncommand=unknown\n}\n"<br/></code><br/>This module is standalone and has no dependencies on any other of the xPL code files. It only depends on the luasocket module.</p>
View
2  doc/index.html
@@ -185,7 +185,7 @@
<tr>
<td class="name"><a href="modules/xplnetpresence.html">xplnetpresence</a></td>
- <td class="summary">Scans syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL.</td>
+ <td class="summary">Commandline utility to scan syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL.</td>
</tr>
<tr>
View
2  doc/modules/xplfilters.html
@@ -142,7 +142,7 @@
<h1>Module <code>xplfilters</code></h1>
-<p>The filter object for xPL devices. It maintains a list of filters for matching incoming messages. <br/>No global will be created, it just returns the filter class. The main xPL module will create a global <code>xpl.classes.xplfilters</code> to access it.<br/>&nbsp<br/>An xpl filter is a set of xpl message elements; <code>[msgtype].[vendor].[device].[instance].[schema-class].[schema-type]</code> For each element a '<code>*</code>' can be used as a wildcard. Only arriving messages that match at least 1 filter entry will be dealt with by an xpl device.</p>
+<p>The filter object for xPL devices. It maintains a list of filters for matching incoming messages. <br/>No global will be created, it just returns the filter class. The main xPL module will create a global <code>xpl.classes.xplfilters</code> to access it.<br/>&nbsp<br/>An xpl filter is a set of xpl message elements; <code>[msgtype].[vendor].[device].[instance].[schema-class].[schema-type]</code> For each element a '<code>*</code>' can be used as a wildcard. Only arriving messages that match at least 1 filter entry will be dealt with by an xpl device.<br/>&nbsp<br/>&nbspExample (assuming <code>self</code> is an <code>xpldevice</code> object) <code><br/>&nbspself.filter = xpl.classes.xplfilters:new({})<br/>&nbspself.filter:add("xpl-cmnd.*.*.*.homeeasy.basic")<br/>&nbspself.filter:add("xpl-cmnd.*.*.*.x10.*")<br/>&nbsp</code></p>
<p>Copyright &copy; 2011 Thijs Schreijer</p>
View
2  doc/modules/xplnetpresence.html
@@ -142,7 +142,7 @@
<h1>Module <code>xplnetpresence</code></h1>
-<p>Scans syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL. Use option <code>-help</code> for a description.<br/>&nbsp<br/>Example: <code><br/>xplnetpresence.lua -timeout=120 -hub<br/></code></p>
+<p>Commandline utility to scan syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL. Use option <code>-help</code> for a description.<br/>&nbsp<br/>Example: <code><br/>xplnetpresence.lua -timeout=240 -port=53000 -instance=RANDOM -hub<br/></code><br/>Example setup using a wireless router with DD-WRT firmware (version 'DD-WRT v24-sp2 (08/12/10) std');<br/><ul><br/><li>Enable systemlog on tab 'service / services' of the admin console and set the target ip address where xplnetpresence.lua is listening.</li><br/><li>On tab 'security / firewall' enable logging, set level 'low' and all three options (Dropped/Rejected/Accepted) to 'Enabled'.</li><br/><li>Start xplnetpresence.lua using defaults</li><br/></ul></p>
<p>Copyright &copy; 2012 Thijs Schreijer</p>
View
2  doc/modules/xplsender.html
@@ -144,7 +144,7 @@
<h1>Module <code>xplsender.lua</code></h1>
-<p>Commandline utility for sending xPL messages, message can be specified on the commandline (<code>-m</code> option) or send from files (<code>-f</code> option). Use option <code>-help</code> for a full description.<br/>&nbsp<br/>Example: <code><br/>xplsender.lua -f="C:\samplemsg.txt" -m="xpl-trig\n{\nhop=1\nsource=tieske-upnp.somedev\ntarget=*\n}\nsome.schema\n{\ncommand=unknown\n}\n"<br/></code></p>
+<p>Commandline utility for sending xPL messages, message can be specified on the commandline (<code>-m</code> option) or send from files (<code>-f</code> option). Use option <code>-help</code> for a full description.<br/>&nbsp<br/>Example: <code><br/>xplsender.lua -f="C:\samplemsg.txt" -m="xpl-trig\n{\nhop=1\nsource=tieske-upnp.somedev\ntarget=*\n}\nsome.schema\n{\ncommand=unknown\n}\n"<br/></code><br/>This module is standalone and has no dependencies on any other of the xPL code files. It only depends on the luasocket module.</p>
<p>Copyright &copy; 2011 Thijs Schreijer</p>
View
6 readme.txt
@@ -11,5 +11,9 @@ IMPORTANT:
The current release (1.1.6) of Copas will not work becasue it does not support UDP.
You should download the HEAD revision from the github repo, or use my version at https://github.com/Tieske/copas
-If you require support, please visit http://xplproject.org.uk
+If you require support, please visit http://xplproject.org.uk or the Lua mailing list.
+License; MIT/X11 (same as Lua 5.1)
+
+Known issues
+ - xPLRun is incomplete adn non-functional
View
48 rockspec/luaxpl-0.1.0-1.rockspec
@@ -0,0 +1,48 @@
+package = "LuaxPL"
+version = "0.1.0-1"
+source = {
+ url = "https://github.com/downloads/Tieske/LuaxPL/LuaxPL-0.1.0.tar.gz",
+}
+description = {
+ summary = "xPL framework for Lua",
+ detailed = [[
+ xPL is an open source home automation protocol. LuaxPL provides
+ all the basic ingredients for building your own xPL applications.
+ Additionally it includes commandline utilities to send
+ and log xPL traffic. A device template is included and the
+ commandline utilities can be used as examples to quickly get up
+ and running. One application is included to detect occupancy of
+ a home based on smartphone detection (network connections).
+ See http://xplproject.org.uk for more information on xPL.
+ ]],
+ license = "MIT/X11",
+ homepage = "http://www.thijsschreijer.nl/blog/?page_id=537"
+}
+dependencies = {
+ "copas >= 1.1.6", -- this should be 1.1.7 or higher, but isn't released yet !!
+ "luasocket >= 2.0.0",
+ "copastimer >= 0.4.0",
+ "date >= 2.0.0",
+}
+build = {
+ type = "builtin",
+ modules = {
+ -- core modules
+ ["xpl.init"] = "src/xpl/init.lua",
+ ["xpl.new_device_template"] = "src/xpl/new_device_template.lua",
+ ["xpl.xplhub"] = "src/xpl/xplhub.lua",
+ ["xpl.xpllistener"] = "src/xpl/xpllistener.lua",
+ -- classes
+ ["xpl.classes.base"] = "src/xpl/classes/base.lua",
+ ["xpl.classes.xpldevice"] = "src/xpl/classes/xpldevice.lua",
+ ["xpl.classes.xplfilter"] = "src/xpl/classes/xplfilter.lua",
+ ["xpl.classes.xplmessage"] = "src/xpl/classes/xplmessage.lua",
+ -- commandline utilities
+ ["xpllogger"] = "src/xpllogger.lua",
+ ["xplsender"] = "src/xplsender.lua",
+ ["xplnetpresence"] = "src/xplnetpresence.lua",
+ ["xplrun"] = "src/xplrun.lua",
+ ["xplrun_config"] = "src/xplrun_config.lua",
+ },
+ copy_directories = { "doc", "test" },
+}
View
8 src/xpl/classes/xplfilter.lua
@@ -6,7 +6,13 @@
-- xPL module will create a global <code>xpl.classes.xplfilters</code> to access it.<br/>
-- <br/>An xpl filter is a set of xpl message elements; <code>[msgtype].[vendor].[device].[instance].[schema-class].[schema-type]</code>
-- For each element a '<code>*</code>' can be used as a wildcard. Only arriving messages that
--- match at least 1 filter entry will be dealt with by an xpl device.
+-- match at least 1 filter entry will be dealt with by an xpl device.<br/>
+-- <br/>
+-- Example (assuming <code>self</code> is an <code>xpldevice</code> object) <code><br/>
+-- self.filter = xpl.classes.xplfilters:new({})<br/>
+-- self.filter:add("xpl-cmnd.*.*.*.homeeasy.basic")<br/>
+-- self.filter:add("xpl-cmnd.*.*.*.x10.*")<br/>
+-- </code>
-- @class module
-- @name xplfilters
-- @copyright 2011 Thijs Schreijer
View
28 src/xplnetpresence.lua
@@ -3,11 +3,18 @@
----------------------------------------------------------------------------
-- @copyright 2012 Thijs Schreijer
-- @release Version 0.1, commandline xPL network watch utility.
--- @description# Scans syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL. Use option <code>-help</code> for a description.
+-- @description# Commandline utility to scan syslog output for MAC and IP addresses for domestic occupancy detection and notify through xPL. Use option <code>-help</code> for a description.
-- &nbsp
-- Example: <code>
--- xplnetpresence.lua -timeout=120 -hub
+-- xplnetpresence.lua -timeout=240 -port=53000 -instance=RANDOM -hub
-- </code>
+-- Example setup using a wireless router with DD-WRT firmware (version 'DD-WRT v24-sp2 (08/12/10) std');
+-- <ul>
+-- <li>Enable systemlog on tab 'service / services' of the admin console and set the target ip address where xplnetpresence.lua is listening.</li>
+-- <li>On tab 'security / firewall' enable logging, set level 'low' and all three options (Dropped/Rejected/Accepted) to 'Enabled'.</li>
+-- <li>Start xplnetpresence.lua using defaults</li>
+-- </ul>
+
module ("xplnetpresence", package.seeall)
@@ -23,23 +30,26 @@ local prog = {
Functional options;
-version Print version info
-h, -help Display this usage information
- -T, -timeout=[120] How long for a MAC or IP address not being
- anymore, before notifying device as leaving
- (in seconds)
+ -T, -timeout=[120] For a MAC or IP address not being seen anymore,
+ before notifying device as leaving (in seconds)
-M, -mac=[lua-pattern] The Lua pattern to grab the MAC address from
- the log message
+ the log message; default = "MAC=([%x:]+)"
-I, -ip=[lua-pattern] The Lua pattern to grab the IP address from
- the log message
+ the log message; default = "SRC=([%x%.:]+)"
-p, -port=[514] Port number to listen on for incoming syslog
UDP data
xPL device options
-i, -instance=HOST InstanceID to be used, or HOST to generate
hostname based id, or RANDOM for random id.
(HOST is default)
- -t, -time=[xx] How long should the program run (in seconds)
+ -t, -time=[xx] How long should the program run (in seconds),
+ default is no end time, run continously.
-H, -hub Start included xPL hub
-B, -broadcast[=255.255.255.255] Broadcast address to use for sending
+Example;
+ xplnetpresence.lua -timeout=240 -port=53000 -instance=RANDOM -hub
+
xPL interface
The message schema used is 'netpres.basic' which is a custom schema. Trigger
messages will be send upon devices arriving or departing. The 'type' key will
@@ -252,7 +262,7 @@ local function departure(device)
xpldevice:send(msg)
end
--- list a device
+-- list a device, will be called for each known device when a list command is received
local function listdevice(device)
print("List;", device.name, (device.mac or device.ip))
local msg = newmessage(device)
View
3  src/xplsender.lua
@@ -8,6 +8,7 @@
-- Example: <code>
-- xplsender.lua -f="C:\samplemsg.txt" -m="xpl-trig\n{\nhop=1\nsource=tieske-upnp.somedev\ntarget=*\n}\nsome.schema\n{\ncommand=unknown\n}\n"
-- </code>
+-- This module is standalone and has no dependencies on any other of the xPL code files. It only depends on the luasocket module.
-- @name xplsender.lua
module ("xplsender", package.seeall)
@@ -30,7 +31,7 @@ option -file and -msg may be combined and may contain multiple messages each.
]],
}
-local rocks = require ("luarocks.loader")
+--local rocks = require ("luarocks.loader")
local socket = require ("socket")
local msgs = {} -- list of messages to be sent, digested from commandline
local opt = {
Please sign in to comment.
Something went wrong with that request. Please try again.