function run_read_com()
local sv = CTNString();
local sDlgUI = CTNString();
local sDlgName = CTNString();
while true do
while true do
if ui:allThreadStop() then return end
if ui:getActiveDialog(sDlgUI, sDlgName) == false then
break;
end
sv:set('');
if ui:readCom('read_qr_code', sv, 1000) <= 0 then
cutil:sleep(1000);
end
if string.len(sv:get()) <= 0 then
break;
end
sTmp = sv:get();
sTmp = string.gsub(sTmp, '\r', '');
sTmp = string.gsub(sTmp, '\n', '');
print('read barcode:'..sTmp)
end
cutil:sleep(500);
end
end
ui:run('run_read_com()', '');