diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py index 77ae2a59db2..c91d17364ce 100644 --- a/addons/hw_escpos/controllers/main.py +++ b/addons/hw_escpos/controllers/main.py @@ -193,6 +193,8 @@ class EscposDriver(Thread): def print_status(self,eprint): localips = ['0.0.0.0','127.0.0.1','127.0.1.1'] + hosting_ap = os.system('pgrep hostapd') == 0 + ssid = subprocess.check_output('iwconfig 2>&1 | grep \'ESSID:"\' | sed \'s/.*"\\(.*\\)"/\\1/\'', shell=True).rstrip() ips = [ c.split(':')[1].split(' ')[0] for c in commands.getoutput("/sbin/ifconfig").split('\n') if 'inet addr' in c ] ips = [ ip for ip in ips if ip not in localips ] eprint.text('\n\n') @@ -201,6 +203,11 @@ class EscposDriver(Thread): eprint.text('\n') eprint.set(align='center') + if hosting_ap: + eprint.text('Wireless network:\nPosbox\n\n') + elif ssid: + eprint.text('Wireless network:\n' + ssid + '\n\n') + if len(ips) == 0: eprint.text('ERROR: Could not connect to LAN\n\nPlease check that the PosBox is correc-\ntly connected with a network cable,\n that the LAN is setup with DHCP, and\nthat network addresses are available') elif len(ips) == 1: diff --git a/addons/hw_posbox_homepage/controllers/main.py b/addons/hw_posbox_homepage/controllers/main.py index a021986bee7..26509d8d58a 100644 --- a/addons/hw_posbox_homepage/controllers/main.py +++ b/addons/hw_posbox_homepage/controllers/main.py @@ -2,6 +2,8 @@ import logging import os import time +import werkzeug +import subprocess from os import listdir import openerp @@ -43,6 +45,9 @@ index_template = """ to the hardware status page.
+ Wi-Fi can be configured by visiting the Wi-Fi configuration page. +
+The PosBox software installed on this posbox is version 13, the posbox version number is independent from Odoo. You can upgrade the software on the upgrade page. @@ -60,4 +65,100 @@ class PosboxHomepage(openerp.addons.web.controllers.main.Home): def index(self): #return request.render('hw_posbox_homepage.index',mimetype='text/html') return index_template - + + @http.route('/wifi', type='http', auth='none', website=True) + def wifi(self): + wifi_template = """ + + +
++ Here you can configure how the posbox should connect to wireless networks. + Currently only Open and WPA networks are supported. When enabling the persistent checkbox, + the chosen network will be saved and the posbox will attempt to connect to it every time it boots. +
+ ++ You can clear the persistent configuration by clicking below: +
+ +