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  package org.fourthline.cling.support.model.dlna;
16  
17  /**
18   * DLNA.ORG_OP: operations parameter (string)
19   *
20   * <pre>
21   *     "00" (or "0") neither time seek range nor range supported
22   *     "01" range supported
23   *     "10" time seek range supported
24   *     "11" both time seek range and range supported
25   * </pre>
26   *
27   * @author Mario Franco
28   */
29  public enum DLNAOperations {
30  
31      NONE(0x00),
32      RANGE(0x01),
33      TIMESEEK(0x10);
34  
35      private int code;
36  
37      DLNAOperations(int code) {
38          this.code = code;
39      }
40  
41      public int getCode() {
42          return code;
43      }
44  
45      public static DLNAOperations valueOf(int code) {
46          for (DLNAOperations errorCode : values()) {
47              if (errorCode.getCode() == code) {
48                  return errorCode;
49              }
50          }
51          return null;
52      }
53  }