Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def sendMessage(message):
# format message string
fullMessage = formatMsg(message, DEVICEKEY)
# C8 - Start hologram TCP connection
if not sendCommand("AT+CIPSTART=1,\"TCP\",\"" + ip() + "\",\"" + port() + "\"\r\n", 75, "OK", "FAIL"):
return False
# C9 - Set message length
msgLength = len(fullMessage)
if not sendCommand("AT+CIPSEND=1," + str(msgLength) + "\r\n", 5, ">"):
return False
# C10 - Send string to server
if not sendCommand(fullMessage, 60, "OK", "FAIL"):
return False
return True