|
|
@@ -8,13 +8,11 @@ httpplus = require("httpplus")
|
|
|
local run_state = false
|
|
|
local airaudio = require "airaudio"
|
|
|
local input_method = require "InputMethod"
|
|
|
-local input_active = false
|
|
|
-local prev_fun = "main"
|
|
|
local input_key = false
|
|
|
|
|
|
-- 初始化fskv
|
|
|
|
|
|
-local speech_topic = nil -- 填写对讲号码,需要保证所有对讲设备,网页都是同一个号码
|
|
|
+local speech_topic = nil
|
|
|
local mqtt_host = "lbsmqtt.openluat.com"
|
|
|
local mqtt_port = 1886
|
|
|
local mqtt_isssl = false
|
|
|
@@ -44,8 +42,7 @@ local function init_talk()
|
|
|
log.info("init_call")
|
|
|
airaudio.init()
|
|
|
|
|
|
- speech_topic = fskv.get("talk")
|
|
|
- log.info("get speech_topic",speech_topic)
|
|
|
+
|
|
|
client_id = mobile.imei()
|
|
|
|
|
|
mqttc = mqtt.create(nil, mqtt_host, mqtt_port, mqtt_isssl, {rxSize = 4096})
|
|
|
@@ -85,9 +82,7 @@ local function submit_callback(input_text)
|
|
|
if input_text and #input_text > 0 then
|
|
|
speech_topic = input_text
|
|
|
fskv.set("talk_channel", input_text) -- 保存频道名称到fskv
|
|
|
- log.info("fskv", "频道名称保存成功:", input_text)
|
|
|
- fskv.set("talk_channel", speech_topic)
|
|
|
- log.info("talk", "使用默认频道:", speech_topic)
|
|
|
+ log.info("talk", "使用主题:", fskv.get("talk_channel"))
|
|
|
input_key = false
|
|
|
|
|
|
-- 重新初始化对讲
|
|
|
@@ -101,9 +96,8 @@ function talk.run()
|
|
|
lcd.setFont(lcd.font_opposansm12_chinese)
|
|
|
run_state = true
|
|
|
|
|
|
- if not mqttc then
|
|
|
- sys.taskInit(init_talk)
|
|
|
- end
|
|
|
+ speech_topic = fskv.get("talk_channel")
|
|
|
+ log.info("get speech_topic",speech_topic)
|
|
|
|
|
|
while run_state do
|
|
|
sys.wait(100)
|
|
|
@@ -112,7 +106,8 @@ function talk.run()
|
|
|
else
|
|
|
lcd.clear(_G.bkcolor)
|
|
|
if speech_topic == nil then
|
|
|
- lcd.drawStr(0, 80, "请填入speech_topic,并保证所有终端topic 一致")
|
|
|
+ lcd.drawStr(0, 80, "输入任意手机号,并保证所有终端/平台一致")
|
|
|
+ lcd.showImage(130, 250, "/luadb/input_topic.jpg")
|
|
|
else
|
|
|
lcd.drawStr(0, 80, "对讲测试,测试topic:"..speech_topic )
|
|
|
lcd.drawStr(0, 120, "所有终端或者网页都要使用同一个topic")
|
|
|
@@ -126,6 +121,7 @@ function talk.run()
|
|
|
lcd.showImage(0, 448, "/luadb/Lbottom.jpg")
|
|
|
-- log.info("flush ui")
|
|
|
end
|
|
|
+ lcd.showImage(20,360,"/luadb/back.jpg")
|
|
|
lcd.flush()
|
|
|
end
|
|
|
|
|
|
@@ -159,16 +155,16 @@ end
|
|
|
function talk.tp_handal(x, y, event)
|
|
|
if input_key then
|
|
|
input_method.process_touch(x, y)
|
|
|
- end
|
|
|
-
|
|
|
- if x > 20 and x < 100 and y > 360 and y < 440 then
|
|
|
- run_state = false
|
|
|
- elseif x > 130 and x < 230 and y > 350 and y < 397 then
|
|
|
- sysplus.taskInitEx(start_talk, "start_talk")
|
|
|
- elseif x > 130 and x < 230 and y > 397 and y < 444 then
|
|
|
- sysplus.taskInitEx(stop_talk, "stop_talk")
|
|
|
- elseif x > 130 and x < 230 and y > 250 and y < 300 then
|
|
|
- sysplus.taskInitEx(start_input,"start_input")
|
|
|
+ else
|
|
|
+ if x > 20 and x < 100 and y > 360 and y < 440 then
|
|
|
+ run_state = false
|
|
|
+ elseif x > 130 and x < 230 and y > 350 and y < 397 then
|
|
|
+ sysplus.taskInitEx(start_talk, "start_talk")
|
|
|
+ elseif x > 130 and x < 230 and y > 397 and y < 444 then
|
|
|
+ sysplus.taskInitEx(stop_talk, "stop_talk")
|
|
|
+ elseif x > 130 and x < 230 and y > 250 and y < 300 then
|
|
|
+ sysplus.taskInitEx(start_input,"start_input")
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
|