Sending EOF using the SimpleSerial

Hello,

I have set a sms module to work with SimpleSerial plugin, and the serial communication is working. However, to send sms I need to end my message with CTRL+Z (which is 0x1A hexadecimal and signals the end of message to the module). I have tried to send a variety of equivalent forms of this character through the send command, but none of them works (especially, I tried \026, \x1A with no luck).

Can someone please give me a pointer as to how modify the implementation code to be able to do this?

Cheers,
Mona

Ok- so I worked around the problem by modifying the I_SimpleSerial.xml implementation file as below.

local message = lul_settings.Message or ""
luup.log("Send: '"..message.."'")
if (message == "") then
	luup.variable_set("urn:micasaverde-com:serviceId:SimpleSerial1", "Received", "message was empty- assumed ctrl+z", lul_device)
        luup.io.write(string.char(0x1a))
elseif (not luup.io.write(lul_settings.Message)) then
	luup.log("Could not send the message.")
	luup.variable_set("urn:micasaverde-com:serviceId:SimpleSerial1", "Received", "couldn't send message", lul_device)
end

Actually, it now send the hex code 0x1a whenever I send an empty message. I would love to know if anyone has a better idea :slight_smile: