2e0627ec83f9194838ddc8f61cee44156b45bcec
[project/luci.git] / applications / luci-uvc_streamer / luasrc / model / cbi / uvc_streamer.lua
1 --[[
2
3 LuCI UVC Streamer
4 (c) 2008 Yanira <forum-2008@email.de>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 ]]--
15
16 -- find current lan address and port of first uvc_streamer config section
17 local uci  = luci.model.uci.cursor_state()
18 local addr = uci:get("network", "lan", "ipaddr")
19 local port
20
21 uci:foreach( "uvc_streamer", "uvc_streamer",
22         function(section) port = port or tonumber(section.port) end )
23
24 addr = addr or "192.168.1.1"
25 port = port or 8080
26
27 m = Map("uvc_streamer", translate("uvc_streamer"),
28         translatef("uvc_streamer_desc", nil, addr, port, addr, port))
29
30 s = m:section(TypedSection, "uvc_streamer", translate("settings"))
31 s.addremove = false
32 s.anonymous = true
33
34 s:option(Flag, "enabled", translate("enabled", "Enable"))
35
36 s:option(Value, "device", translate("device")).rmempty = true
37
38 nm = s:option(Value, "resolution", translate("resolution"))
39 nm:value("640x480")
40 nm:value("320x240")
41 nm:value("160x120")
42
43 s:option(Value, "framespersecond", translate("framespersecond")).rmempty = true
44
45 s:option(Value, "port", translate("port", "Port")).rmempty = true
46
47 return m