This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

SMS not received
#8
Update the function once more, it won't spam the log with empty messages.
Code:
function AT:read(timeout)   local char, err, timeout, deftimeout, line   -- default timeout is 2 seconds, converted to 0.1 sec ticks   timeout = tonumber(timeout) or 2   timeout = timeout * 10   deftimeout = timeout   -- read until got one line or timeout occured   while timeout > 0 do     -- read 1 char     char, err = self.port:read(1, 0.1)     -- got data     if char then       -- got LF, end of line       if char == '\n' then         -- convert to string and empty buffer         line = table.concat(self.buffer)         self.buffer = {}         line = line:trim()         -- return only lines with data         if #line > 0 then           log('read line', line)           return line         -- reset timeout         else           timeout = deftimeout         end       -- ignore CR       elseif char ~= '\r' then         table.insert(self.buffer, char)       end     -- read timeout     elseif err == 'timeout' then       timeout = timeout - 1     -- other error     else       break     end   end   line = table.concat(self.buffer)   if #line > 0 then     log('read timeout', line)   end   return nil, err end

Post your logs when SMS does not reach the recipient.
Reply


Messages In This Thread
SMS not received - by andrepneves@gmail.com - 20.03.2025, 14:49
RE: SMS not received - by admin - 21.03.2025, 07:59
RE: SMS not received - by admin - 26.05.2025, 06:11
RE: SMS not received - by admin - 26.05.2025, 11:56
RE: SMS not received - by admin - 26.05.2025, 12:30
RE: SMS not received - by admin - 26.05.2025, 14:20
RE: SMS not received - by admin - 03.06.2025, 12:27

Forum Jump: