pykob.internet - MorseKOB/PyKOB GitHub Wiki

pykob.internet — connect to remote stations over the internet

Source code: pykob/internet.py

This module defines a class whose objects correspond to telegraph wires, using the facilities of the internet and the KOB server.

Internet class

class pykob.internet.Internet(officeID, callback=None)

  • officeID: a string containing identifying information (e.g., office call, name, location)
  • callback: function called whenever a code sequence is received from the internet

Internet methods

Internet.connect(wireNo)

  • wireNo: the KOB wire to connect to

Internet.disconnect()

Internet.read()

  • returns the next code sequence coming in from the wire; if there's a discontinuity in the packet sequence numbers then the first element of the returned code sequence is changed to -32767 (-0x7fff); this can either mean a different station has started sending, in which case the second element will be +1, or a packet has been dropped by the network

Internet.write(code)

  • code: the code sequence to be sent

Internet.set_officeID(officeID)

  • officeID: the office/station ID to be used on the connected wire

Internet.monitor_IDs(ID_callback)

  • ID_callback: the function to call when incoming and outgoing station IDs are detected

Internet.monitor_sender(sender_callback)

  • sender_callback: the function to call when a sender is detected

Internet attribute

Internet.tLastListener

  • the most recent time some other station on the same wire sent an ID or code packet (this read-only attribute can be used to determine whether an active listener is on the wire)

Callback functions

callback(code)

  • code: a code sequence received from the internet

ID_callback(id)

  • id: the office ID that was sent or received

sender_callback(id)

  • id: the sender's office ID