| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# |
| 3 |
# (c) Copyright 2001-2015 HP Development Company, L.P. |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 2 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 |
# |
| 19 |
# Authors: Don Welch |
| 20 |
# |
| 21 |
|
| 22 |
# StdLib |
| 23 |
import operator |
| 24 |
import signal |
| 25 |
|
| 26 |
# Local |
| 27 |
from base.g import * |
| 28 |
from base import device, models, wifi, LedmWifi, CdmWifi |
| 29 |
from base.codes import * |
| 30 |
from base.sixext import to_unicode |
| 31 |
from .ui_utils import * |
| 32 |
from base.sixext import PY3, to_bytes_utf8, to_unicode, to_string_latin, to_string_utf8, xStringIO |
| 33 |
|
| 34 |
# Qt |
| 35 |
from PyQt5.QtCore import * |
| 36 |
from PyQt5.QtGui import * |
| 37 |
|
| 38 |
# Ui |
| 39 |
from .wifisetupdialog_base import Ui_Dialog |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
PAGE_INTRO = 0 # Ask user to plugin temp USB connection |
| 44 |
PAGE_DEVICES = 1 # Select a probed USB device |
| 45 |
PAGE_NETWORK = 2 # Select a discovered SSID |
| 46 |
PAGE_CONFIGURE_WIFI = 3 # Configure USB device on network |
| 47 |
PAGE_EXIT = 4 # Tell user if successful, unplug USB onnection |
| 48 |
|
| 49 |
|
| 50 |
BUTTON_NEXT = 0 |
| 51 |
BUTTON_FINISH = 1 |
| 52 |
BUTTON_CONNECT = 3 |
| 53 |
|
| 54 |
SUCCESS_NOT_CONNECTED = 0 |
| 55 |
SUCCESS_AUTO_IP = 1 |
| 56 |
SUCCESS_CONNECTED = 2 |
| 57 |
|
| 58 |
ASSOCIATE_DELAY = 30 |
| 59 |
REFRESH_INTERVAL = 20 |
| 60 |
|
| 61 |
|
| 62 |
class PasswordDialog(QDialog): |
| 63 |
def __init__(self, prompt, parent=None, name=None, modal=0, fl=0): |
| 64 |
QDialog.__init__(self, parent) |
| 65 |
# Application icon |
| 66 |
self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128'))) |
| 67 |
self.prompt = prompt |
| 68 |
|
| 69 |
Layout= QGridLayout(self) |
| 70 |
Layout.setContentsMargins(10,10,10,10) |
| 71 |
Layout.setSpacing(6) |
| 72 |
|
| 73 |
self.PromptTextLabel = QLabel(self) |
| 74 |
Layout.addWidget(self.PromptTextLabel,0,0,1,3) |
| 75 |
|
| 76 |
self.UsernameTextLabel = QLabel(self) |
| 77 |
Layout.addWidget(self.UsernameTextLabel,1,0) |
| 78 |
|
| 79 |
self.UsernameLineEdit = QLineEdit(self) |
| 80 |
self.UsernameLineEdit.setEchoMode(QLineEdit.Normal) |
| 81 |
Layout.addWidget(self.UsernameLineEdit,1,1,1,2) |
| 82 |
|
| 83 |
self.PasswordTextLabel = QLabel(self) |
| 84 |
Layout.addWidget(self.PasswordTextLabel,2,0) |
| 85 |
|
| 86 |
self.PasswordLineEdit = QLineEdit(self) |
| 87 |
self.PasswordLineEdit.setEchoMode(QLineEdit.Password) |
| 88 |
Layout.addWidget(self.PasswordLineEdit,2,1,1,2) |
| 89 |
|
| 90 |
self.OkPushButton = QPushButton(self) |
| 91 |
Layout.addWidget(self.OkPushButton,3,2) |
| 92 |
|
| 93 |
self.languageChange() |
| 94 |
|
| 95 |
self.resize(QSize(420,163).expandedTo(self.minimumSizeHint())) |
| 96 |
|
| 97 |
self.OkPushButton.clicked.connect(self.accept) |
| 98 |
self.PasswordLineEdit.returnPressed.connect(self.accept) |
| 99 |
|
| 100 |
def setDefaultUsername(self, defUser, allowUsernameEdit = True): |
| 101 |
self.UsernameLineEdit.setText(defUser) |
| 102 |
if not allowUsernameEdit: |
| 103 |
self.UsernameLineEdit.setReadOnly(True) |
| 104 |
self.UsernameLineEdit.setStyleSheet("QLineEdit {background-color: lightgray}") |
| 105 |
|
| 106 |
def getUsername(self): |
| 107 |
return to_unicode(self.UsernameLineEdit.text()) |
| 108 |
|
| 109 |
|
| 110 |
def getPassword(self): |
| 111 |
return to_unicode(self.PasswordLineEdit.text()) |
| 112 |
|
| 113 |
|
| 114 |
def languageChange(self): |
| 115 |
self.setWindowTitle(self.__tr("HP Device Manager - Enter Username/Password")) |
| 116 |
self.PromptTextLabel.setText(self.__tr(self.prompt)) |
| 117 |
self.UsernameTextLabel.setText(self.__tr("Username:")) |
| 118 |
self.PasswordTextLabel.setText(self.__tr("Password:")) |
| 119 |
self.OkPushButton.setText(self.__tr("OK")) |
| 120 |
|
| 121 |
|
| 122 |
def __tr(self,s,c = None): |
| 123 |
return qApp.translate("SetupDialog",s,c) |
| 124 |
|
| 125 |
def showPasswordUI(prompt, userName=None, allowUsernameEdit=True): |
| 126 |
try: |
| 127 |
dlg = PasswordDialog(prompt, None) |
| 128 |
|
| 129 |
if userName != None: |
| 130 |
dlg.setDefaultUsername(userName, allowUsernameEdit) |
| 131 |
|
| 132 |
if dlg.exec_() == QDialog.Accepted: |
| 133 |
return (1,dlg.getUsername(), dlg.getPassword()) |
| 134 |
else: |
| 135 |
return (0,"", "") |
| 136 |
finally: |
| 137 |
pass |
| 138 |
|
| 139 |
return (0,"", "") |
| 140 |
|
| 141 |
|
| 142 |
class DeviceTableWidgetItem(QTableWidgetItem): |
| 143 |
def __init__(self, text, device_uri): |
| 144 |
QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType) |
| 145 |
self.device_uri = device_uri |
| 146 |
|
| 147 |
|
| 148 |
class WifiSetupDialog(QDialog, Ui_Dialog): |
| 149 |
|
| 150 |
itemSelectionChanged = pyqtSignal() |
| 151 |
def __init__(self, parent, device_uri=None, standalone=True): |
| 152 |
QDialog.__init__(self, parent) |
| 153 |
self.setupUi(self) |
| 154 |
|
| 155 |
self.device_uri = device_uri |
| 156 |
self.devices = {} |
| 157 |
self.networks = {} |
| 158 |
self.ssid = '' |
| 159 |
self.directed = False |
| 160 |
self.show_extended = False |
| 161 |
self.bus = 'usb' |
| 162 |
self.search = '' |
| 163 |
self.max_page = PAGE_EXIT |
| 164 |
self.location_cache = {} # { 'bssid' : <location>, ... } |
| 165 |
self.dev = None |
| 166 |
self.success = SUCCESS_NOT_CONNECTED |
| 167 |
self.ip = '0.0.0.0' |
| 168 |
self.hn = '' |
| 169 |
self.standalone = standalone |
| 170 |
self.initUi() |
| 171 |
self.adapterName = 'Wifi0' |
| 172 |
self.wifiObj = wifi |
| 173 |
self.wifiConfVal = WIFI_CONFIG_LEDM |
| 174 |
#if self.device_uri is None: |
| 175 |
# QTimer.singleShot(0, self.showIntroPage) |
| 176 |
#else: |
| 177 |
# QTimer.singleShot(0, self.showNetworkPage) |
| 178 |
|
| 179 |
QTimer.singleShot(0, self.showIntroPage) |
| 180 |
|
| 181 |
|
| 182 |
# |
| 183 |
# INIT |
| 184 |
# |
| 185 |
|
| 186 |
def initUi(self): |
| 187 |
self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128'))) |
| 188 |
|
| 189 |
# connect signals/slots |
| 190 |
# self.CancelButton.clicked.connect(self.CancelButton_clicked) |
| 191 |
self.CancelButton.clicked.connect(self.CancelButton_clicked) |
| 192 |
self.BackButton.clicked.connect(self.BackButton_clicked) |
| 193 |
self.NextButton.clicked.connect(self.NextButton_clicked) |
| 194 |
signal.signal(signal.SIGINT, signal.SIG_DFL) |
| 195 |
|
| 196 |
self.initIntroPage() |
| 197 |
self.initDevicesPage() |
| 198 |
self.initNetworkPage() |
| 199 |
self.initConfigWifiPage() |
| 200 |
self.initExitPage() |
| 201 |
|
| 202 |
# |
| 203 |
# INTRO PAGE |
| 204 |
# |
| 205 |
|
| 206 |
def initIntroPage(self): |
| 207 |
self.Picture.setPixmap(load_pixmap("usb_connection", "other")) |
| 208 |
self.InfoIcon.setPixmap(load_pixmap("info", "16x16")) |
| 209 |
|
| 210 |
if self.standalone: |
| 211 |
self.MainTitleLabel.setText(self.__tr("This utility allows you configure your wireless capable printer using a temporary USB connection. You will be prompted to disconnect the USB cable once wireless network setup is complete. <p><i>Note: This configuration utility does not setup (install) your printer on this computer. Use hp-setup to setup your printer after it has been configured on the network by this utility.</i></p> <p><i>Note: Only select wireless capable printers are supported by this utility.</i></p>")) |
| 212 |
else: |
| 213 |
self.MainTitleLabel.setText(self.__tr("This utility allows you configure your wireless capable printer using a temporary USB connection. You will be prompted to disconnect the USB cable once wireless network setup is complete. <p><i>Note: Printer setup (installation) will continue after your printer is configured on the network.</i></p> <p><i>Note: Only select wireless capable printers are supported by this utility.</i></p>")) |
| 214 |
|
| 215 |
|
| 216 |
def showIntroPage(self): |
| 217 |
self.BackButton.setEnabled(False) |
| 218 |
self.NextButton.setEnabled(True) |
| 219 |
|
| 220 |
self.displayPage(PAGE_INTRO) |
| 221 |
|
| 222 |
|
| 223 |
# |
| 224 |
# DEVICES PAGE |
| 225 |
# |
| 226 |
|
| 227 |
def initDevicesPage(self): |
| 228 |
self.RefreshButton.clicked.connect(self.RefreshButton_clicked) |
| 229 |
|
| 230 |
|
| 231 |
def showDevicesPage(self): |
| 232 |
self.BackButton.setEnabled(True) |
| 233 |
self.setNextButton(BUTTON_NEXT) |
| 234 |
|
| 235 |
beginWaitCursor() |
| 236 |
try: |
| 237 |
if not self.devices: |
| 238 |
log.info("Searching on USB bus...") |
| 239 |
filter_dict = {'wifi-config' : (operator.gt, WIFI_CONFIG_NONE)} |
| 240 |
|
| 241 |
try: |
| 242 |
from base import smart_install |
| 243 |
except ImportError: |
| 244 |
log.error("Failed to Import smart_install.py from base") |
| 245 |
else: |
| 246 |
endWaitCursor() |
| 247 |
smart_install.disable(GUI_MODE, 'qt4') |
| 248 |
beginWaitCursor() |
| 249 |
|
| 250 |
self.devices = device.probeDevices([self.bus], 0, 0, filter_dict, self.search) |
| 251 |
|
| 252 |
finally: |
| 253 |
endWaitCursor() |
| 254 |
|
| 255 |
self.clearDevicesTable() |
| 256 |
|
| 257 |
if self.devices: |
| 258 |
self.NextButton.setEnabled(True) |
| 259 |
self.DevicesFoundIcon.setPixmap(load_pixmap('info', '16x16')) |
| 260 |
|
| 261 |
if len(self.devices) == 1: |
| 262 |
self.DevicesFoundLabel.setText(self.__tr("<b>1 wireless capable device found.</b> Click <i>Next</i> to continue.")) |
| 263 |
else: |
| 264 |
self.DevicesFoundLabel.setText(self.__tr("<b>%s wireless capable devices found.</b> Select the device to install and click <i>Next</i> to continue." % len(self.devices))) |
| 265 |
|
| 266 |
self.loadDevicesTable() |
| 267 |
|
| 268 |
else: |
| 269 |
self.NextButton.setEnabled(False) |
| 270 |
self.DevicesFoundIcon.setPixmap(load_pixmap('error', '16x16')) |
| 271 |
log.error("No devices found on bus: %s" % self.bus) |
| 272 |
self.DevicesFoundLabel.setText(self.__tr("<b>No wireless capable devices found.</b><br>Plug in your printer with a USB cable and click <i>Refresh</i> to search again.")) |
| 273 |
|
| 274 |
self.displayPage(PAGE_DEVICES) |
| 275 |
|
| 276 |
|
| 277 |
def loadDevicesTable(self): |
| 278 |
self.DevicesTableWidget.setSortingEnabled(False) |
| 279 |
self.DevicesTableWidget.setRowCount(len(self.devices)) |
| 280 |
|
| 281 |
headers = [self.__tr('Model'), self.__tr('Device URI')] |
| 282 |
device_uri_col = 1 |
| 283 |
|
| 284 |
self.DevicesTableWidget.setColumnCount(len(headers)) |
| 285 |
self.DevicesTableWidget.setHorizontalHeaderLabels(headers) |
| 286 |
flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled |
| 287 |
|
| 288 |
for row, d in enumerate(self.devices): |
| 289 |
back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(d) |
| 290 |
model_ui = models.normalizeModelUIName(model) |
| 291 |
|
| 292 |
i = DeviceTableWidgetItem(str(model_ui), d) |
| 293 |
i.setFlags(flags) |
| 294 |
self.DevicesTableWidget.setItem(row, 0, i) |
| 295 |
|
| 296 |
i = QTableWidgetItem(str(d)) |
| 297 |
i.setFlags(flags) |
| 298 |
self.DevicesTableWidget.setItem(row, device_uri_col, i) |
| 299 |
|
| 300 |
self.DevicesTableWidget.resizeColumnsToContents() |
| 301 |
self.DevicesTableWidget.setSortingEnabled(True) |
| 302 |
self.DevicesTableWidget.sortItems(0) |
| 303 |
self.DevicesTableWidget.selectRow(0) |
| 304 |
|
| 305 |
|
| 306 |
def clearDevicesTable(self): |
| 307 |
self.DevicesTableWidget.clear() |
| 308 |
self.DevicesTableWidget.setRowCount(0) |
| 309 |
self.DevicesTableWidget.setColumnCount(0) |
| 310 |
|
| 311 |
|
| 312 |
def RefreshButton_clicked(self): |
| 313 |
self.clearDevicesTable() |
| 314 |
self.devices = [] |
| 315 |
QTimer.singleShot(0, self.showDevicesPage) |
| 316 |
|
| 317 |
|
| 318 |
# |
| 319 |
# NETWORK |
| 320 |
# |
| 321 |
|
| 322 |
def initNetworkPage(self): |
| 323 |
self.NetworksTableWidget.setIconSize(QSize(34, 20)) |
| 324 |
self.ShowExtendedCheckBox.setChecked(False) |
| 325 |
self.ShowExtendedCheckBox.clicked[bool].connect(self.ShowExtendedCheckBox_clicked) |
| 326 |
self.SearchPushButton.clicked.connect(self.SearchPushButton_clicked) |
| 327 |
self.UndirectedRadioButton.clicked[bool].connect(self.UndirectedRadioButton_clicked) |
| 328 |
self.DirectedRadioButton.clicked[bool].connect(self.DirectedRadioButton_clicked) |
| 329 |
self.NetworksTableWidget.itemSelectionChanged.connect(self.NetworksTableWidget_itemSelectionChanged) |
| 330 |
|
| 331 |
|
| 332 |
def showNetworkPage(self): |
| 333 |
if self.dev is None: |
| 334 |
try: |
| 335 |
self.dev = device.Device(self.device_uri) |
| 336 |
except Error as e: |
| 337 |
FailureUI(self, self.__tr("<b>Error opening device:</b><p>%s</p><p>(%s)</p>") %(self.device_uri, str(e))) |
| 338 |
|
| 339 |
if self.dev is not None: |
| 340 |
self.dev.close() |
| 341 |
|
| 342 |
self.close() |
| 343 |
return |
| 344 |
|
| 345 |
self.networks.clear() |
| 346 |
self.num_networks = 0 |
| 347 |
|
| 348 |
#Get authentication token |
| 349 |
if self.wifiObj == CdmWifi: |
| 350 |
if self.wifiObj.getCDMToken_pushbutton(self.dev): |
| 351 |
log.debug("authenticated via getCDMToken_pushbutton") |
| 352 |
else: |
| 353 |
prompt = "Enter printer's username and password" |
| 354 |
while True: |
| 355 |
rtnvalue,uname, password = showPasswordUI(prompt,userName="administrator") |
| 356 |
if rtnvalue == 0: |
| 357 |
return |
| 358 |
ret = self.wifiObj.getCDMToken(self.dev, uname, password) |
| 359 |
if ret == True: |
| 360 |
break |
| 361 |
prompt = "Invalid Username/Password\n.Please renter printer's username and password" |
| 362 |
|
| 363 |
try: |
| 364 |
adaptor_list = self.wifiObj.getWifiAdaptorID(self.dev) |
| 365 |
except Error as e: |
| 366 |
self.showIOError(e) |
| 367 |
return |
| 368 |
|
| 369 |
if len(adaptor_list) == 0: |
| 370 |
FailureUI(self, self.__tr("<b>Unable to locate wireless hardware on device.</b>")) |
| 371 |
if self.dev is not None: |
| 372 |
self.dev.close() |
| 373 |
|
| 374 |
self.close() |
| 375 |
|
| 376 |
log.debug("Turning on wireless radio...") |
| 377 |
try: |
| 378 |
self.adaptor_id, self.adapterName, state, presence = self.wifiObj.setAdaptorPower(self.dev, adaptor_list ) |
| 379 |
except Error as e: |
| 380 |
self.showIOError(e) |
| 381 |
return |
| 382 |
if self.adaptor_id == -1: |
| 383 |
FailureUI(self, self.__tr("<b>Unable to turn on wireless adaptor.</b>")) |
| 384 |
if self.dev is not None: |
| 385 |
self.dev.close() |
| 386 |
|
| 387 |
log.debug("Adaptor ID: %s" % self.adaptor_id) |
| 388 |
log.debug("Adaptor name: %s" % self.adapterName) |
| 389 |
log.debug("Adaptor state: %s" % state) |
| 390 |
log.debug("Adaptor presence: %s" % presence) |
| 391 |
|
| 392 |
self.performScan() |
| 393 |
self.setNextButton(BUTTON_NEXT) |
| 394 |
self.displayPage(PAGE_NETWORK) |
| 395 |
|
| 396 |
|
| 397 |
def performScan(self): |
| 398 |
beginWaitCursor() |
| 399 |
try: |
| 400 |
self.ssid = to_unicode(self.SSIDLineEdit.text()) |
| 401 |
if self.directed and self.ssid: |
| 402 |
try: |
| 403 |
self.networks = self.wifiObj.performScan(self.dev, self.adapterName, self.ssid) |
| 404 |
except Error as e: |
| 405 |
self.showIOError(e) |
| 406 |
return |
| 407 |
else: |
| 408 |
try: |
| 409 |
self.networks = self.wifiObj.performScan(self.dev, self.adapterName) |
| 410 |
except Error as e: |
| 411 |
self.showIOError(e) |
| 412 |
return |
| 413 |
finally: |
| 414 |
self.dev.close() |
| 415 |
endWaitCursor() |
| 416 |
self.num_networks = self.networks['numberofscanentries'] |
| 417 |
self.clearNetworksTable() |
| 418 |
|
| 419 |
if self.num_networks: |
| 420 |
self.NextButton.setEnabled(True) |
| 421 |
self.NetworksFoundIcon.setPixmap(load_pixmap('info', '16x16')) |
| 422 |
|
| 423 |
if self.num_networks == 1: |
| 424 |
self.NetworksFoundLabel.setText(self.__tr("<b>1 wireless network found. </b> If the wireless network you would like to connect to is not listed, try entering a wireless network name and/or press <i>Search</i> to search again.")) |
| 425 |
else: |
| 426 |
self.NetworksFoundLabel.setText(self.__tr("<b>%d wireless networks found.</b> If the wireless network you would like to connect to is not listed, try entering a wireless network name and/or press <i>Search</i> to search again." %self.num_networks)) |
| 427 |
|
| 428 |
self.loadNetworksTable() |
| 429 |
|
| 430 |
else: |
| 431 |
self.NextButton.setEnabled(False) |
| 432 |
self.NetworksFoundIcon.setPixmap(load_pixmap('error', '16x16')) |
| 433 |
log.warning("No wireless networks found.") |
| 434 |
self.NetworksFoundLabel.setText(self.__tr("<b>No wireless networks found.</b><br>Enter a wireless network name and/or press <i>Search</i> to search again.")) |
| 435 |
|
| 436 |
|
| 437 |
def ShowExtendedCheckBox_clicked(self, b): |
| 438 |
self.show_extended = b |
| 439 |
self.loadNetworksTable() |
| 440 |
|
| 441 |
|
| 442 |
def SearchPushButton_clicked(self): |
| 443 |
self.performScan() |
| 444 |
self.loadNetworksTable() |
| 445 |
|
| 446 |
|
| 447 |
def UndirectedRadioButton_clicked(self, b): |
| 448 |
self.directed = not b |
| 449 |
self.SSIDLineEdit.setEnabled(not b) |
| 450 |
|
| 451 |
|
| 452 |
def DirectedRadioButton_clicked(self, b): |
| 453 |
self.directed = b |
| 454 |
self.SSIDLineEdit.setEnabled(b) |
| 455 |
|
| 456 |
|
| 457 |
def loadNetworksTable(self): |
| 458 |
self.n, self.network = 0, to_unicode('') |
| 459 |
if self.num_networks: |
| 460 |
beginWaitCursor() |
| 461 |
try: |
| 462 |
if self.show_extended: |
| 463 |
for n in range(self.num_networks): |
| 464 |
bssid = self.networks['bssid-%d' % n] |
| 465 |
ss = self.networks['signalstrength-%d' % n] |
| 466 |
try: |
| 467 |
self.location_cache[bssid] |
| 468 |
except KeyError: |
| 469 |
location = wifi.getLocation(bssid, ss) |
| 470 |
lat = self.networks['latitude-%d' % n] = location.get('latitude', 'Unknown') |
| 471 |
lng = self.networks['longitude-%d' % n] = location.get('longitude', 'Unknown') |
| 472 |
address = self.networks['address-%d' % n] = location.get('address', 'Unknown') |
| 473 |
self.location_cache[bssid] = (lat, lng, address) |
| 474 |
else: |
| 475 |
self.networks['latitude-%d' % n], self.networks['longitude-%d' % n], self.networks['address-%d' % n] = \ |
| 476 |
self.location_cache[bssid] |
| 477 |
|
| 478 |
self.NetworksTableWidget.setSortingEnabled(False) |
| 479 |
self.NetworksTableWidget.setRowCount(self.num_networks) |
| 480 |
|
| 481 |
headers = [self.__tr('Network Name (SSID)'), self.__tr('Signal Strength'), |
| 482 |
self.__tr("Security"), self.__tr("Mode")] |
| 483 |
|
| 484 |
if self.show_extended: |
| 485 |
headers.extend([self.__tr('Channel'), |
| 486 |
self.__tr("Address (BSSID)"), self.__tr("Location"), |
| 487 |
self.__tr("Lat/Long")]) |
| 488 |
|
| 489 |
self.NetworksTableWidget.setColumnCount(len(headers)) |
| 490 |
self.NetworksTableWidget.setHorizontalHeaderLabels(headers) |
| 491 |
enabled_flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled |
| 492 |
for n in range(self.num_networks): |
| 493 |
name = self.networks['ssid-%d' % n] |
| 494 |
|
| 495 |
if name == '(unknown)': |
| 496 |
flags = None |
| 497 |
else: |
| 498 |
flags = enabled_flags |
| 499 |
|
| 500 |
ss = self.networks['signalstrength-%d' % n] |
| 501 |
sec = self.networks['encryptiontype-%d' % n] |
| 502 |
mode = self.networks['communicationmode-%d' % n] |
| 503 |
|
| 504 |
log.debug("%d: Name=%s, strength=%s, security=%s, mode=%s" % #, channel=%d bssid=%s" % |
| 505 |
(n, name, ss, sec, mode)) |
| 506 |
|
| 507 |
if self.show_extended: |
| 508 |
chn = self.networks['channel-%d' % n] |
| 509 |
dbm = self.networks['dbm-%d' % n] |
| 510 |
bssid = self.networks['bssid-%d' % n] |
| 511 |
address = self.networks['address-%d' % n] |
| 512 |
lat = self.networks['latitude-%d' % n] |
| 513 |
lng = self.networks['longitude-%d' % n] |
| 514 |
|
| 515 |
log.debug("%d: channel=%d bssid=%s dbm=%s lat=%s long=%s address=%s" % |
| 516 |
(n, chn, bssid, dbm, lat, lng, address)) |
| 517 |
|
| 518 |
i = QTableWidgetItem(str(name)) |
| 519 |
if flags is not None: i.setFlags(flags) |
| 520 |
i.setData(Qt.UserRole, n) |
| 521 |
self.NetworksTableWidget.setItem(n, 0, i) |
| 522 |
|
| 523 |
pixmap = load_pixmap('signal%d' % ss, 'other') |
| 524 |
if self.show_extended: |
| 525 |
i = QTableWidgetItem(QIcon(pixmap), self.__tr("%s/5 (%s dBm)" %(ss, dbm))) |
| 526 |
else: |
| 527 |
i = QTableWidgetItem(QIcon(pixmap), self.__tr("%s/5" % ss)) |
| 528 |
if flags is not None: i.setFlags(flags) |
| 529 |
self.NetworksTableWidget.setItem(n, 1, i) |
| 530 |
|
| 531 |
i = QTableWidgetItem(str(sec)) |
| 532 |
if flags is not None: i.setFlags(flags) |
| 533 |
self.NetworksTableWidget.setItem(n, 2, i) |
| 534 |
|
| 535 |
i = QTableWidgetItem(str(mode)) |
| 536 |
if flags is not None: i.setFlags(flags) |
| 537 |
self.NetworksTableWidget.setItem(n, 3, i) |
| 538 |
|
| 539 |
if self.show_extended: |
| 540 |
i = QTableWidgetItem(str(str(chn))) |
| 541 |
if flags is not None: i.setFlags(flags) |
| 542 |
self.NetworksTableWidget.setItem(n, 4, i) |
| 543 |
|
| 544 |
i = QTableWidgetItem(str(bssid)) |
| 545 |
if flags is not None: i.setFlags(flags) |
| 546 |
self.NetworksTableWidget.setItem(n, 5, i) |
| 547 |
|
| 548 |
i = QTableWidgetItem(str(address)) |
| 549 |
if flags is not None: i.setFlags(flags) |
| 550 |
self.NetworksTableWidget.setItem(n, 6, i) |
| 551 |
|
| 552 |
i = QTableWidgetItem(str("%s/%s" % (lat, lng))) |
| 553 |
if flags is not None: i.setFlags(flags) |
| 554 |
self.NetworksTableWidget.setItem(n, 7, i) |
| 555 |
|
| 556 |
|
| 557 |
self.NetworksTableWidget.resizeColumnsToContents() |
| 558 |
self.NetworksTableWidget.setSortingEnabled(True) |
| 559 |
self.NetworksTableWidget.sortItems(1, Qt.DescendingOrder) |
| 560 |
self.NetworksTableWidget.selectRow(0) |
| 561 |
# itemSelectionChanged = pyqtSignal() |
| 562 |
# self.NetworksTableWidget.emit(SIGNAL("itemSelectionChanged()")) |
| 563 |
self.NetworksTableWidget.itemSelectionChanged.emit() |
| 564 |
|
| 565 |
finally: |
| 566 |
endWaitCursor() |
| 567 |
self.NextButton.setEnabled(True) |
| 568 |
|
| 569 |
else: |
| 570 |
self.NextButton.setEnabled(False) |
| 571 |
|
| 572 |
|
| 573 |
def NetworksTableWidget_itemSelectionChanged(self): |
| 574 |
row = self.NetworksTableWidget.currentRow() |
| 575 |
item = self.NetworksTableWidget.item(row, 0) |
| 576 |
n, ok = value_int(item.data(Qt.UserRole)) |
| 577 |
if ok: |
| 578 |
sec = self.networks['encryptiontype-%d' % n] |
| 579 |
if sec.lower() == 'none': |
| 580 |
self.setNextButton(BUTTON_CONNECT) |
| 581 |
else: |
| 582 |
self.setNextButton(BUTTON_NEXT) |
| 583 |
|
| 584 |
|
| 585 |
def clearNetworksTable(self): |
| 586 |
self.DevicesTableWidget.clear() |
| 587 |
self.DevicesTableWidget.setRowCount(0) |
| 588 |
self.DevicesTableWidget.setColumnCount(0) |
| 589 |
|
| 590 |
|
| 591 |
def RefreshButton2_clicked(self): |
| 592 |
self.clearNetworksTable() |
| 593 |
self.networks = {} |
| 594 |
QTimer.singleShot(0, self.showNetworkPage) |
| 595 |
|
| 596 |
|
| 597 |
# |
| 598 |
# CONFIGURE WIFI |
| 599 |
# |
| 600 |
|
| 601 |
def initConfigWifiPage(self): |
| 602 |
self.ShowKeyCheckBox.toggled[bool].connect(self.ShowKeyCheckBox_toggled) |
| 603 |
|
| 604 |
|
| 605 |
def showConfigWifiPage(self): |
| 606 |
self.setNextButton(BUTTON_CONNECT) |
| 607 |
self.SSIDLabel.setText(self.network) |
| 608 |
font = QFont() |
| 609 |
font.setPointSize(12) |
| 610 |
self.SSIDLabel.setFont(font) |
| 611 |
self.KeyLineEdit.setText(str()) |
| 612 |
self.ShowKeyCheckBox.setChecked(False) |
| 613 |
self.StrengthIcon.setPixmap(load_pixmap('signal%d' % self.ss, 'other')) |
| 614 |
self.ConfigureIcon.setPixmap(load_pixmap('info', '16x16')) |
| 615 |
self.KeysIcon.setPixmap(load_pixmap('keys', '32x32')) |
| 616 |
|
| 617 |
if 'wpa' in self.security.lower(): |
| 618 |
self.WPARadioButton.setChecked(True) |
| 619 |
elif 'wep' in self.security.lower(): |
| 620 |
self.WEPRadioButton.setChecked(True) |
| 621 |
else: |
| 622 |
self.WEPRadioButton.setChecked(True) |
| 623 |
|
| 624 |
self.KeyLineEdit.setFocus() |
| 625 |
self.KeyLineEdit.setEchoMode(QLineEdit.Password) |
| 626 |
self.displayPage(PAGE_CONFIGURE_WIFI) |
| 627 |
|
| 628 |
|
| 629 |
def ShowKeyCheckBox_toggled(self, b): |
| 630 |
if b: |
| 631 |
self.KeyLineEdit.setEchoMode(QLineEdit.Normal) |
| 632 |
else: |
| 633 |
self.KeyLineEdit.setEchoMode(QLineEdit.Password) |
| 634 |
|
| 635 |
|
| 636 |
# |
| 637 |
# EXIT/CONNECT PAGE |
| 638 |
# |
| 639 |
|
| 640 |
def initExitPage(self): |
| 641 |
self.PageSpinBox.valueChanged[int].connect(self.PageSpinBox_valueChanged) |
| 642 |
self.RefreshTimer = QTimer(self) |
| 643 |
# self.RefreshTimer.timeout.connect(self.RefreshTimer_timeout) |
| 644 |
self.RefreshTimer.timeout.connect(self.RefreshTimer_timeout) |
| 645 |
self.pages = [] |
| 646 |
self.page_index = 0 |
| 647 |
self.PageSpinBox.setMinimum(1) |
| 648 |
|
| 649 |
|
| 650 |
def showExitPage(self): |
| 651 |
self.setNextButton(BUTTON_FINISH) |
| 652 |
self.NextButton.setEnabled(False) |
| 653 |
self.CancelButton.setEnabled(True) |
| 654 |
self.SSIDLabel_2.setText(str(self.network)) |
| 655 |
self.ip = '0.0.0.0' |
| 656 |
self.hn = '' |
| 657 |
ss_max, ss_min, ss_val, ss_dbm = 5, 0, 0, -200 |
| 658 |
vsa_codes = [] |
| 659 |
self.success = SUCCESS_NOT_CONNECTED |
| 660 |
|
| 661 |
beginWaitCursor() |
| 662 |
try: |
| 663 |
try: |
| 664 |
self.ip,_,addressmode, subnetmask, gateway, pridns, sec_dns= self.wifiObj.getIPConfiguration(self.dev, self.adapterName) |
| 665 |
if self.ip == "0.0.0.0": |
| 666 |
if not self.wifiObj == CdmWifi: |
| 667 |
self.ip, subnetmask, gateway, pri_dns, sec_dns, addressmode = self.wifiObj.getwifiotherdetails(self.dev,self.adapterName) |
| 668 |
vsa_codes = self.wifiObj.getVSACodes(self.dev, self.adapterName) |
| 669 |
ss_max, ss_min, ss_val, ss_dbm = self.wifiObj.getSignalStrength(self.dev, self.adapterName,self.network, self.adaptor_id) |
| 670 |
self.hn = self.wifiObj.getHostname(self.dev) |
| 671 |
except Error as e: |
| 672 |
self.showIOError(e) |
| 673 |
return |
| 674 |
finally: |
| 675 |
self.dev.close() |
| 676 |
endWaitCursor() |
| 677 |
|
| 678 |
if 'dhcp' or 'default' in addressmode.lower(): |
| 679 |
self.success = SUCCESS_CONNECTED |
| 680 |
|
| 681 |
elif addressmode.lower() == 'autoip': |
| 682 |
self.success = SUCCESS_AUTO_IP |
| 683 |
|
| 684 |
if self.ip == '0.0.0.0': |
| 685 |
self.success = SUCCESS_NOT_CONNECTED |
| 686 |
|
| 687 |
self.pages = [] |
| 688 |
|
| 689 |
if self.success == SUCCESS_NOT_CONNECTED: |
| 690 |
self.pages.append((self.__tr("<b>Your printer has not been connected to the wireless network.</b> A valid connection to a wireless network can take up to 2 minutes. This screen will automatically refresh every %s seconds.<p>If your printer fails to connect within a reasonable time, there may be a problem with your configuration." % REFRESH_INTERVAL), load_pixmap('error', '16x16'))) |
| 691 |
self.RefreshTimer.start(REFRESH_INTERVAL * 1000) |
| 692 |
|
| 693 |
elif self.success == SUCCESS_AUTO_IP: |
| 694 |
# self.pages.append((self.__tr("Your printer has been connected to the wireless network, but it has been assigned an address which may not be usable."), load_pixmap('warning', '16x16'))) |
| 695 |
self.pages.append((self.__tr("Your printer has been connected to the wireless network and has been assinged a IP. Now run <pre>hp-setup %s</pre> If IP is not accessible, try again for another IP."%self.ip), load_pixmap('warning', '16x16'))) |
| 696 |
# self.RefreshTimer.start(REFRESH_INTERVAL * 1000) |
| 697 |
self.CancelButton.setEnabled(False) |
| 698 |
self.BackButton.setEnabled(False) |
| 699 |
self.RefreshTimer.stop() |
| 700 |
|
| 701 |
else: # SUCCESS_CONNECTED |
| 702 |
self.pages.append((self.__tr("Your printer has been successfully configured on the wireless network. You may now unplug the USB cable. To setup the printer, now run <pre>hp-setup %s</pre>"%self.ip), load_pixmap('info', '16x16'))) |
| 703 |
self.CancelButton.setEnabled(False) |
| 704 |
self.BackButton.setEnabled(False) |
| 705 |
self.RefreshTimer.stop() |
| 706 |
|
| 707 |
if addressmode is None: |
| 708 |
self.AddressModeLabel.setText(self.__tr("Unknown")) |
| 709 |
else: |
| 710 |
self.AddressModeLabel.setText(str(addressmode)) |
| 711 |
|
| 712 |
if self.hn is None: |
| 713 |
self.HostnameLabel.setText(self.__tr("Unknown")) |
| 714 |
else: |
| 715 |
self.HostnameLabel.setText(str(self.hn)) |
| 716 |
|
| 717 |
self.IPAddressLabel.setText(str(self.ip)) |
| 718 |
self.GatewayLabel.setText(str(gateway)) |
| 719 |
self.DNSLabel.setText(str(pridns)) |
| 720 |
self.NextButton.setEnabled(True) |
| 721 |
|
| 722 |
self.SignalStrengthLabel.setText(str("%s/%s (%s dBm)" % (ss_val, ss_max, ss_dbm))) |
| 723 |
self.SignalStrengthIcon.setPixmap(load_pixmap('signal%d' % ss_val, 'other')) |
| 724 |
|
| 725 |
for c, s in vsa_codes: |
| 726 |
if c : |
| 727 |
ss = s.lower() |
| 728 |
if ss.startswith("info"): |
| 729 |
pixmap = load_pixmap('info', '16x16') |
| 730 |
|
| 731 |
elif ss.startswith("warn"): |
| 732 |
pixmap = load_pixmap('warning', '16x16') |
| 733 |
|
| 734 |
elif ss.startswith("crit"): |
| 735 |
pixmap = load_pixmap('error', '16x16') |
| 736 |
|
| 737 |
else: |
| 738 |
pixmap = load_pixmap('info', '16x16') |
| 739 |
|
| 740 |
self.pages.append((device.queryString("vsa_%s" % str(c).zfill(3)), pixmap)) |
| 741 |
|
| 742 |
num_pages = len(self.pages) |
| 743 |
self.PageSpinBox.setMaximum(num_pages) |
| 744 |
self.PageSpinBox.setEnabled(num_pages>1) |
| 745 |
self.PageSpinBox.setValue(1) |
| 746 |
self.PageLabel.setEnabled(num_pages>1) |
| 747 |
self.PageLabel2.setEnabled(num_pages>1) |
| 748 |
self.PageLabel.setText(self.__tr("of %s", str(num_pages))) |
| 749 |
self.page_index = 0 |
| 750 |
self.ExitLabel.setText(self.pages[self.page_index][0]) |
| 751 |
self.ExitIcon.setPixmap(self.pages[self.page_index][1]) |
| 752 |
self.displayPage(PAGE_EXIT) |
| 753 |
|
| 754 |
|
| 755 |
def PageSpinBox_valueChanged(self, i): |
| 756 |
self.page_index = i-1 |
| 757 |
self.ExitLabel.setText(self.pages[self.page_index][0]) |
| 758 |
self.ExitIcon.setPixmap(self.pages[self.page_index][1]) |
| 759 |
|
| 760 |
|
| 761 |
def RefreshTimer_timeout(self): |
| 762 |
self.showExitPage() |
| 763 |
|
| 764 |
|
| 765 |
# |
| 766 |
# ASSOCIATE |
| 767 |
# |
| 768 |
|
| 769 |
def associate(self, key=to_unicode('')): |
| 770 |
beginWaitCursor() |
| 771 |
try: |
| 772 |
try: |
| 773 |
alg, mode, secretid = self.wifiObj.getCryptoSuite(self.dev, self.adapterName) |
| 774 |
except Error as e: |
| 775 |
self.showIOError(e) |
| 776 |
return |
| 777 |
|
| 778 |
log.debug("Crypto algorithm: %s" % alg) |
| 779 |
log.debug("Crypto mode: %s" % mode) |
| 780 |
finally: |
| 781 |
endWaitCursor() |
| 782 |
|
| 783 |
beginWaitCursor() |
| 784 |
try: |
| 785 |
try: |
| 786 |
if self.wifiObj == CdmWifi: |
| 787 |
|
| 788 |
self.wifiObj.associate(self.dev, self.wpaVersionPreference, self.network, self.authenticationMode, self.security, key) |
| 789 |
else: |
| 790 |
self.wifiObj.associate(self.dev, self.adapterName, self.network, self.mode, self.security, key) |
| 791 |
except Error as e: |
| 792 |
self.showIOError(e) |
| 793 |
return |
| 794 |
finally: |
| 795 |
endWaitCursor() |
| 796 |
|
| 797 |
|
| 798 |
# |
| 799 |
# Misc |
| 800 |
# |
| 801 |
|
| 802 |
def NextButton_clicked(self): |
| 803 |
p = self.StackedWidget.currentIndex() |
| 804 |
if p == PAGE_INTRO: |
| 805 |
self.showDevicesPage() |
| 806 |
|
| 807 |
elif p == PAGE_DEVICES: |
| 808 |
row = self.DevicesTableWidget.currentRow() |
| 809 |
if row != -1: |
| 810 |
self.device_uri = self.DevicesTableWidget.item(row, 0).device_uri |
| 811 |
self.mq = device.queryModelByURI(self.device_uri) |
| 812 |
|
| 813 |
self.getWifiObject(self.mq['wifi-config']) |
| 814 |
back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri) |
| 815 |
self.model = models.normalizeModelName(model).lower() |
| 816 |
|
| 817 |
self.showNetworkPage() |
| 818 |
|
| 819 |
elif p == PAGE_NETWORK: |
| 820 |
self.security = 'None' |
| 821 |
self.mode = 'Infrastructure' |
| 822 |
self.ss = 0 |
| 823 |
row = self.NetworksTableWidget.currentRow() |
| 824 |
if row != -1: |
| 825 |
i = self.NetworksTableWidget.item(row, 0) |
| 826 |
if i is not None: |
| 827 |
self.network = to_unicode(i.text()) |
| 828 |
log.debug("Selected network SSID: %s" % self.network) |
| 829 |
self.n, ok = value_int(i.data(Qt.UserRole)) |
| 830 |
if ok: |
| 831 |
self.security = self.networks.get('encryptiontype-{}'.format(self.n)) |
| 832 |
log.debug("Security: %s" % self.security) |
| 833 |
|
| 834 |
self.mode = self.networks.get('communicationmode-{}'.format(self.n)) |
| 835 |
log.debug("Mode: %s" % self.mode) |
| 836 |
|
| 837 |
self.ss = self.networks.get('signalstrength-{}'.format(self.n)) |
| 838 |
log.debug("Signal strength: %s" % self.ss) |
| 839 |
|
| 840 |
self.wpaVersionPreference = self.networks.get('wpaVersionPreference-{}'.format(self.n)) |
| 841 |
self.authenticationMode = self.networks.get('authenticationMode-{}'.format(self.n)) |
| 842 |
|
| 843 |
if self.security.lower() != 'none': |
| 844 |
self.showConfigWifiPage() |
| 845 |
else: |
| 846 |
# Skip config page if no security to setup |
| 847 |
self.associate() |
| 848 |
self.showAssociateProgressDialog() |
| 849 |
self.showExitPage() |
| 850 |
|
| 851 |
elif p == PAGE_CONFIGURE_WIFI: |
| 852 |
key = to_unicode(self.KeyLineEdit.text()) |
| 853 |
self.associate(key) |
| 854 |
self.showAssociateProgressDialog() |
| 855 |
self.showExitPage() |
| 856 |
|
| 857 |
elif p == PAGE_EXIT: |
| 858 |
if self.dev is not None: |
| 859 |
self.dev.close() |
| 860 |
|
| 861 |
self.close() |
| 862 |
|
| 863 |
else: |
| 864 |
log.error("Invalid page!") # shouldn't happen! |
| 865 |
|
| 866 |
|
| 867 |
def showAssociateProgressDialog(self): |
| 868 |
AssociateProgressDialog = QProgressDialog(self.__tr("Waiting for printer to connect to the wireless network..."), self.__tr("Cancel"), 0, ASSOCIATE_DELAY, self) |
| 869 |
AssociateProgressDialog.setWindowTitle(self.__tr("HP Device Manager - Please wait...")) |
| 870 |
AssociateProgressDialog.setWindowModality(Qt.WindowModal) |
| 871 |
AssociateProgressDialog.setMinimumDuration(0) |
| 872 |
AssociateProgressDialog.forceShow() |
| 873 |
canceled = False |
| 874 |
for x in range(ASSOCIATE_DELAY): |
| 875 |
AssociateProgressDialog.setValue(x) |
| 876 |
QThread.sleep(1) |
| 877 |
qApp.processEvents() |
| 878 |
|
| 879 |
if AssociateProgressDialog.wasCanceled(): |
| 880 |
canceled = True |
| 881 |
break |
| 882 |
|
| 883 |
AssociateProgressDialog.setValue(ASSOCIATE_DELAY) |
| 884 |
AssociateProgressDialog.close() |
| 885 |
|
| 886 |
if canceled: |
| 887 |
if self.dev is not None: |
| 888 |
self.dev.close() |
| 889 |
|
| 890 |
self.close() |
| 891 |
|
| 892 |
|
| 893 |
def BackButton_clicked(self): |
| 894 |
p = self.StackedWidget.currentIndex() |
| 895 |
if p == PAGE_DEVICES: |
| 896 |
self.devices = {} |
| 897 |
self.showIntroPage() |
| 898 |
|
| 899 |
elif p == PAGE_NETWORK: |
| 900 |
self.showDevicesPage() |
| 901 |
|
| 902 |
elif p == PAGE_CONFIGURE_WIFI: |
| 903 |
self.showNetworkPage() |
| 904 |
|
| 905 |
elif p == PAGE_EXIT: |
| 906 |
self.RefreshTimer.stop() |
| 907 |
if self.security.lower() != 'none': |
| 908 |
self.showConfigWifiPage() |
| 909 |
else: |
| 910 |
self.showNetworkPage() |
| 911 |
|
| 912 |
else: |
| 913 |
log.error("Invalid page!") # shouldn't happen! |
| 914 |
|
| 915 |
|
| 916 |
def CancelButton_clicked(self): |
| 917 |
if self.dev is not None: |
| 918 |
self.dev.close() |
| 919 |
|
| 920 |
self.close() |
| 921 |
|
| 922 |
|
| 923 |
def displayPage(self, page): |
| 924 |
self.StackedWidget.setCurrentIndex(page) |
| 925 |
self.updateStepText(page) |
| 926 |
|
| 927 |
|
| 928 |
def setNextButton(self, typ=BUTTON_FINISH): |
| 929 |
if typ == BUTTON_NEXT: |
| 930 |
self.NextButton.setText(self.__tr("Next >")) |
| 931 |
|
| 932 |
elif typ == BUTTON_FINISH: |
| 933 |
self.NextButton.setText(self.__tr("Finish")) |
| 934 |
|
| 935 |
elif typ == BUTTON_CONNECT: |
| 936 |
self.NextButton.setText(self.__tr("Connect")) |
| 937 |
|
| 938 |
|
| 939 |
def updateStepText(self, p): |
| 940 |
self.StepText.setText(self.__tr("Step %s of %s" % (p+1, self.max_page+1))) |
| 941 |
|
| 942 |
|
| 943 |
def showIOError(self, e): |
| 944 |
FailureUI(self, self.__tr("<b>An I/O error occurred.</b><p>Please check the USB connection to your printer and try again.</p>(%s)" % str(e))) |
| 945 |
|
| 946 |
if self.dev is not None: |
| 947 |
self.dev.close() |
| 948 |
|
| 949 |
self.close() |
| 950 |
|
| 951 |
|
| 952 |
def __tr(self,s,c = None): |
| 953 |
return qApp.translate("WifiSetupDialog",s,c) |
| 954 |
|
| 955 |
# The Wifi object here is not actual object, Dynamically relevant modules are selected based on |
| 956 |
# wifi-config value in the models file. |
| 957 |
def getWifiObject(self,wifiConfVal): |
| 958 |
self.wifiConfVal = wifiConfVal |
| 959 |
if wifiConfVal == WIFI_CONFIG_LEDM: |
| 960 |
self.wifiObj = LedmWifi |
| 961 |
elif wifiConfVal == WIFI_CONFIG_CDM or wifiConfVal == WIFI_CONFIG_CDM_AUTH: |
| 962 |
self.wifiObj = CdmWifi |
| 963 |
else: |
| 964 |
self.wifiObj = wifi |
| 965 |
|