def test(self):
        if os.path.exists(TEST_FILE_NAME):
            os.remove(TEST_FILE_NAME)

        row = "0c:f3:ee:00:f6:33,8deefbb9f7384297804096668bb44281,5000,3221,-63,-78"
        queue.queue_beacon(row)

        #
        # check the key exists
        #
        buffer = queue.read_list()
        key = "8deefbb9f7384297804096668bb44281_5000_3221"
        new_assert = queue.key_exists(key, buffer)
        self.assertEqual(new_assert, True)

        row2 = "0c:f3:ee:00:f6:33,8deefbb9f7384297804096668bb44281,5001,3221,-63,-78"
        queue.queue_beacon(row2)

        #
        # check the key exists
        #
        buffer2 = queue.read_list()
        key2 = "8deefbb9f7384297804096668bb44281_5001_3221"
        new_assert2 = queue.key_exists(key2, buffer2)
        self.assertEqual(new_assert2, True)

        new_assert3 = queue.key_exists(key, buffer2)
        self.assertEqual(new_assert3, True)
    def test(self):
        row = "0c:f3:ee:00:f6:33,8deefbb9f7384297804096668bb44281,5000,3221,-63,-78"
        queue.queue_beacon(row)

        #
        # check the key exists
        #
        buffer = queue.read_list()
        key = "8deefbb9f7384297804096668bb44281_5000_3221"
        new_assert = queue.key_exists(key, buffer)
        self.assertEqual(new_assert, True)
def scan_loop(sock):
    while True:
        returned_list = blescan.parse_events(sock, 10)

        if len(returned_list) > 0:
            keepalive.set_last_run()

            for beacon in returned_list:
                queue.queue_beacon(beacon)

        keepalive_message = keepalive.check_keepalive()

        if keepalive_message is not None:
            send.send(1, "KA:%s", keepalive_message)