def start_server(self, event=None):
"""
Try to start wpa_supplicant and connect to a Wii U.
:param event: Determines if this was a user initiated start.
:return: None
"""
if event:
LoggerGui.debug("User clicked start server button")
LoggerGui.debug("Start server called")
if self.label_backend_status["text"] != DrcSimC.STOPPED and \
(self.label_wpa_status["text"] not in (WpaSupplicant.DISCONNECTED, WpaSupplicant.TERMINATED)):
messagebox.showerror("Running", "Server is already running")
return
if not os.path.exists(constants.PATH_CONF_CONNECT):
messagebox.showerror("Auth Error",
"No auth details found. Use the \"Get Key\" tab to pair with a Wii U.")
self.activate()
return
self.normal_interface = self.dropdown_normal_interface.get()
self.wii_u_interface = self.dropdown_wiiu_interface.get()
if not self.normal_interface or not self.wii_u_interface:
messagebox.showerror("Interface Error", "Two interfaces need to be selected.")
self.activate()
return
if self.normal_interface == self.wii_u_interface:
messagebox.showerror("Interface Error", "The selected normal and Wii U interfaces must be different.")
self.activate()
return
try:
InterfaceUtil.get_mac(self.normal_interface)
InterfaceUtil.get_mac(self.wii_u_interface)
except ValueError:
messagebox.showerror("Interface Error", "The selected Interface is no longer available.")
self.activate()
return
if InterfaceUtil.is_managed_by_network_manager(self.wii_u_interface):
set_unmanaged = messagebox.askokcancel(
"Managed Interface", "This interface is managed by Network Manager. To use it with DRC Sim it needs "
"to be set to unmanaged. Network Manager will not be able to control the interface"
" after this.\nSet %s to unmanaged?" % self.wii_u_interface)
if set_unmanaged:
InterfaceUtil.set_unmanaged_by_network_manager(self.wii_u_interface)
else:
messagebox.showerror("Managed Interface", "Selected Wii U interface is managed by Network Manager.")
self.activate()
return
LoggerGui.debug("Starting wpa supplicant")
self.wpa_supplicant = WpaSupplicant()
self.wpa_supplicant.add_status_change_listener(self.wpa_status_changed)
self.wpa_supplicant.connect(constants.PATH_CONF_CONNECT, self.wii_u_interface)
self.label_backend_status.config(text="WAITING")
评论列表
文章目录