obspy.clients.seedlink.client.seedlinkconnection.SeedLinkConnection
- class SeedLinkConnection(timeout=None)[source]
Bases:
object
Class to manage a connection to a SeedLink server using a Socket.
See obspy.realtime.seedlink.SLClient for an example of how to create and use this SeedLinkConnection object. A new SeedLink application can be created by sub-classing SLClient, or by creating a new class and invoking the methods of SeedLinkConnection.
- Variables
SEEDLINK_PROTOCOL_PREFIX – URI/URL prefix for seedlink servers (“seedlink://”).
UNISTATION – The station code used for uni-station mode.
UNINETWORK – The network code used for uni-station mode.
DFT_READBUF_SIZE – Default size for buffer to hold responses from server (default is 1024).
QUOTE_CHAR – Character used for delimiting timestamp strings in the statefile.
Publicly accessible (get/set) parameters:
- Variables
sladdr – The host:port of the SeedLink server.
keepalive – Interval to send keepalive/heartbeat (seconds) (default is 0 sec).
netto – Network timeout (seconds) (default is 120 sec).
netdly – Network reconnect delay (seconds) (default is 30 sec).
info_string – String containing concatenation of contents of last terminated set of INFO packets.
statefile – File name for storing state information.
lastpkttime – Flag to control last packet time usage, if true, begin_time is appended to DATA command (Default is False).
- Parameters
timeout (float) – Time in seconds after which a collect() call will be interrupted.
Protected parameters
- Variables
streams – Vector of SLNetStation objects.
begin_time – Beginning of time window.
end_time – End of time window.
resume – Flag to control resuming with sequence numbers.
multistation – Flag to indicate multistation mode.
dialup – Flag to indicate dial-up mode.
terminate_flag – Flag to control connection termination.
server_id – ID of the remote SeedLink server.
server_version – Version of the remote SeedLink server.
info_request_string – INFO level to request.
socket – The network socket.
state – Persistent state information.
infoStrBuf – String to store INFO packet contents.
Attributes
Public Methods
Add a new stream entry to the stream chain for the given net/station parameters. |
|
Check this SeedLinkConnection description has valid parameters. |
|
Checks server version number against a given specified value. |
|
Closes this SeedLinkConnection by closing the network socket and saving the state to the statefile, if it exists. |
|
Manage a connection to a SeedLink server based on the values given in this SeedLinkConnection, and to collect data. |
|
Configure/negotiate data stream(s) with the remote SeedLink server. |
|
Open a network socket connection to a SeedLink server. |
|
Close the network socket associated with this connection. |
|
Terminate the collection loop. |
|
Returns the results of the last INFO request. |
|
Returns the interval to send keepalive/heartbeat (seconds). |
|
Returns the network reconnect delay (seconds). |
|
Returns the network timeout (seconds). |
|
Returns the host:port of the SeedLink server. |
|
Returns the SLState state object. |
|
Returns a copy of the Vector of SLNetStation objects. |
|
Returns connection state of the connection socket. |
|
Check a socket for write ability using select() |
|
Negotiate a SeedLink connection using multi-station mode and issue the END action command. |
|
Negotiate a SeedLink connection for a single station and issue the DATA command. |
|
Negotiate a SeedLink connection in uni-station mode and issue the DATA command. |
|
Parse a string of streams and selectors and add them to the stream chain for configuring a multi-station connection. |
|
Read a list of streams and selectors from a file and add them to the stream chain for configuring a multi-station connection. |
|
Read bytes from the server. |
|
Recover the state file and put the sequence numbers and time stamps into the pre-existing stream chain entries. |
|
Add an INFO request to the SeedLink Connection Description. |
|
Save all current sequence numbers and time stamps into the given state file. |
|
Send the HELLO command and attempt to parse the server version number from the returned string. |
|
Send bytes to the server. |
|
Sends a request for the specified INFO level. |
|
Sets begin_time for initiation of continuous data transmission. |
|
Sets end_time for termination of data transmission. |
|
Sets interval to send keepalive/heartbeat (seconds). |
|
Sets a specified start time for beginning of data transmission . |
|
Sets the network reconnect delay (seconds). |
|
Sets the network timeout (seconds). |
|
Sets the host:port of the SeedLink server. |
|
Set the state file and recover state. |
|
Set the parameters for a uni-station mode connection for the given SLCD struct. |
|
Sets terminate flag, closes connection and clears state. |
|
Update the appropriate stream chain entry given a Mini-SEED record. |
Special Methods
- SeedLinkConnection.__delattr__(name, /)
Implement delattr(self, name).
- SeedLinkConnection.__dir__()
Default dir() implementation.
- SeedLinkConnection.__eq__(value, /)
Return self==value.
- SeedLinkConnection.__format__(format_spec, /)
Default object formatter.
- SeedLinkConnection.__ge__(value, /)
Return self>=value.
- SeedLinkConnection.__getattribute__(name, /)
Return getattr(self, name).
- SeedLinkConnection.__gt__(value, /)
Return self>value.
- SeedLinkConnection.__hash__()
Return hash(self).
- SeedLinkConnection.__init_subclass__()
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- SeedLinkConnection.__le__(value, /)
Return self<=value.
- SeedLinkConnection.__lt__(value, /)
Return self<value.
- SeedLinkConnection.__ne__(value, /)
Return self!=value.
- SeedLinkConnection.__new__(**kwargs)
- SeedLinkConnection.__reduce__()
Helper for pickle.
- SeedLinkConnection.__reduce_ex__(protocol, /)
Helper for pickle.
- SeedLinkConnection.__repr__()
Return repr(self).
- SeedLinkConnection.__setattr__(name, value, /)
Implement setattr(self, name, value).
- SeedLinkConnection.__sizeof__()
Size of object in memory, in bytes.
- SeedLinkConnection.__str__()
Return str(self).
- SeedLinkConnection.__subclasshook__()
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).