View Javadoc
1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package net.sf.atmodem4j.core.parser;
7   
8   /*
9    * #%L
10   * ATModem4J Core
11   * %%
12   * Copyright (C) 2009 - 2014 atmodem4j
13   * %%
14   * atmodem4j - Drivers for the AT modem - http://atmodem4j.sourceforge.net/
15   * Copyright (C) 2009-2014, atmodem4j.sf.net, and individual contributors as indicated
16   * by the @authors tag. See the copyright.txt in the distribution for a
17   * full listing of individual contributors.
18   * 
19   * This is free software; you can redistribute it and/or modify it
20   * under the terms of the GNU General Public License as
21   * published by the Free Software Foundation; either version 3 of
22   * the License, or (at your option) any later version.
23   * 
24   * This software is distributed in the hope that it will be useful,
25   * but WITHOUT ANY WARRANTY; without even the implied warranty of
26   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27   * Lesser General Public License for more details.
28   * 
29   * You should have received a copy of the GNU Lesser General Public
30   * License along with this software; if not, write to the Free
31   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
32   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
33   * #L%
34   */
35  
36  /**
37   *
38   * @author aploese
39   */
40  public class ResultCodeToken {
41      static final String BUSY = "BUSY";
42      static final String OK = "OK";
43      static final String CONNECT = "CONNECT";
44      static final String NO_ANSWER = "NO ANSWER";
45      static final String NO_DIALTONE = "NO DIALTONE";
46      static final String NO_CARRIER = "NO CARRIER";
47      static final String ERROR = "ERROR";
48      static final String RING = "RING";
49  
50      private final String resultCode;
51      private final String[] data;
52      private final String echo;
53  
54      public ResultCodeToken(String resultCode, String[] data, String echo) {
55           this.resultCode = resultCode;
56           this.data = data;
57           this.echo = echo;
58      }
59  
60      public String[] getData() {
61          return data;
62      }
63  
64      public boolean isConnect() {
65          return CONNECT.equals(resultCode);
66      }
67  
68      public boolean isOk() {
69          return OK.equals(resultCode);
70      }
71  
72      /**
73       * @return the resultCode
74       */
75      public String getResultCode() {
76          return resultCode;
77      }
78  
79      /**
80       * @return the echo
81       */
82      public String getEcho() {
83          return echo;
84      }
85  
86  
87  }