View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.support.model;
17  
18  import org.fourthline.cling.model.action.ActionArgumentValue;
19  
20  import java.util.Map;
21  
22  /**
23   *
24   */
25  public class TransportInfo {
26  
27      private TransportState currentTransportState = TransportState.NO_MEDIA_PRESENT;
28      private TransportStatus currentTransportStatus = TransportStatus.OK;
29      private String currentSpeed = "1";
30  
31      public TransportInfo() {
32      }
33  
34      public TransportInfo(Map<String, ActionArgumentValue> args) {
35          this(
36                  TransportState.valueOrCustomOf((String) args.get("CurrentTransportState").getValue()),
37                  TransportStatus.valueOrCustomOf((String) args.get("CurrentTransportStatus").getValue()),
38                  (String) args.get("CurrentSpeed").getValue()
39          );
40      }
41  
42      public TransportInfo(TransportState currentTransportState) {
43          this.currentTransportState = currentTransportState;
44      }
45  
46      public TransportInfo(TransportState currentTransportState, String currentSpeed) {
47          this.currentTransportState = currentTransportState;
48          this.currentSpeed = currentSpeed;
49      }
50  
51      public TransportInfo(TransportState currentTransportState, TransportStatus currentTransportStatus) {
52          this.currentTransportState = currentTransportState;
53          this.currentTransportStatus = currentTransportStatus;
54      }
55  
56      public TransportInfo(TransportState currentTransportState, TransportStatus currentTransportStatus, String currentSpeed) {
57          this.currentTransportState = currentTransportState;
58          this.currentTransportStatus = currentTransportStatus;
59          this.currentSpeed = currentSpeed;
60      }
61  
62      public TransportState getCurrentTransportState() {
63          return currentTransportState;
64      }
65  
66      public TransportStatus getCurrentTransportStatus() {
67          return currentTransportStatus;
68      }
69  
70      public String getCurrentSpeed() {
71          return currentSpeed;
72      }
73  }