EasyManuals Logo

Digi IX14 User Manual

Digi IX14
828 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #494 background imageLoading...
Page #494 background image
Applications Use the Paho MQTTpython library
IX14 User Guide
494
POLL_TIME = 60
def cmd_reboot(params):
print("Rebooting unit...")
try:
cli.execute("reboot", 10)
except:
print("Failed to run 'reboot' command")
return HTTPStatus.INTERNAL_SERVER_ERROR
return HTTPStatus.OK
def cmd_fwupdate(params):
try:
fw_uri = params["uri"]
except:
print("Firmware file URI not passed")
return HTTPStatus.BAD_REQUEST
print("Request to update firmware with URI: {}".format(fw_uri))
try:
fd, fname = tempfile.mkstemp()
os.close(fd)
try:
urllib.request.urlretrieve(fw_uri, fname)
except:
print("Failed to download FW file from URI {}".format(fw_uri))
return HTTPStatus.NOT_FOUND
try:
ret = cli.execute("system firmware update file " + fname, 60)
except:
print("Failed to run firmware update command")
return HTTPStatus.INTERNAL_SERVER_ERROR
if not "Firmware update completed" in ret:
print("Failed to update firmware")
return HTTPStatus.INTERNAL_SERVER_ERROR
finally:
os.remove(fname)
print("Firmware update finished")
return HTTPStatus.OK
CMD_HANDLERS = {
"reboot": cmd_reboot,
"fw-update": cmd_fwupdate
}
def send_cmd_reply(client, cmd_path, cid, cmd, status):
if not status or not cid:
return
if cmd_path.startswith(PREFIX_CMD):
path = cmd_path[len(PREFIX_CMD):]
else:
print("Invalid command path ({}), cannot send reply".format(cmd_path))

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Digi IX14 and is the answer not in the manual?

Digi IX14 Specifications

General IconGeneral
BrandDigi
ModelIX14
CategoryNetwork Router
LanguageEnglish

Related product manuals