def get_wlan_current_connection(PyWiWi_iface): ''' Returns connection attributes if connected, None if not. ''' iface_state = get_wlan_interface_state(PyWiWi_iface)[1] print "current iface state", iface_state if iface_state == "wlan_interface_state_connected": cnx, CNX = WindowsWifi.queryInterface(PyWiWi_iface, 'current_connection') else: cnx, CNX = None, None return cnx, CNX
def get_wlan_interface_state(PyWiWi_iface): s, S = WindowsWifi.queryInterface(PyWiWi_iface, 'interface_state') return s, S