mirror of
https://github.com/zhaojh329/rtty.git
synced 2026-02-27 09:53:17 +08:00
add command line option for client
Signed-off-by: zhaojh329 <jianhuizhao329@gmail.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
config base
|
||||
option mqtt_hostname 'jianhuizhao.f3322.net'
|
||||
option mqtt_port '8883'
|
||||
Regular → Executable
+13
-1
@@ -5,9 +5,21 @@ START=99
|
||||
|
||||
BIN=/usr/sbin/xterminal_device
|
||||
|
||||
mqtt_hostname=
|
||||
mqtt_port=
|
||||
|
||||
parse_conf() {
|
||||
local cfg=$1
|
||||
config_get mqtt_hostname "$cfg" "mqtt_hostname"
|
||||
config_get mqtt_port "$cfg" "mqtt_port"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load xterminal
|
||||
config_foreach parse_conf base
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command $BIN br-lan
|
||||
procd_set_param command $BIN br-lan "$mqtt_hostname:$mqtt_port"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ local loop = ev.Loop.default
|
||||
|
||||
local mgr = evmg.init()
|
||||
local ifname = arg[1] or "eth0"
|
||||
local server = arg[2] or "localhost:1883"
|
||||
|
||||
local devid = nil
|
||||
local session = {}
|
||||
|
||||
@@ -91,7 +93,7 @@ end
|
||||
|
||||
print("devid:", devid)
|
||||
|
||||
mgr:connect("localhost:1883", ev_handle)
|
||||
mgr:connect(server, ev_handle)
|
||||
|
||||
ev.Signal.new(function(loop, sig, revents)
|
||||
loop:unloop()
|
||||
|
||||
Reference in New Issue
Block a user