simpledali.abstractdali
Module Contents
Classes
Data
API
- simpledali.abstractdali.DLPROTO_1_0 = '1.0'
- simpledali.abstractdali.DLPROTO_1_1 = '1.1'
- simpledali.abstractdali.NO_SOUP = 'Write permission not granted, no soup for you!'
- simpledali.abstractdali.QUERY_MODE = 'query'
- simpledali.abstractdali.STREAM_MODE = 'stream'
- class simpledali.abstractdali.DataLink(packet_size=-1, dlproto=DLPROTO_1_0, verbose=False)
Bases:
abc.ABC- async __aenter__()
- async __aexit__(exc_type, exc, tb)
- abstractmethod async createDaliConnection()
- abstractmethod async send(header, data)
- abstractmethod async parseResponse()
- abstractmethod isClosed()
- abstractmethod async close()
Closes the connection if open.
- abstractmethod _force_close()
Closes the connection forcefully, without any closing handshake.
- isQueryMode()
Returns True if the current connection is in Query mode, ie not streaming.
- isStreamMode()
Returns True if the current connection is in Stream mode.
- updateMode(header)
- async write(streamid, hpdatastart, hpdataend, flags, data, pktid=None)
- async writeAck(streamid, hpdatastart, hpdataend, data, pktid=None)
- async writeMSeed(msr, pktid=None)
Write a datalink packet with data that is a single miniseed2 record.
Calcuates the streamid based on the headers to be: <net>_<station>_<loc>_<channel>/MSEED
- async writeMSeed3(ms3, pktid=None)
Write a datalink packet with data that is a single mseed3 record
Calcuates the streamid based on the headers to be: <sid>/MSEED3 where <sid> is the source identifier without the leading FDSN:
- async writeJSON(streamid, hpdatastart, hpdataend, jsonMessage, pktid=None)
Write a datalink packet with data that is JSON.
Usually the streamid ends with /JSON
- async writeBZ2JSON(streamid, hpdatastart, hpdataend, jsonMessage, pktid=None)
Write a datalink packet with data that is JSON and compressed with bzip2.
Usually the streamid ends with /BZJSON
- async writeCommand(command, dataString=None)
- async auth(token)
Sends an AUTHORIZATION command. Note this is not part of the official DataLink protocol yet. See util.encodeAuthToken() and util.decodeAuthToken().
- async id(programname, username, processid, architecture)
Send an ID command. Returns the servers id and capabilities response. Also sets packet size and dlproto fields.
- async info(infotype)
Send an INFO command. Returns the servers response.
- async positionSet(packetId, packetTime=None)
Send a POSITION SET command to the given packetId, optionally with a time.
- async positionEarliest()
Send a POSITION SET EARLIEST command.
- async positionLatest()
Send a POSITION SET LATEST command.
- async positionAfter(time)
Send a POSITION AFTER command with the given time.
- async positionAfterHPTime(hpdatastart)
- async match(pattern)
Send a MATCH command with the given regular expression pattern.
- async reject(pattern)
Send a REJECT command with the given regular expression pattern.
- async read(packetId)
- async readEarliest()
Attempt to read earliest packet in ring.
The requires an exchange of two commands, position and read, and so if packets are removed from the server between the commands then the packet will not be returned and an DaliException will be thrown. Also, this will raise a DaliException if called on an empty ring as there is no earliest packet.
- async readLatest()
Read latest packet in ring.
The requires an exchange of two commands, position and read, and so if packets arrive at the server between the commands then the packet will not be the latest. Also, this will raise a DaliException if called on an empty ring as there is no latest packet.
- async stream()
Switch to streaming mode. The server will begin sending packets based on the configuration previously set.
- async startStream()
- async endStream()
- async reconnect()
- async parsedInfoStatus()
Realy simple parsing of info status xml into dict
- parse_capabilities(cap)
Realy simple parsing of INFO capabilities xml into dict
- status_xml_to_dict(statusEl)
- async parsedInfoStreams()
Really simple parsing of INFO streams xml into dict
- info_typed(k, v)