# Path: src/apex/util.py
# def echo_colorized_frame(frame, port_name, direction_in):
#     formatted_aprs = '>'.join([click.style(frame['source'], fg='green'), click.style(frame['destination'], fg='blue')])
#     paths = []
#     for path in frame['path']:
#         paths.append(click.style(path, fg='cyan'))
#     paths = ','.join(paths)
#     if frame['path']:
#         formatted_aprs = ','.join([formatted_aprs, paths])
#     formatted_aprs += ':'
#     formatted_aprs += frame['text']
#     if direction_in:
#         click.echo(click.style(port_name + ' << ', fg='magenta') + formatted_aprs)
#     else:
#         click.echo(click.style(port_name + ' >> ', fg='magenta', bold=True, blink=True) + formatted_aprs)
# 
# Path: src/apex/util.py
# def echo_colorized_warning(text):
#     click.echo(click.style('Warning: ', fg='yellow') + click.style(text))


import threading
import time
import cachetools
from apex.aprs import util as aprs_util
from .util import echo_colorized_frame
from .util import echo_colorized_warning
        self.base_tnc = base_tnc
        self.base_port = base_port
        self.base_name = base_name
        self.echo_packets = echo_packets

    @property
    def port(self):
        return self.base_port

    @property
    def name(self):
        return self.base_name

    def connect(self, *args, **kwargs):
        self.base_tnc.connect(*args, **kwargs)

    def close(self, *args, **kwargs):
        self.base_tnc.close(*args, **kwargs)

    def write(self, frame, *args, **kwargs):
        with self.lock:
            frame_hash = str(aprs_util.hash_frame(frame))
            if frame_hash not in self.packet_cache:
                self.packet_cache[frame_hash] = frame
                if self.base_port:
                    self.base_tnc.write(frame, self.base_port)
                else:
                    self.base_tnc.write(frame)

                if self.echo_packets:

# Path: src/apex/util.py
# def echo_colorized_frame(frame, port_name, direction_in):
#     formatted_aprs = '>'.join([click.style(frame['source'], fg='green'), click.style(frame['destination'], fg='blue')])
#     paths = []
#     for path in frame['path']:
#         paths.append(click.style(path, fg='cyan'))
#     paths = ','.join(paths)
#     if frame['path']:
#         formatted_aprs = ','.join([formatted_aprs, paths])
#     formatted_aprs += ':'
#     formatted_aprs += frame['text']
#     if direction_in:
#         click.echo(click.style(port_name + ' << ', fg='magenta') + formatted_aprs)
#     else:
#         click.echo(click.style(port_name + ' >> ', fg='magenta', bold=True, blink=True) + formatted_aprs)
# 
# Path: src/apex/util.py
# def echo_colorized_warning(text):
#     click.echo(click.style('Warning: ', fg='yellow') + click.style(text))


# Path: src/apex/buffers.py
import threading
import time
import cachetools
from apex.aprs import util as aprs_util
from .util import echo_colorized_frame
from .util import echo_colorized_warning

        self.base_tnc = base_tnc
        self.base_port = base_port
        self.base_name = base_name
        self.echo_packets = echo_packets

    @property
    def port(self):
        return self.base_port

    @property
    def name(self):
        return self.base_name

    def connect(self, *args, **kwargs):
        self.base_tnc.connect(*args, **kwargs)

    def close(self, *args, **kwargs):
        self.base_tnc.close(*args, **kwargs)

    def write(self, frame, *args, **kwargs):
        with self.lock:
            frame_hash = str(aprs_util.hash_frame(frame))
            if frame_hash not in self.packet_cache:
                self.packet_cache[frame_hash] = frame
                if self.base_port:
                    self.base_tnc.write(frame, self.base_port)
                else:
                    self.base_tnc.write(frame)

                if self.echo_packets:

                    echo_colorized_frame(frame, self.base_name, False)