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.avtransport;
17  
18  /**
19   *
20   */
21  public enum AVTransportErrorCode {
22  
23      TRANSITION_NOT_AVAILABLE(701, "The immediate transition from current to desired state not supported"),
24      NO_CONTENTS(702, "The media does not contain any contents that can be played"),
25      READ_ERROR(703, "The media cannot be read"),
26      PLAYBACK_FORMAT_NOT_SUPPORTED(704, "The storage format of the currently loaded media is not supported for playback"),
27      TRANSPORT_LOCKED(705, "The transport is 'hold locked', e.g. with a keyboard lock"),
28      WRITE_ERROR(706, "The media cannot be written"),
29      MEDIA_PROTECTED(707, "The media is write-protected or is of a not writable type"),
30      RECORD_FORMAT_NOT_SUPPORTED(708, "The storage format of the currently loaded media is not supported for recording"),
31      MEDIA_FULL(709, "There is no free space left on the loaded media"),
32      SEEKMODE_NOT_SUPPORTED(710, "The specified seek mode is not supported by the device"),
33      ILLEGAL_SEEK_TARGET(711, "The specified seek target is not specified in terms of the seek mode, or is not present on the media"),
34      PLAYMODE_NOT_SUPPORTED(712, "The specified play mode is not supported by the device"),
35      RECORDQUALITYMODE_NOT_SUPPORTED(713, "The specified record quality mode is not supported by the device"),
36      ILLEGAL_MIME_TYPE(714, "The specified resource has a MIME-type which is not supported"),
37      CONTENT_BUSY(715, "The resource is already being played by other means"),
38      RESOURCE_NOT_FOUND(716, "The specified resource cannot be found in the network"),
39      INVALID_INSTANCE_ID(718, "The specified instanceID is invalid for this AVTransport");
40  
41      private int code;
42      private String description;
43  
44      AVTransportErrorCode(int code, String description) {
45          this.code = code;
46          this.description = description;
47      }
48  
49      public int getCode() {
50          return code;
51      }
52  
53      public String getDescription() {
54          return description;
55      }
56  
57      public static AVTransportErrorCode getByCode(int code) {
58          for (AVTransportErrorCode errorCode : values()) {
59              if (errorCode.getCode() == code)
60                  return errorCode;
61          }
62          return null;
63      }
64  
65  }