Enum ConnectionState
- java.lang.Object
-
- java.lang.Enum<ConnectionState>
-
- com.caplin.streamlink.ConnectionState
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ConnectionState>
public enum ConnectionState extends java.lang.Enum<ConnectionState>
Enumeration that defines the state of a StreamLink connection to a Liberator.
You can obtain the
ConnectionState
by callinggetConnectionState
on aConnectionStatusEvent
.Although hints regarding possible transitions between
ConnectionState
s are given, you should not imply that this is a strict contract because network conditions may cause undocumented transitions.The generalised sequence after calling
streamlink.connect()
is as follows:CONNECTING
->CONNECTED
->LOGGEDIN
. At any point in time the connection could be lost which would raise theLOST
, at this point StreamLink would attempt to connect again to a Liberator server, starting the sequence once more.With this in mind, it is possible to map these onto a "traffic light" component indicating connection health using the following mappings:
- RED
DISCONNECTED
- GREEN
LOGGEDIN
- AMBER All other
ConnectionState
s.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CONNECTED
A network connection has been established to the Liberator.CONNECTING
A connection attempt is in progress.CREDENTIALSRETRIEVALFAILED
StreamLink has failed to retrieve the credentials.CREDENTIALSRETRIEVED
StreamLink has successfully retrieved the credentials.DISCONNECTED
Disconnected from the Liberator.EJECTED
The client has been ejected from the Liberator.FAILED
A connection attempt has failed.LOGGEDIN
The client is now logged into the Liberator.LOGINFAILED
The client could not login to the Liberator.LOST
The connection to the Liberator has been lost.PAUSED
The connection has been paused by the application.RECONNECTED
The Liberator session has been reconnected.RETRIEVINGCREDENTIALS
StreamLink is attempting to obtain a set of credentials to log in to the server.UNREACHABLE
A connection to the Liberator is not possible due to no network being available.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConnectionState
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ConnectionState[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DISCONNECTED
public static final ConnectionState DISCONNECTED
Disconnected from the Liberator. When this state is raised by the StreamLink library all subscriptions have removed. StreamLink will not perform any activity until you call
connect()
on theStreamLink
object.
-
CONNECTING
public static final ConnectionState CONNECTING
A connection attempt is in progress. If the connection attempt is successful, a
CONNECTED
state will be raised, if the connection fails, theFAILED
event will be raised.
-
FAILED
public static final ConnectionState FAILED
A connection attempt has failed. StreamLink will attempt to connect to a Liberator on the configured server list.
-
CONNECTED
public static final ConnectionState CONNECTED
A network connection has been established to the Liberator. StreamLink will now attempt to log in to the Liberator session.
-
RETRIEVINGCREDENTIALS
public static final ConnectionState RETRIEVINGCREDENTIALS
StreamLink is attempting to obtain a set of credentials to log in to the server.
-
CREDENTIALSRETRIEVED
public static final ConnectionState CREDENTIALSRETRIEVED
StreamLink has successfully retrieved the credentials.
-
CREDENTIALSRETRIEVALFAILED
public static final ConnectionState CREDENTIALSRETRIEVALFAILED
StreamLink has failed to retrieve the credentials.
-
LOGGEDIN
public static final ConnectionState LOGGEDIN
The client is now logged into the Liberator. In this state it is possible for StreamLink applications to receive subscription updates and receive responses to commands.
-
LOGINFAILED
public static final ConnectionState LOGINFAILED
The client could not login to the Liberator. StreamLink will not perform any more connection attempts and will switch to the
DISCONNECTED
state.
-
EJECTED
public static final ConnectionState EJECTED
The client has been ejected from the Liberator. StreamLink will not perform any more connection attempts and will switch to the
DISCONNECTED
state.
-
LOST
public static final ConnectionState LOST
The connection to the Liberator has been lost. StreamLink will attempt to connect and establish a new session with a configured Liberator.
-
RECONNECTED
public static final ConnectionState RECONNECTED
The Liberator session has been reconnected. This should be treated as an informational event, StreamLink will switch to the
LOGGEDIN
state to simplify implementation of your application (see the traffic light example above).
-
UNREACHABLE
public static final ConnectionState UNREACHABLE
A connection to the Liberator is not possible due to no network being available.
-
PAUSED
public static final ConnectionState PAUSED
The connection has been paused by the application. This state is a direct result of the application causing {@link com.caplin.streamlink.StreamLink.pause()}. StreamLink is held in a "frozen" state pending a call to {@link com.caplin.streamlink.StreamLink.resume()}.
-
-
Method Detail
-
values
public static ConnectionState[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ConnectionState c : ConnectionState.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConnectionState valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-