示例#1
0
def main():

    recievedPackets = False
    sendTime = int(time.time() + 1)

    # this loop will wait for packets and then process them
    while True:

        curTime = int(time.time())

        # send dummy GPS data once a second
        if curTime >= sendTime:

            sendTime = curTime + 1
            GPSpacket = CustMes.MESSAGE_FRAME()
            GPSdata = CustMes.MESSAGE_GPS()

            # set up GPS packet
            GPSpacket.MessageID = 0x02
            GPSpacket.TargetID = 0
            GPSpacket.SystemID = GlobalVals.SYSTEM_ID

            # load dummy GPS data
            GPSdata.Longitude = 77.77
            GPSdata.Latitude = 88.88
            GPSdata.Altitude = 99.99
            GPSdata.GPSTime = 100.01

            # send dummy GPS packet
            GPSpacket.Payload = GPSdata.data_to_bytes()
            NetworkManager.sendPacket(GPSpacket)

        # check if packets have been recived
        with GlobalVals.RECIEVED_PACKETS_MUTEX:
            if GlobalVals.RECIEVED_PACKETS:
                recievedPackets = True

        # if no packets have been recived then sleep and loop
        if not recievedPackets:
            continue
        else:
            recievedPackets = False

        # go through all the packets in the buffer
        with GlobalVals.PACKET_BUFFER_IN_MUTEX:
            while len(GlobalVals.PACKET_BUFFER_IN) > 0:

                recievedPacket = GlobalVals.PACKET_BUFFER_IN.pop(0)

                # if the packet is a ping
                if recievedPacket.MessageID == 1:
                    NetworkManager.PingRespond(recievedPacket.SystemID,
                                               recievedPacket.Timestamp)

                # if the packet is a GPS data packet
                if recievedPacket.MessageID == 2:

                    # get the GPS data
                    recData = CustMes.MESSAGE_GPS()
                    error = recData.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Dummy Radio 1: GPS data error " + str(error) +
                              ".\n")
                        continue

                    print("GPS Data from " + str(recievedPacket.SystemID) +
                          ":")
                    print("Lon:" + str(recData.Longitude) + ", Lat:" +
                          str(recData.Latitude) + ", Alt:" +
                          str(recData.Altitude) + ", Time:" +
                          str(recData.GPSTime) + "\n")

                    continue

                # if the packet is string message
                if recievedPacket.MessageID == 3:

                    # get the string
                    StrData = CustMes.MESSAGE_STR()
                    error = StrData.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Dummy Radio 2: Message error " + str(error) +
                              ".\n")
                        continue

                    # print string
                    print(StrData.MessageStr)

                    continue
