Beispiel #1
0
 def execute_async(self, ud):
     events = yield async_helpers.select(
         async_helpers.StateCondition(ud.radio.activate_request,
                                      operator.__not__),
         async_helpers.StateCondition(ud.radio.associated,
                                      operator.__not__))
     if 0 in events:
         returnValue('disactivate')
     returnValue('unassociated')
Beispiel #2
0
 def execute_async(self, ud):
     events = yield async_helpers.select(
         async_helpers.Timeout(ud.radio.disactivate_delay),
         async_helpers.StateCondition(ud.radio.activate_request,
                                      operator.truth),
         async_helpers.StateCondition(ud.radio.associated,
                                      operator.__not__))
     if 1 in events:
         returnValue('activate')
     if 2 in events:
         returnValue('unassociated')
     returnValue('done')
Beispiel #3
0
    def execute_async(self, ud):
        ud.radio._radio.associate(*ud.radio.requested_bss[0],
                                  **ud.radio.requested_bss[1])

        #print "Associating before", ud.radio.associated.get()
        events = yield async_helpers.select(
            async_helpers.StateCondition(ud.radio._up_state_pub,
                                         operator.__not__),
            async_helpers.StateCondition(ud.radio._radio.associated,
                                         lambda x: x != radio.Associating))

        if 0 in events or ud.radio.associated.get() == radio.Unassociated:
            returnValue('failed')
        else:
            #print "Associated", ud.radio.iface_name, ud.radio.associated.get()
            returnValue('associated')
Beispiel #4
0
    def execute_async(self, ud):
        # Use callLater so that no association request will arrive before
        # we select.
        reactor.callLater(0, ud.radio.scanning_enabled.set, True)
        assoc_event_stream = async_helpers.EventStream(
            ud.radio.associate_request)
        #print "Associated before", ud.radio.associated.get()
        events = yield async_helpers.select(
            async_helpers.StateCondition(ud.radio._up_state_pub,
                                         operator.__not__),
            async_helpers.StateCondition(ud.radio.activate_request,
                                         operator.truth),
            assoc_event_stream,
        )
        ud.radio.scanning_enabled.set(False)

        if 1 in events:
            returnValue('activate')
        if 2 in events:
            ud.radio.requested_bss = assoc_event_stream.get()
            #print "Assoc changed", ud.radio.iface_name, ud.radio.requested_bss
            returnValue('reassociate')
        returnValue('unassociated')
Beispiel #5
0
    def execute_async(self, ud):
        # If we got here then were forcibly disactivated, and the previous
        # activation request is moot.
        ud.radio.activate_request.set(False)

        # We may have landed here after the interface went down causing
        # disassociation. Quickly check for that before getting to work.
        if not ud.radio._up_state_pub.get():
            returnValue('down')

        # Use callLater so that no association request will arrive before
        # we select.
        reactor.callLater(0, ud.radio.scanning_enabled.set, True)
        assoc_event_stream = async_helpers.EventStream(
            ud.radio.associate_request)
        events = yield async_helpers.select(
            async_helpers.StateCondition(ud.radio._up_state_pub,
                                         operator.__not__), assoc_event_stream)
        ud.radio.scanning_enabled.set(False)

        if 1 in events:
            ud.radio.requested_bss = assoc_event_stream.get()
            returnValue('associate')
        returnValue('down')