Author: titmuss
Date: Tue Apr 1 07:44:03 2008
New Revision: 2163
URL: http://svn.slimdevices.com?rev=2163&root=Jive&view=rev
Log:
Bug: 5378
Description:
Actually add the wake on lan file!
Added:
trunk/squeezeplay/src/squeezeplay/share/jive/net/WakeOnLan.lua
Added: trunk/squeezeplay/src/squeezeplay/share/jive/net/WakeOnLan.lua
URL:
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay/share/jive/net/WakeOnLan.lua?rev=2163&root=Jive&view=auto
==============================================================================
--- trunk/squeezeplay/src/squeezeplay/share/jive/net/WakeOnLan.lua (added)
+++ trunk/squeezeplay/src/squeezeplay/share/jive/net/WakeOnLan.lua Tue Apr 1
07:44:03 2008
@@ -1,0 +1,34 @@
+
+
+local tonumber = tonumber
+
+
+local oo = require("loop.simple")
+local string = require("string")
+local table = require("table")
+
+local SocketUdp = require("jive.net.SocketUdp")
+
+local log = require("jive.utils.log").logger("net.http")
+
+
+module(...)
+oo.class(_M, SocketUdp)
+
+
+function __init(self, jnt)
+ return oo.rawnew(self, SocketUdp(jnt, function() end))
+end
+
+
+function wakeOnLan(self, hwaddr)
+ local mac = {}
+ for v in string.gmatch(hwaddr, "(%x%x)") do
+ mac[#mac + 1] = string.char(tonumber(v, 16))
+ end
+ mac = table.concat(mac)
+
+ local packet = string.rep(string.char(0xFF), 6) .. string.rep(mac, 16)
+
+ self:send(function() return packet end, "255.255.255.255", 7)
+end
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins