1 package net.sf.atmodem4j.spsw;
2
3 /*
4 * #%L
5 * SPSW Java
6 * %%
7 * Copyright (C) 2009 - 2014 atmodem4j
8 * %%
9 * atmodem4j - A serial port socket wrapper- http://atmodem4j.sourceforge.net/
10 * Copyright (C) 2009-2014, atmodem4j.sf.net, and individual contributors as indicated
11 * by the @authors tag. See the copyright.txt in the distribution for a
12 * full listing of individual contributors.
13 *
14 * This is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 3 of
17 * the License, or (at your option) any later version.
18 *
19 * This software is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this software; if not, write to the Free
26 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
28 * #L%
29 */
30
31 /**
32 *
33 * @author aploese
34 */
35 public enum DataBits {
36
37 DB_5(5),
38 DB_6(6),
39 DB_7(7),
40 DB_8(8);
41
42 static DataBits fromNative(int nativeValue) {
43 switch (nativeValue) {
44 case 5:
45 return DB_5;
46 case 6:
47 return DB_6;
48 case 7:
49 return DB_7;
50 case 8:
51 return DB_8;
52 default:
53 throw new RuntimeException("Cant handle native value: " + nativeValue);
54
55 }
56 }
57 public final int value;
58
59 private DataBits(int dataBits) {
60 this.value = dataBits;
61 }
62
63 }