示例#2
0
def main():

    recievedPackets = False
    # sendTime = int(time.time() + 1)

    # this loop will wait for packets and then process them
    while True:

        # check if packets have been recived
        with GlobalVals.RECIEVED_PACKETS_MUTEX:
            if GlobalVals.RECIEVED_PACKETS:
                recievedPackets = True

        # if no packets have been recived then sleep and loop
        if not recievedPackets:
            time.sleep(0.1)
            continue
        else:
            recievedPackets = False

        # go through all the packets in the buffer
        recievedPacket = CustMes.MESSAGE_FRAME()
        with GlobalVals.PACKET_BUFFER_IN_MUTEX:
            while len(GlobalVals.PACKET_BUFFER_IN) > 0:

                recievedPacket = GlobalVals.PACKET_BUFFER_IN.pop(0)

                # if the packet is a ping
                if recievedPacket.MessageID == 1:
                    NetworkManager.PingRespond(recievedPacket.SystemID,
                                               recievedPacket.Timestamp)

                # if the packet is a GPS data packet

                if recievedPacket.MessageID == 2:

                    # get the GPS data
                    GPSdata = CustMes.MESSAGE_GPS()
                    error = GPSdata.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: GPS data error " +
                              str(error))
                        continue

                    # print("GPS Data from " + str(recievedPacket.SystemID) + ":")
                    # print("Lon:" + str(round(GPSdata.Longitude,3)) + ", Lat:" + str(round(GPSdata.Latitude,3)) + ", Alt:" + str(round(GPSdata.Altitude,2)) + ", Time:" + str(GPSdata.GPSTime) + "\n")

                    # set the system id for the GPS data
                    GPSdata.SystemID = recievedPacket.SystemID

                    if not GPSHandler.GPS_FormatCheck(GPSdata):
                        print(
                            "GPS message via RFD900 was broken. Discard it...")
                        continue

                    # print("GPS Data from " + str(recievedPacket.SystemID) + ":")
                    # print("Lon:" + str(round(GPSdata.Longitude,3)) + ", Lat:" + str(round(GPSdata.Latitude,3)) + ", Alt:" + str(round(GPSdata.Altitude,2)) + ", Time:" + str(GPSdata.GPSTime) + "\n")

                    # update GPS_Log
                    with GlobalVals.GPS_LOG_MUTEX:
                        update_GPS_Log(GPSdata)
                        distance = distanceMatrixCalculation(
                            GlobalVals.GPS_ALL, 0)
                    print(
                        "--------------------------------------------------------------------------------------------------"
                    )
                    print("GPS GPS GPS " + str(recievedPacket.SystemID) +
                          str(recievedPacket.SystemID) +
                          str(recievedPacket.SystemID) + ":" + " Lon:" +
                          str(round(GPSdata.Longitude, 3)) + ", Lat:" +
                          str(round(GPSdata.Latitude, 3)) + ", Alt:" +
                          str(round(GPSdata.Altitude, 1)) + ", Time:" +
                          str(round(GPSdata.GPSTime, 1)))
                    print('Distance from GPS [m]:\n', distance)

                    # put data into the buffer
                    # with GlobalVals.GPS_DATA_BUFFER_MUTEX:
                    #     GlobalVals.GPS_DATA_BUFFER.append(GPSdata)

                    # set the flags for the buffer
                    # with GlobalVals.RECIEVED_GPS_RADIO_DATA_MUTEX:
                    #     GlobalVals.RECIEVED_GPS_RADIO_DATA = True

                    continue

                # if the packet is string message
                if recievedPacket.MessageID == 3:

                    # get the string
                    StrData = CustMes.MESSAGE_STR()
                    error = StrData.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Packet error, packet will be discarded.\n")
                        continue

                    # print string
                    print(StrData.MessageStr)

                    continue

                # if the packet is an EKF GPS data packet
                if recievedPacket.MessageID == 5:

                    # get the GPS data
                    EKF_Data = CustMes.MESSAGE_EKF()
                    error = EKF_Data.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: EKF data error " +
                              str(error))
                        continue

                    # set the system id for the GPS data
                    EKF_Data.SystemID = recievedPacket.SystemID

                    if not EKFHandler.EKF_FormatCheck(EKF_Data):
                        print(
                            "EKF message via RFD900 was broken. Discard it...")
                        continue

                    # update GPS_Log
                    with GlobalVals.EKF_LOG_MUTEX:
                        update_EKF_Log(EKF_Data)
                        distance = distanceEKF_MatrixCalculation(
                            GlobalVals.GPS_ALL,
                            0,
                        )

                    print(
                        "=================================================================================================="
                    )
                    print("EKF EKF EKF " + str(recievedPacket.SystemID) +
                          str(recievedPacket.SystemID) +
                          str(recievedPacket.SystemID) + ":" + " Lon:" +
                          str(round(EKF_Data.Longitude, 3)) + ", Lat:" +
                          str(round(EKF_Data.Latitude, 3)) + ", Alt:" +
                          str(round(EKF_Data.Altitude, 1)) + ", Time:" +
                          str(round(EKF_Data.Epoch, 1)))
                    print('Distance from EKF [m]:\n', distance)

                    continue

                # if the packet is an temperature data packet
                # Temperature
                if recievedPacket.MessageID == 6:

                    # get the RSSI data
                    temperatureData = CustMes.MESSAGE_TEMP()
                    error = temperatureData.bytes_to_data(
                        recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: temperature data error " +
                              str(error))
                        continue

                    # set the system id for the GPS data
                    temperatureData.SystemID = recievedPacket.SystemID

                    if not TemperatureHandler.temperatureFormatCheck(
                            temperatureData):
                        print(
                            "Temperature message via RFD900 was broken. Discard it..."
                        )
                        continue

                    tempur = TEMPERATURE(temperatureData.SystemID,
                                         temperatureData.Temperature,
                                         temperatureData.Epoch)
                    with GlobalVals.TEMPERATURE_UPDATE_MUTEX:
                        update_temperature(tempur)
                    # print(" Temperature Data from " + str(recievedPacket.SystemID) + ":" + "Temperature:" + str(round(temperatureData.Temperature,1)))

                # RSSI
                if recievedPacket.MessageID == 7:

                    # get the RSSI data
                    RSSI_Data = CustMes.MESSAGE_RSSI()
                    error = RSSI_Data.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: RSSI data error " +
                              str(error))
                        continue

                    # set the system id for the GPS data
                    RSSI_Data.SystemID = recievedPacket.SystemID
                    # print(RSSI_Data.SystemID)
                    # print(RSSI_Data.TargetPayloadID)
                    # print(GlobalVals.RSSI_ALLOCATION)

                    # Check if the message was sent correctly via the RFD900
                    if not RSSI_Handler.RSSI_FormatCheck(RSSI_Data):
                        print(
                            "RSSI message via RFD900 was broken. Discard it..."
                        )
                        continue

                    print("RSSI Data from " + str(recievedPacket.SystemID) +
                          ": " + "RSSI Distance:" +
                          str(round(RSSI_Data.Distance, 1)) +
                          ", Filtered RSSI: " +
                          str(round(RSSI_Data.FilteredRSSI, 1)) +
                          ", TargetPayloadID: " +
                          str(RSSI_Data.TargetPayloadID) + ", Time: " +
                          str(RSSI_Data.Epoch) + ", SysID: " +
                          str(RSSI_Data.SystemID))

                    if GlobalVals.SYSTEM_ID == 1:
                        with GlobalVals.RSSI_ALLOCATION_MUTEX:
                            # print("UPDATE RSSI ALLOCATION FROM RADIO [",RSSI_Data.SystemID,"] !!!!")
                            # print(GlobalVals.RSSI_ALLOCATION)
                            GlobalVals.RSSI_ALLOCATION[RSSI_Data.SystemID - 1][
                                int(RSSI_Data.TargetPayloadID) - 1] = True
                            # print("check 32")
                            # print(GlobalVals.RSSI_ALLOCATION)
                            RSSI_Handler.getPairAllocation()

                    # put data into the buffer
                    with GlobalVals.RSSI_DATA_BUFFER_MUTEX:
                        GlobalVals.RSSI_DATA_BUFFER.append(RSSI_Data)

                    # set the flags for the buffer
                    with GlobalVals.RECIEVED_RSSI_RADIO_DATA_MUTEX:
                        GlobalVals.RECIEVED_RSSI_RADIO_DATA = True

                    continue

                if recievedPacket.MessageID == 8:

                    # get the RSSI data
                    RSSI_AllocationData = CustMes.MESSAGE_RSSI_ALLOCATION()
                    error = RSSI_AllocationData.bytes_to_data(
                        recievedPacket.Payload)
                    if error != 0:
                        print(
                            "Radio Network Main: RSSI Allocation data error " +
                            str(error))
                        continue

                    # set the system id for the GPS data
                    RSSI_AllocationData.SystemID = recievedPacket.SystemID

                    if not RSSI_Handler.RSSI_AllocationFormatCheck(
                            RSSI_AllocationData):
                        print(
                            "RSSI Allocation message via RFD900 was broken. Discard it..."
                        )
                        continue

                    print("RSSI Allocation Data from " +
                          str(recievedPacket.SystemID) + ":" + "Pair:" +
                          str(int(RSSI_AllocationData.Pair)))

                    # put data into the buffer
                    with GlobalVals.RSSI_DATA_ALLOCATION_BUFFER_MUTEX:
                        # if len(GlobalVals.RSSI_DATA_ALLOCATION_BUFFER)>5:
                        #     GlobalVals.RSSI_DATA_ALLOCATION_BUFFER.pop(0)
                        GlobalVals.RSSI_DATA_ALLOCATION_BUFFER.append(
                            int(RSSI_AllocationData.Pair))

                    # set the flags for the buffer
                    with GlobalVals.RECIEVED_RSSI_ALLOCATION_RADIO_DATA_MUTEX:
                        GlobalVals.RECIEVED_RSSI_ALLOCATION_RADIO_DATA = True

                    continue

        with GlobalVals.PACKET_STATS_LOG_MUTEX:
            packetStatsLogTmp = copy.deepcopy(GlobalVals.PACKET_STATS_LOG)

        with GlobalVals.PACKET_STATS_AWS_MUTEX:
            GlobalVals.PACKET_STATS_AWS = packetStatsLogTmp

        # if radio GPS data has been recived record it
        if GlobalVals.RECIEVED_GPS_RADIO_DATA:

            logString = ""
            with GlobalVals.GPS_DATA_BUFFER_MUTEX:
                while len(GlobalVals.GPS_DATA_BUFFER) > 0:

                    # get the GPS data
                    GPSData = GlobalVals.GPS_DATA_BUFFER.pop(0)
                    Longitude = GPSData.Longitude
                    Latitude = GPSData.Latitude
                    Altitude = GPSData.Altitude
                    GPSTime = int(GPSData.GPSTime)
                    SystemID = GPSData.SystemID

                    # create message string
                    logString = logString + str(GPSTime) + "," + str(
                        SystemID) + "," + str(Longitude) + "," + str(
                            Latitude) + "," + str(Altitude) + "\n"

            # write the log string to file
            try:
                fileObj = open(GlobalVals.GROUND_STATION_LOG_FILE, "a")
                fileObj.write(logString)
                fileObj.close()
            except Exception as e:
                print("Exception: " + str(e.__class__))
                print(e)
                print("Error using GPS data log file")
