Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-09-05 20:32:24 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-09-05 20:32:24 (GMT)
commit6a2ce2b9412ffb307ced44e3df02b0d475b3bb83 (patch)
tree9da53ff42dcbad904e6722452f573cefa075571e /shell
parentee9a6005c380503509ef3d12f2dd5d0d4564c114 (diff)
Add conversion functions for channel<->frequency
Diffstat (limited to 'shell')
-rw-r--r--shell/model/devices/network/wireless.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/shell/model/devices/network/wireless.py b/shell/model/devices/network/wireless.py
index 345393d..c45a08e 100644
--- a/shell/model/devices/network/wireless.py
+++ b/shell/model/devices/network/wireless.py
@@ -20,6 +20,23 @@ import gobject
from model.devices import device
from hardware import nmclient
+def freq_to_channel(freq):
+ ftoc = { 2.412: 1, 2.417: 2, 2.422: 3, 2.427: 4,
+ 2.432: 5, 2.437: 6, 2.442: 7, 2.447: 8,
+ 2.452: 9, 2.457: 10, 2.462: 11, 2.467: 12,
+ 2.472: 13
+ }
+ return ftoc[freq]
+
+def channel_to_freq(channel):
+ ctof = { 1: 2.412, 2: 2.417, 3: 2.422, 4: 2.427,
+ 5: 2.432, 6: 2.437, 7: 2.442, 8: 2.447,
+ 9: 2.452, 10: 2.457, 11: 2.462, 12: 2.467,
+ 13: 2.472
+ }
+ return ctof[channel]
+
+
class Device(device.Device):
__gproperties__ = {
'name' : (str, None, None, None,