Skip to content

Commit

Permalink
handover fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonfontes committed Nov 5, 2016
1 parent 554694a commit f6ebd53
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions mininet/wifiMobility.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def nodeSpeed(self, sta, pos_x, pos_y, pos_z, diffTime):
@classmethod
def handover(self, sta, ap, wlan, dist):
"""handover"""
associated = True
if ap == sta.params['associatedTo'][wlan]:
if dist > ap.params['range']:
sta.pexec('iw dev %s disconnect' % sta.params['wlan'][wlan])
Expand All @@ -65,9 +66,11 @@ def handover(self, sta, ap, wlan, dist):
else:
if dist >= 0.01:
channelParameters(sta, ap, wlan, dist, self.staList)
else:
if dist > ap.params['range']:
sta.params['associatedTo'][wlan] = ''
if dist < ap.params['range']:
if sta.params['associatedTo'][wlan] == '':
associated = False
else:
associated = False
if ap == sta.params['associatedTo'][wlan] or dist < ap.params['range']:
changeAP = False
self.updateParams(sta, ap, wlan)
Expand All @@ -79,16 +82,18 @@ def handover(self, sta, ap, wlan, dist):
changeAP = value.changeAP

# Go to handover
if sta.params['associatedTo'][wlan] == '' or changeAP == True:
if 'encrypt' not in ap.params:
self.associate_infra(sta, ap, wlan)
else:
if ap.params['encrypt'][0] == 'wpa' or ap.params['encrypt'][0] == 'wpa2':
self.associate_wpa(sta, ap, wlan)
elif ap.params['encrypt'][0] == 'wep':
self.associate_wep(sta, ap, wlan)
if dist >= 0.01:
channelParameters(sta, ap, wlan, dist, self.staList)
if associated == False or changeAP == True:
if ap not in sta.params['associatedTo']:
if sta.params['associatedTo'][wlan] == '':
if 'encrypt' not in ap.params:
self.associate_infra(sta, ap, wlan)
else:
if ap.params['encrypt'][0] == 'wpa' or ap.params['encrypt'][0] == 'wpa2':
self.associate_wpa(sta, ap, wlan)
elif ap.params['encrypt'][0] == 'wep':
self.associate_wep(sta, ap, wlan)
if dist >= 0.01:
channelParameters(sta, ap, wlan, dist, self.staList)
# have to verify this
time.sleep(0.01)

Expand Down

0 comments on commit f6ebd53

Please sign in to comment.