def __init__(self, wifi_device_object_path): NMDevice.__init__(self, wifi_device_object_path, "org.freedesktop.NetworkManager.Device.Wireless") self.prop_list = [ "HwAddress", "PermHwAddress", "Mode", "Bitrate", "ActiveAccessPoint", "WirelessCapabilities" ] self.ap_add_match = self.bus.add_signal_receiver( self.access_point_added_cb, dbus_interface=self.object_interface, path=self.object_path, signal_name="AccessPointAdded") self.ap_remove_match = self.bus.add_signal_receiver( self.access_point_removed_cb, dbus_interface=self.object_interface, path=self.object_path, signal_name="AccessPointRemoved") self.p_match = self.bus.add_signal_receiver( self.properties_changed_cb, dbus_interface=self.object_interface, path=self.object_path, signal_name="PropertiesChanged") self.ap_record_dict = {} self.ap_record_inited = 0 self.ap_timer_id = 0 self.init_nmobject_with_properties() self.origin_ap_list = self.get_access_points() self.thread_wifiauto = None
def __init__(self, ethernet_device_object_path): NMDevice.__init__(self, ethernet_device_object_path, "org.freedesktop.NetworkManager.Device.Wired") self.prop_list = ["Carrier", "HwAddress", "PermHwAddress", "Speed"] self.init_nmobject_with_properties() self.bus.add_signal_receiver(self.properties_changed_cb, dbus_interface = self.object_interface, path = self.object_path, signal_name = "PropertiesChanged") self.thread_wiredauto = None self.thread_dslauto = None
def __init__(self, ethernet_device_object_path): NMDevice.__init__(self, ethernet_device_object_path, "org.freedesktop.NetworkManager.Device.Wired") self.prop_list = ["Carrier", "HwAddress", "PermHwAddress", "Speed"] self.init_nmobject_with_properties() self.bus.add_signal_receiver(self.properties_changed_cb, dbus_interface=self.object_interface, path=self.object_path, signal_name="PropertiesChanged") self.thread_wiredauto = None self.thread_dslauto = None
def __init__(self, wifi_device_object_path): NMDevice.__init__(self, wifi_device_object_path, "org.freedesktop.NetworkManager.Device.Wireless") self.prop_list = ["HwAddress", "PermHwAddress", "Mode", "Bitrate", "ActiveAccessPoint", "WirelessCapabilities"] self.ap_add_match = self.bus.add_signal_receiver(self.access_point_added_cb, dbus_interface = self.object_interface, path = self.object_path, signal_name = "AccessPointAdded") self.ap_remove_match = self.bus.add_signal_receiver(self.access_point_removed_cb, dbus_interface = self.object_interface, path = self.object_path, signal_name = "AccessPointRemoved") self.p_match = self.bus.add_signal_receiver(self.properties_changed_cb, dbus_interface = self.object_interface, path = self.object_path, signal_name = "PropertiesChanged") self.ap_record_dict = {} self.ap_record_inited = 0 self.ap_timer_id = 0 self.init_nmobject_with_properties() self.origin_ap_list = self.get_access_points() self.thread_wifiauto = None
def __init__(self, filename): GObject.__init__(self) self.__accounts = [] self.next_id = 0 self.cacheName = filename self.__device = NMDevice() self.__session = SessionCamel(self) self.__session.set_initialized() self.__load_cache()
def match_cipher(self, cipher, expected, wpa_flags, rsn_flags, flag): if cipher != expected: return False if not (wpa_flags & flag) and not (rsn_flags & flag): return False return True def get_hw_address(self): return self.properties["HwAddress"] def properties_changed_cb(self, prop_dict): self.init_nmobject_with_properties() if __name__ == "__main__": #nm_access_point = NMAccessPoint("/org/freedesktop/NetworkManager/AccessPoint/840") #print nm_access_point.properties from nmclient import NMClient from nmdevice_wifi import NMDeviceWifi nmclient = NMClient() wifi = NMDeviceWifi(nmclient.get_wireless_device().object_path) for ap in wifi.get_access_points(): if ap.get_ssid() == "daydayup" or ap.get_ssid() == "DeepinWork": print ap.get_ssid() print ap.object_path print "security", ap.get_security_method() from nmdevice import NMDevice print NMDevice( wifi.object_path).get_active_connection().get_specific_object()
elif key == "Settings": try: from nm_remote_connection import NMRemoteConnection remote_connection = NMRemoteConnection(path) if remote_connection: return remote_connection else: raise NewObjectFailed(path) except NewObjectFailed, e: print "create object:%s failed" % e.path except: traceback.print_exc() elif key == "Devices": try: from nmdevice import NMDevice device = NMDevice(path) if device: return device else: raise NewObjectFailed(path) except NewObjectFailed, e: print "create object:%s failed" % e.path except: traceback.print_exc() elif key == "AccessPoint": try: from nmaccesspoint import NMAccessPoint ap = NMAccessPoint(path) if ap: return ap else:
def __init__(self, modem_device_object_path): NMDevice.__init__(self, modem_device_object_path, "org.freedesktop.NetworkManager.Device.Modem")