1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.fourthline.cling.support.avtransport.impl.state;
17
18 import org.fourthline.cling.support.avtransport.lastchange.AVTransportVariable;
19 import org.fourthline.cling.support.model.AVTransport;
20 import org.fourthline.cling.support.model.SeekMode;
21 import org.fourthline.cling.support.model.TransportAction;
22 import org.fourthline.cling.support.model.TransportInfo;
23 import org.fourthline.cling.support.model.TransportState;
24
25 import java.net.URI;
26 import java.util.logging.Logger;
27
28
29
30
31 public abstract class Stopped<T extends AVTransport> extends AbstractState<T> {
32
33 final private static Logger log = Logger.getLogger(Stopped.class.getName());
34
35 public Stopped(T transport) {
36 super(transport);
37 }
38
39 public void onEntry() {
40 log.fine("Setting transport state to STOPPED");
41 getTransport().setTransportInfo(
42 new TransportInfo(
43 TransportState.STOPPED,
44 getTransport().getTransportInfo().getCurrentTransportStatus(),
45 getTransport().getTransportInfo().getCurrentSpeed()
46 )
47 );
48 getTransport().getLastChange().setEventedValue(
49 getTransport().getInstanceId(),
50 new AVTransportVariable.TransportState(TransportState.STOPPED),
51 new AVTransportVariable.CurrentTransportActions(getCurrentTransportActions())
52 );
53 }
54
55 public abstract Class<? extends AbstractState<?>> setTransportURI(URI uri, String metaData);
56 public abstract Class<? extends AbstractState<?>> stop();
57 public abstract Class<? extends AbstractState<?>> play(String speed);
58 public abstract Class<? extends AbstractState<?>> next();
59 public abstract Class<? extends AbstractState<?>> previous();
60 public abstract Class<? extends AbstractState<?>> seek(SeekMode unit, String target);
61
62 public TransportAction[] getCurrentTransportActions() {
63 return new TransportAction[] {
64 TransportAction.Stop,
65 TransportAction.Play,
66 TransportAction.Next,
67 TransportAction.Previous,
68 TransportAction.Seek
69 };
70 }
71 }