Example #1
0
    def __init__(self, host: str, port: str, source: str, destination: str):
        self.source = source
        self.destination = destination
        self.kiss_connection = kiss.TCPKISS(host=host, port=port)
        self.kiss_connection.start()

        pass
Example #2
0
    def test_write_and_read(self):
        """Tests writing-to and reading-from TCP Host."""
        frame = "%s>%s:%s" % (self.random(6), ','.join([
            self.random(6), self.random(6),
            self.random(6)
        ]), ' '.join([self.random(), 'test_write_and_read',
                      self.random()]))
        aprs_frame = aprs.Frame(frame)
        kiss_frame = aprs_frame.encode_kiss()

        ks = kiss.TCPKISS(host=self.random_host, port=self.random_port)
        a = (self.random_host, self.random_port)

        entry = MocketEntry(a, [kiss_frame])
        entry_1 = MocketEntry(('localhost', 80), True)
        Mocket.register(entry)

        ks.interface = create_connection(a)
        ks._write_handler = ks.interface.sendall

        def _pass():
            pass

        ks.stop = _pass

        ks.write(kiss_frame)

        _read_data = ks.read(len(kiss_frame), readmode=False)

        self._logger.info('_read_data(%s)="%s"', len(_read_data), _read_data)
Example #3
0
    def _test_write(self):
        frame = "%s>%s:%s" % (self.random(6), ','.join([
            self.random(6), self.random(6),
            self.random(6)
        ]), ' '.join([self.random(), 'test_write',
                      self.random()]))
        aprs_frame = aprs.Frame(frame)
        kiss_frame = aprs_frame.encode_kiss()

        ks = kiss.TCPKISS(host=self.random_host, port=self.random_port)
        a = (self.random_host, self.random_port)

        entry = MocketEntry(a, kiss_frame)
        Mocket.register(entry)
        self._logger.debug(a)
        self._logger.debug(entry.get_response())

        ks.interface = create_connection(a)
        ks._write_handler = ks.interface.sendall

        def _pass():
            pass

        ks.stop = _pass

        ks.write(kiss_frame)
Example #4
0
 def __init__(self, name: str, conn_conf: ConnectionConfiguration,
              callback: Callable):
     TNCThread.__init__(self, name)
     self.kiss = kiss.TCPKISS(conn_conf.ip,
                              conn_conf.port,
                              strip_df_start=True)
     self.conn_conf = conn_conf
     self.callback = callback
     self.stop_signal = False
Example #5
0
def main():
    frame = aprs.Frame()
    frame.source = aprs.Callsign('W2GMD-14')
    frame.destination = aprs.Callsign('PYKISS')
    frame.path = [aprs.Callsign('WIDE1-1')]
    frame.text = '>Hello World!'

    ki = kiss.TCPKISS(host='localhost', port=1234)
    ki.start()
    ki.write(frame.encode_kiss())
Example #6
0
def main():
    global CALLSIGN

    print("Default callsign: [%s]" % CALLSIGN)

    # If a callsign was provided on the command-line, pick it up
    if len(sys.argv) > 1:
        CALLSIGN = sys.argv[1].strip()
    print("Callsign: [%s]" % CALLSIGN)


    ki = kiss.TCPKISS(host='localhost', port=8001)
    ki.start()
    ki.read(callback=process_frame)
Example #7
0
def main():
    frame = aprs.Frame()

    # import pdb; pdb.set_trace()

    frame = aprs.Frame(source='W2GMD-14',
                       destination='PYKISS',
                       info=bytes('>Hello World!', 'ascii'))
    ki = kiss.TCPKISS(host=HOST, port=PORT)
    ki.start()

    import pdb
    pdb.set_trace()

    #ki.write(bytes(str(frame),'ascii'))
    encoded_frame = bytes(str(frame), 'ascii')
    ki.write(encoded_frame)
Example #8
0
    def start(self):
        """
        Start.
        """
        print("aprs-bot RX starting...")

        # Do the MQTT things.
        self.__m = mqtt.Client()

        # Ugly AF. Do this better.
        try:
            self.__mqtt_connect()

        except (KeyboardInterrupt, SystemExit):
            raise

        except:
            print(traceback.format_exc())
            time.sleep(1)
            self.__mqtt_connect()

        # Determine what sort of connection method to use.
        if self.__connection_spec['type'] == "tcp":
            self.__k = kiss.TCPKISS(self.__connection_spec['host'],
                                    self.__connection_spec['port'])

        elif self.__connection_spec['type'] == "serial":
            self.__k = kiss.SerialKISS(self.__connection_spec['serial_port'],
                                       self.__connection_spec['baud'])

        else:
            raise ValueError(
                "Couldn't determine type of KISS connection to use.")

        # Connect up.
        self.__k.start()
        self.__k.read(callback=self.process_frame)
Example #9
0
def main():
    ki = kiss.TCPKISS(host='localhost', port=52001)
    ki.start()
    ki.read(callback=print_frame)
def read_kiss_forever():
    # wait just a sec for the rtl_fm and direwolf to start
    time.sleep(0.5)
    k = kiss.TCPKISS("localhost", 8001)
    k.start()  # start the TCP TNC connection
    k.read(callback=parse_packet) # set the TNC read callback