Example #1
0
    deviceIDs = []

    # --------------------------------------------------------------------------
    # Do pairing loop
    # --------------------------------------------------------------------------
    logfile.Console("Pairing, press Ctrl-C to exit")
    try:
        RunningSwitch = True
        pairingCounter = 30  # Do pairing for n seconds
        #-------------------------------------------------------------------
        # Ask for ChannelID message
        # Refer to D0652.pdf, page 120. en section 9.5.4.4
        #-------------------------------------------------------------------
        messages = []
        for i in range(0, NrDevicesToPair):
            messages.append(ant.msg4D_RequestMessage(i, ant.msgID_ChannelID))
        ant.SendToDongle(messages, devAntDongle, '', False, False)

        print('Wait for responses from channel what device is paired: ',
              end='')
        while RunningSwitch == True and pairingCounter > 0:
            StartTime = time.time()
            #-------------------------------------------------------------------
            # Receive response from channels
            #-------------------------------------------------------------------
            data = ant.ReadFromDongle(devAntDongle, False)

            #-------------------------------------------------------------------
            # Only handle ChannelID messages and ignore everyting else
            #
            # After msgID_ChannelID is received, the master-messages will be
Example #2
0
    deviceIDs = []

    # --------------------------------------------------------------------------
    # Do pairing loop
    # --------------------------------------------------------------------------
    logfile.Console("Pairing, press Ctrl-C to exit")
    try:
        RunningSwitch = True
        pairingCounter = 30  # Do pairing for n seconds
        #-------------------------------------------------------------------
        # Ask for ChannelID message
        # Refer to D0652.pdf, page 120. en section 9.5.4.4
        #-------------------------------------------------------------------
        messages = []
        for i in range(0, NrDevicesToPair):
            messages.append(ant.msg4D_RequestMessage(i, ant.msgID_ChannelID))
        AntDongle.Write(messages, False, False)

        print('Wait for responses from channel what device is paired: ',
              end='')
        while RunningSwitch == True and pairingCounter > 0:
            StartTime = time.time()
            #-------------------------------------------------------------------
            # Receive response from channels
            #-------------------------------------------------------------------
            data = AntDongle.Read(False)

            #-------------------------------------------------------------------
            # Only handle ChannelID messages and ignore everyting else
            #
            # After msgID_ChannelID is received, the master-messages will be
Example #3
0
    deviceIDs = []

    # --------------------------------------------------------------------------
    # Do pairing loop
    # --------------------------------------------------------------------------
    logfile.Write("Pairing, press Ctrl-C to exit")
    try:
        RunningSwitch = True
        pairingCounter = 10  # Do pairing for n seconds
        #-------------------------------------------------------------------
        # Ask for ChannelID message
        # Refer to D0652.pdf, page 120. en section 9.5.4.4
        #-------------------------------------------------------------------
        messages = []
        for i in range(0, NrDevicesToPair):
            messages.append(ant.msg4D_RequestMessage(i, ant.msgID_ChannelID))
        ant.SendToDongle(messages, devAntDongle, '', False, False)

        while RunningSwitch == True and pairingCounter > 0:
            StartTime = time.time()
            #-------------------------------------------------------------------
            # Receive response from channels
            #-------------------------------------------------------------------
            data = ant.ReadFromDongle(devAntDongle, False)

            #-------------------------------------------------------------------
            # Only handle ChannelID messages and ignore everyting else
            #
            # After msgID_ChannelID is received, the master-messages will be
            # received, but we ignore them here because we want to pair only.
            #-------------------------------------------------------------------