Add conversion functions for channel<->frequency
This commit is contained in:
parent
ee9a6005c3
commit
6a2ce2b941
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user