// Path: gsm-modem-client-api/src/main/java/fr/romainmoreau/gsmmodem/client/api/GsmModemException.java
// public class GsmModemException extends Exception {
// 	private static final long serialVersionUID = 1L;
// 
// 	public GsmModemException() {
// 		super();
// 	}
// 
// 	public GsmModemException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// 	public GsmModemException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public GsmModemException(String message) {
// 		super(message);
// 	}
// 
// 	public GsmModemException(Throwable cause) {
// 		super(cause);
// 	}
// }
// 
// Path: gsm-modem-client-api/src/main/java/fr/romainmoreau/gsmmodem/client/api/GsmModemResponseException.java
// public class GsmModemResponseException extends GsmModemException {
// 	private static final long serialVersionUID = 1L;
// 
// 	public GsmModemResponseException(String message) {
// 		super(message);
// 	}
// 
// 	public GsmModemResponseException(String message, Exception cause) {
// 		super(message, cause);
// 	}
// }
// 
// Path: gsm-modem-client-common/src/main/java/fr/romainmoreau/gsmmodem/client/common/AbstractGsmModemClient.java
// public abstract class AbstractGsmModemClient implements GsmModemClient {
// }


import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import fr.romainmoreau.gsmmodem.client.api.GsmModemException;
import fr.romainmoreau.gsmmodem.client.api.GsmModemResponseException;
import fr.romainmoreau.gsmmodem.client.common.AbstractGsmModemClient;
package fr.romainmoreau.gsmmodem.client.common.uart;



public abstract class AbstractUARTGsmModemClient extends AbstractGsmModemClient {
	protected static final byte LF = '\n';
	protected static final char CR = '\r';
	protected static final String SUB = "\u001a";
	protected static final char SPACE = ' ';
	protected static final byte K = 'K';
	protected static final String OK = "OK";
	protected static final String ERROR = "ERROR";
	protected static final String PLUS_CMS_ERROR_COLON = "+CMS ERROR:";
	protected static final String AT_PLUS = "AT+";
	protected static final String PLUS = "+";
	protected static final String PROMPT = "> ";
	protected static final String PLUS_CMT_COLON = "+CMT: ";
	protected static final String DOUBLE_QUOTE = "\"";
	protected static final String PLUS_CMGS_COLON = "+CMGS: ";

	private final long timeout;

	private final ByteArrayOutputStream byteArrayOutputStream;

	private final BlockingQueue<GsmEvent> gsmEventBlockingQueue;

	private String receivedSmsFirstLine;

	private GsmEventListener gsmEventListener;

	private ReadByteListener readByteListener;

	private ReadLineListener readLineListener;

	public AbstractUARTGsmModemClient(long timeout) {
		this.timeout = timeout;
		this.byteArrayOutputStream = new ByteArrayOutputStream();
		this.gsmEventBlockingQueue = new LinkedBlockingDeque<>();
	}

	@Override
// Path: gsm-modem-client-api/src/main/java/fr/romainmoreau/gsmmodem/client/api/GsmModemException.java
// public class GsmModemException extends Exception {
// 	private static final long serialVersionUID = 1L;
// 
// 	public GsmModemException() {
// 		super();
// 	}
// 
// 	public GsmModemException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// 	public GsmModemException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// 	public GsmModemException(String message) {
// 		super(message);
// 	}
// 
// 	public GsmModemException(Throwable cause) {
// 		super(cause);
// 	}
// }
// 
// Path: gsm-modem-client-api/src/main/java/fr/romainmoreau/gsmmodem/client/api/GsmModemResponseException.java
// public class GsmModemResponseException extends GsmModemException {
// 	private static final long serialVersionUID = 1L;
// 
// 	public GsmModemResponseException(String message) {
// 		super(message);
// 	}
// 
// 	public GsmModemResponseException(String message, Exception cause) {
// 		super(message, cause);
// 	}
// }
// 
// Path: gsm-modem-client-common/src/main/java/fr/romainmoreau/gsmmodem/client/common/AbstractGsmModemClient.java
// public abstract class AbstractGsmModemClient implements GsmModemClient {
// }


// Path: gsm-modem-client-common-uart/src/main/java/fr/romainmoreau/gsmmodem/client/common/uart/AbstractUARTGsmModemClient.java
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import fr.romainmoreau.gsmmodem.client.api.GsmModemException;
import fr.romainmoreau.gsmmodem.client.api.GsmModemResponseException;
import fr.romainmoreau.gsmmodem.client.common.AbstractGsmModemClient;

package fr.romainmoreau.gsmmodem.client.common.uart;



public abstract class AbstractUARTGsmModemClient extends AbstractGsmModemClient {
	protected static final byte LF = '\n';
	protected static final char CR = '\r';
	protected static final String SUB = "\u001a";
	protected static final char SPACE = ' ';
	protected static final byte K = 'K';
	protected static final String OK = "OK";
	protected static final String ERROR = "ERROR";
	protected static final String PLUS_CMS_ERROR_COLON = "+CMS ERROR:";
	protected static final String AT_PLUS = "AT+";
	protected static final String PLUS = "+";
	protected static final String PROMPT = "> ";
	protected static final String PLUS_CMT_COLON = "+CMT: ";
	protected static final String DOUBLE_QUOTE = "\"";
	protected static final String PLUS_CMGS_COLON = "+CMGS: ";

	private final long timeout;

	private final ByteArrayOutputStream byteArrayOutputStream;

	private final BlockingQueue<GsmEvent> gsmEventBlockingQueue;

	private String receivedSmsFirstLine;

	private GsmEventListener gsmEventListener;

	private ReadByteListener readByteListener;

	private ReadLineListener readLineListener;

	public AbstractUARTGsmModemClient(long timeout) {
		this.timeout = timeout;
		this.byteArrayOutputStream = new ByteArrayOutputStream();
		this.gsmEventBlockingQueue = new LinkedBlockingDeque<>();
	}

	@Override
	public synchronized void setSMSTextMode() throws IOException, GsmModemException {