From 6a2ce2b9412ffb307ced44e3df02b0d475b3bb83 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 5 Sep 2007 16:32:24 -0400 Subject: [PATCH] Add conversion functions for channel<->frequency --- shell/model/devices/network/wireless.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/shell/model/devices/network/wireless.py b/shell/model/devices/network/wireless.py index 345393d9..c45a08ec 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,