blob: 37337be7b0df9eec94f3046b4e7ef1cdc34ccc8e [file] [log] [blame]
#!/usr/bin/env python
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import dbus
import dbus.service
from swindle import entity
class Network(entity.Entity):
_I_NETWORK = 'org.chromium.flimflam.Network'
def __init__(self, bus, dev, name):
entity.Entity.__init__(self, bus, dev.path() + '/' + name)
self._dev = dev
self._name = name
self._connected = False
self._strength = 100
def die(self):
@dbus.service.method(_I_NETWORK, in_signature='', out_signature='a{sv}')
def GetProperties(self):
r = {}
r['Device'] = self._dev.path()
r['Name'] = dbus.String(self._name, variant_level=1)
r['Connected'] = dbus.Boolean(self._connected, variant_level=1)
r['Strength'] = dbus.Byte(self._strength, variant_level=1)
return r
@dbus.service.signal(_I_NETWORK, signature='sv')
def PropertyChanged(self, key, val):
self.log('PropertyChanged %s %s', key, val)