示例#3
0
def main():

    recievedPackets = False
    # sendTime = int(time.time() + 1)

    # this loop will wait for packets and then process them
    while True:

        # curTime = int(time.time())

        # # send dummy GPS data once a second
        # if curTime >= sendTime:

        #     sendTime = curTime + 1
        #     GPSpacket = CustMes.MESSAGE_FRAME()
        #     GPSdata = CustMes.MESSAGE_GPS()

        #     # set up GPS packet
        #     GPSpacket.MessageID = 0x02
        #     GPSpacket.TargetID = 0
        #     GPSpacket.SystemID = GlobalVals.SYSTEM_ID

        #     # load dummy GPS data
        #     GPSdata.Longitude = 7.7
        #     GPSdata.Latitude = 8.8
        #     GPSdata.Altitude = 9.9
        #     GPSdata.GPSTime = 10.1

        #     # send dummy GPS packet
        #     GPSpacket.Payload = GPSdata.data_to_bytes()
        #     NetworkManager.sendPacket(GPSpacket)

        # check if packets have been recived
        with GlobalVals.RECIEVED_PACKETS_MUTEX:
            if GlobalVals.RECIEVED_PACKETS:
                recievedPackets = True

        # if no packets have been recived then sleep and loop
        if not recievedPackets:
            time.sleep(0.1)
            continue
        else:
            recievedPackets = False

        # go through all the packets in the buffer
        recievedPacket = CustMes.MESSAGE_FRAME()
        with GlobalVals.PACKET_BUFFER_IN_MUTEX:
            while len(GlobalVals.PACKET_BUFFER_IN) > 0:

                recievedPacket = GlobalVals.PACKET_BUFFER_IN.pop(0)

                # if the packet is a ping
                if recievedPacket.MessageID == 1:
                    NetworkManager.PingRespond(recievedPacket.SystemID,
                                               recievedPacket.Timestamp)

                # if the packet is a GPS data packet
                if recievedPacket.MessageID == 2:

                    # get the GPS data
                    GPSdata = CustMes.MESSAGE_GPS()
                    error = GPSdata.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: GPS data error " +
                              str(error))
                        continue

                    # print("GPS Data from " + str(recievedPacket.SystemID) + ":" +"Lon:" + str(round(GPSdata.Longitude,3)) + ", Lat:" + str(round(GPSdata.Latitude,3)) + ", Alt:" + str(round(GPSdata.Altitude,1)) + ", Time:" + str(round(GPSdata.GPSTime,1)))
                    # print("Lon:" + str(GPSdata.Longitude) + ", Lat:" + str(GPSdata.Latitude) + ", Alt:" + str(GPSdata.Altitude) + ", Time:" + str(GPSdata.GPSTime) + "\n")

                    # set the system id for the GPS data
                    GPSdata.SystemID = recievedPacket.SystemID

                    if not GPSHandler.GPS_FormatCheck(GPSdata):
                        print(
                            "GPS message via RFD900 was broken. Discard it...")
                        continue

                    print("Lon:" + str(round(GPSdata.Longitude, 2)) +
                          ", Lat:" + str(round(GPSdata.Latitude, 2)) +
                          ", Alt:" + str(round(GPSdata.Altitude, 2)) +
                          ", Time:" + str(GPSdata.GPSTime))

                    # print("RECEIVED GPS from ",GPSdata.SystemID,"!!")
                    # put data into the buffer
                    with GlobalVals.GPS_DATA_BUFFER_MUTEX:
                        GlobalVals.GPS_DATA_BUFFER.append(GPSdata)

                    # set the flags for the buffer
                    with GlobalVals.RECIEVED_GPS_RADIO_DATA_MUTEX:
                        GlobalVals.RECIEVED_GPS_RADIO_DATA = True

                    continue

                    # get the GPS data
                    # recData = CustMes.MESSAGE_GPS()
                    # error = recData.bytes_to_data(recievedPacket.Payload)
                    # if error != 0:
                    #     print ("Radio Network Main: GPS data error " + str(error) )
                    #     continue

                    # print("GPS Data from " + str(recievedPacket.SystemID) + ":")
                    # print("Lon:" + str(recData.Longitude) + ", Lat:" + str(recData.Latitude) + ", Alt:" + str(recData.Altitude) + ", Time:" + str(recData.GPSTime) + "\n")

                    # continue

                # if the packet is string message
                if recievedPacket.MessageID == 3:

                    # get the string
                    StrData = CustMes.MESSAGE_STR()
                    error = StrData.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Packet error, packet will be discarded.\n")
                        continue

                    # print string
                    print(StrData.MessageStr)

                    continue

                if recievedPacket.MessageID == 4:

                    # get the GPS data
                    IMUdata = CustMes.MESSAGE_IMU()
                    error = IMUdata.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: IMU data error " +
                              str(error))
                        continue

                    print("IMU Data from " + str(recievedPacket.SystemID) +
                          ":")
                    print("Euler:" + str(IMUdata.Euler321_theta) + "\n")

                    # set the system id for the GPS data
                    IMUdata.SystemID = recievedPacket.SystemID

                    # put data into the buffer
                    with GlobalVals.IMU_DATA_BUFFER_MUTEX:
                        GlobalVals.IMU_DATA_BUFFER.append(GPSdata)

                    # set the flags for the buffer
                    with GlobalVals.RECIEVED_IMU_RADIO_DATA_MUTEX:
                        GlobalVals.RECIEVED_IMU_RADIO_DATA = True

                    continue

                if recievedPacket.MessageID == 5:

                    # get the GPS data
                    EKF_Data = CustMes.MESSAGE_EKF()
                    error = EKF_Data.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: EKF data error " +
                              str(error))
                        continue

                    # print("GPS Data from " + str(recievedPacket.SystemID) + ":" +"Lon:" + str(round(GPSdata.Longitude,3)) + ", Lat:" + str(round(GPSdata.Latitude,3)) + ", Alt:" + str(round(GPSdata.Altitude,1)) + ", Time:" + str(round(GPSdata.GPSTime,1)))
                    # print("Lon:" + str(GPSdata.Longitude) + ", Lat:" + str(GPSdata.Latitude) + ", Alt:" + str(GPSdata.Altitude) + ", Time:" + str(GPSdata.GPSTime) + "\n")

                    # set the system id for the GPS data
                    EKF_Data.SystemID = recievedPacket.SystemID

                    if not EKFHandler.EKF_FormatCheck(EKF_Data):
                        print(
                            "EKF message via RFD900 was broken. Discard it...")
                        continue

                    print("EKF EKF EKF Data from [", EKF_Data.SystemID,
                          "], Lat: ", round(EKF_Data.Latitude, 2), ", Lon: ",
                          round(EKF_Data.Longitude, 2), ", Alt: ",
                          round(EKF_Data.Altitude, 2))
                    # put data into the buffer
                    # with GlobalVals.EKF_DATA_BUFFER_MUTEX:
                    #     GlobalVals.EKF_DATA_BUFFER.append(EKF_Data)

                    # set the flags for the buffer
                    # with GlobalVals.RECIEVED_EKF_RADIO_DATA_MUTEX:
                    #     GlobalVals.RECIEVED_EKF_RADIO_DATA = True

                    continue
                # Temperature
                if recievedPacket.MessageID == 6:

                    # get the RSSI data
                    temperatureData = CustMes.MESSAGE_TEMP()
                    error = temperatureData.bytes_to_data(
                        recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: temperature data error " +
                              str(error))
                        continue

                    # set the system id for the GPS data
                    temperatureData.SystemID = recievedPacket.SystemID

                    if not TemperatureHandler.temperatureFormatCheck(
                            temperatureData):
                        print(
                            "Temperature message via RFD900 was broken. Discard it..."
                        )
                        continue

                    # print(" Temperature Data from " + str(recievedPacket.SystemID) + ":" + "Temperature:" + str(round(temperatureData.Temperature,1)))

                # RSSI
                if recievedPacket.MessageID == 7:

                    # get the RSSI data
                    RSSI_Data = CustMes.MESSAGE_RSSI()
                    error = RSSI_Data.bytes_to_data(recievedPacket.Payload)
                    if error != 0:
                        print("Radio Network Main: RSSI data error " +
                              str(error))
                        continue

                    # set the system id for the GPS data
                    RSSI_Data.SystemID = recievedPacket.SystemID
                    # print(RSSI_Data.SystemID)
                    # print(RSSI_Data.TargetPayloadID)
                    # print(GlobalVals.RSSI_ALLOCATION)

                    # Check if the message was sent correctly via the RFD900
                    if not RSSI_Handler.RSSI_FormatCheck(RSSI_Data):
                        print(
                            "RSSI message via RFD900 was broken. Discard it..."
                        )
                        continue

                    print("RSSI Data from " + str(recievedPacket.SystemID) +
                          ": " + "RSSI Distance:" +
                          str(round(RSSI_Data.Distance, 1)) +
                          ", Filtered RSSI: " +
                          str(round(RSSI_Data.FilteredRSSI, 1)) +
                          ", TargetPayloadID: " +
                          str(RSSI_Data.TargetPayloadID) + ", Time: " +
                          str(RSSI_Data.Epoch) + ", SysID: " +
                          str(RSSI_Data.SystemID))

                    if GlobalVals.SYSTEM_ID == 1:
                        with GlobalVals.RSSI_ALLOCATION_MUTEX:
                            # print("UPDATE RSSI ALLOCATION FROM RADIO [",RSSI_Data.SystemID,"] !!!!")
                            # print(GlobalVals.RSSI_ALLOCATION)
                            GlobalVals.RSSI_ALLOCATION[RSSI_Data.SystemID - 1][
                                int(RSSI_Data.TargetPayloadID) - 1] = True
                            # print("check 32")
                            # print(GlobalVals.RSSI_ALLOCATION)
                            RSSI_Handler.getPairAllocation()

                    # put data into the buffer
                    with GlobalVals.RSSI_DATA_BUFFER_MUTEX:
                        GlobalVals.RSSI_DATA_BUFFER.append(RSSI_Data)

                    # set the flags for the buffer
                    with GlobalVals.RECIEVED_RSSI_RADIO_DATA_MUTEX:
                        GlobalVals.RECIEVED_RSSI_RADIO_DATA = True

                    continue

                if recievedPacket.MessageID == 8:

                    # get the RSSI data
                    RSSI_AllocationData = CustMes.MESSAGE_RSSI_ALLOCATION()
                    error = RSSI_AllocationData.bytes_to_data(
                        recievedPacket.Payload)
                    if error != 0:
                        print(
                            "Radio Network Main: RSSI Allocation data error " +
                            str(error))
                        continue

                    # set the system id for the GPS data
                    RSSI_AllocationData.SystemID = recievedPacket.SystemID

                    if not RSSI_Handler.RSSI_AllocationFormatCheck(
                            RSSI_AllocationData):
                        print(
                            "RSSI Allocation message via RFD900 was broken. Discard it..."
                        )
                        continue

                    print(" RSSI Allocation Data from " +
                          str(recievedPacket.SystemID) + ":" + "Pair:" +
                          str(int(RSSI_AllocationData.Pair)))

                    # put data into the buffer
                    with GlobalVals.RSSI_DATA_ALLOCATION_BUFFER_MUTEX:
                        # if len(GlobalVals.RSSI_DATA_ALLOCATION_BUFFER)>5:
                        #     GlobalVals.RSSI_DATA_ALLOCATION_BUFFER.pop(0)
                        GlobalVals.RSSI_DATA_ALLOCATION_BUFFER.append(
                            int(RSSI_AllocationData.Pair))

                    # set the flags for the buffer
                    with GlobalVals.RECIEVED_RSSI_ALLOCATION_RADIO_DATA_MUTEX:
                        GlobalVals.RECIEVED_RSSI_ALLOCATION_RADIO_DATA = True

                    continue