亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cservice.java

?? Sending and receiving of SMS using Java
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
// SMSLib for Java
// An open-source API Library for sending and receiving SMS via a GSM modem.
// Copyright (C) 2002-2007, Thanasis Delenikas, Athens/GREECE
// Web Site: http://www.smslib.org
//
// SMSLib is distributed under the LGPL license.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

package org.smslib;

import java.io.*;
import java.util.*;
import org.apache.log4j.*;
import org.apache.log4j.xml.*;

/**
 * This is the main SMSLib service class.
 */
public class CService
{
	/**
	 * Dummy synchronization object.
	 */
	private Object _SYNC_ = null;

	/**
	 * Product name.
	 */
	public static final String _name = "SMSLib for Java";

	/**
	 * Product version.
	 */
	public static final String _version = "v2.1.4";

	/**
	 * Holds values representing the modem protocol used.
	 */
	public static class Protocol
	{
		/**
		 * PDU protocol.
		 */
		public static final int PDU = 0;

		/**
		 * TEXT protocol.
		 */
		public static final int TEXT = 1;
	}

	/**
	 * Holds values representing receive mode.
	 * 
	 * @see CService#setReceiveMode(int)
	 * @see CService#getReceiveMode()
	 */
	public static class ReceiveMode
	{
		/**
		 * Synchronous reading.
		 */
		public static final int Sync = 0;

		/**
		 * Asynchronous reading - CMTI indications.
		 */
		public static final int AsyncCnmi = 1;

		/**
		 * Asynchronous reading - polling.
		 */
		public static final int AsyncPoll = 2;
	}

	private static final String LOG_CONF = "smslib-log.conf";

	private static final String LOG_CONF_XML = LOG_CONF + ".xml";

	private static final int DISCONNECT_TIMEOUT = 10 * 1000;

	private int keepAliveInterval = 30 * 1000;

	private int asyncPollInterval = 10 * 1000;

	private int asyncRecvClass = CIncomingMessage.MessageClass.All;

	private int retriesNoResponse = 5;

	private int delayNoResponse = 5000;

	private int retriesCmsErrors = 5;

	private int delayCmsErrors = 5000;

	private Logger log;

	private static final String VALUE_NOT_REPORTED = "* N/A *";

	private String smscNumber;

	private String simPin, simPin2;

	private int receiveMode;

	private int protocol;

	private AbstractATHandler atHandler;

	private CNewMsgMonitor newMsgMonitor;

	private CSerialDriver serialDriver;

	private volatile boolean connected;

	private CDeviceInfo deviceInfo;

	private CKeepAliveThread keepAliveThread;

	private CReceiveThread receiveThread;

	private ISmsMessageListener messageHandler;

	private ICallListener callHandler;

	private int outMpRefNo;

	private LinkedList mpMsgList;

	/**
	 * CService constructor.
	 * 
	 * @param port
	 *            The comm port to use (i.e. COM1, /dev/ttyS1 etc).
	 * @param baud
	 *            The baud rate. 57600 is a good number to start with.
	 * @param gsmDeviceManufacturer
	 *            The manufacturer of the modem (i.e. Wavecom, Nokia, Siemens, etc).
	 * @param gsmDeviceModel
	 *            The model (i.e. M1306B, 6310i, etc).
	 */
	public CService(String port, int baud, String gsmDeviceManufacturer, String gsmDeviceModel)
	{
		if (_SYNC_ == null) _SYNC_ = new Object();

		log = Logger.getLogger("org.smslib");
		if (new File(LOG_CONF).exists()) PropertyConfigurator.configure(LOG_CONF);
		else if (new File(LOG_CONF_XML).exists()) DOMConfigurator.configure(LOG_CONF_XML);
		else
		{
			BasicConfigurator.configure();
			log.setLevel(Level.WARN);
			if (System.getProperty("smslib.debug") != null) log.setLevel(Level.ALL);
		}

		smscNumber = "";
		simPin = null;
		simPin2 = null;

		connected = false;
		serialDriver = new CSerialDriver(port, baud, this);
		deviceInfo = new CDeviceInfo();
		newMsgMonitor = new CNewMsgMonitor();

		log.info(_name + " / " + _version);
		log.info("Using port: " + port + " @ " + baud + " baud.");
		log.info("JRE Version: " + System.getProperty("java.version"));
		log.info("JRE Impl Version: " + System.getProperty("java.vm.version"));
		log.info("O/S: " + System.getProperty("os.name") + " / " + System.getProperty("os.arch") + " / " + System.getProperty("os.version"));

		try
		{
			atHandler = AbstractATHandler.load(serialDriver, log, this, gsmDeviceManufacturer, gsmDeviceModel);
			log.info("Using " + atHandler.getDescription() + " AT handler.");
		}
		catch (Exception ex)
		{
			log.fatal("CANNOT INITIALIZE HANDLER (" + ex.getMessage() + ")");
		}

		protocol = Protocol.PDU;

		messageHandler = null;
		callHandler = null;

		receiveMode = ReceiveMode.Sync;
		receiveThread = null;

		outMpRefNo = new Random().nextInt();
		if (outMpRefNo < 0) outMpRefNo *= -1;
		outMpRefNo %= 65536;

		mpMsgList = new LinkedList();
	}

	/**
	 * Return the status of the connection.
	 * <p>
	 * <strong>Warning</strong>: The method return the "theoretical" status of the connection, without testing the actual connection at the time of the call.
	 * 
	 * @return True if the GSM device is connected.
	 * @see CService#connect()
	 * @see CService#disconnect()
	 */
	public boolean getConnected()
	{
		return connected;
	}

	/**
	 * Returns the DeviceInfo class.
	 * 
	 * @see CDeviceInfo
	 */
	public CDeviceInfo getDeviceInfo()
	{
		return deviceInfo;
	}

	/**
	 * Sets the SMSC number. Needed in rare cases - normally, you should <strong>not</strong> set the SMSC number yourself and let the GSM device get it from its SIM.
	 * 
	 * @param smscNumber
	 *            The SMSC number (international format).
	 * @see CService#getSmscNumber()
	 */
	public void setSmscNumber(String smscNumber)
	{
		this.smscNumber = smscNumber;
	}

	/**
	 * Returns the SMSC number previously set with setSmscNumber() call.
	 * 
	 * @return The SMSC number.
	 * @see CService#setSmscNumber(String)
	 */
	public String getSmscNumber()
	{
		return smscNumber;
	}

	/**
	 * Sets the SIM PIN.
	 * 
	 * @param simPin
	 *            The SIM pin code.
	 * @see CService#getSimPin()
	 */
	public void setSimPin(String simPin)
	{
		this.simPin = simPin;
	}

	/**
	 * Sets the SIM Pin 2. Some GSM modems may require this to unlock full functionality.
	 * 
	 * @param simPin
	 *            The SIM PIN #2 code.
	 * @see CService#getSimPin2()
	 */
	public void setSimPin2(String simPin)
	{
		this.simPin2 = simPin;
	}

	/**
	 * Returns the SIM PIN previously set with setSimPin().
	 * 
	 * @return The SIM PIN code.
	 * @see CService#setSimPin(String)
	 */
	public String getSimPin()
	{
		return simPin;
	}

	/**
	 * Returns the SIM PIN #2 previously set with setSimPin2().
	 * 
	 * @return The SIM PIN #2 code.
	 * @see CService#setSimPin2(String)
	 */
	public String getSimPin2()
	{
		return simPin2;
	}

	/**
	 * Sets the message handler for ASYNC mode. The handler is called automatically from SMSLib when a message is received. This handler is valid only for Asynchronous operation mode - in other modes, it is not used.
	 * 
	 * @param messageHandler
	 *            The message handler routine - must comply with ISmsMessageListener interface.
	 * @see CService#getMessageHandler()
	 */
	public void setMessageHandler(ISmsMessageListener messageHandler)
	{
		this.messageHandler = messageHandler;
	}

	/**
	 * Returns the message handler (if any).
	 * 
	 * @return The message handler.
	 * @see CService#setMessageHandler(ISmsMessageListener)
	 */
	public ISmsMessageListener getMessageHandler()
	{
		return messageHandler;
	}

	/**
	 * Sets the call handler. Works in ALL modes. The handler is called automatically once SMSLib receives an incoming call.
	 * 
	 * @param callHandler
	 *            The call handler routine - must comply with ICallListener interface.
	 * @see CService#getCallHandler()
	 */
	public void setCallHandler(ICallListener callHandler)
	{
		this.callHandler = callHandler;
	}

	/**
	 * Returns the call handler (if any).
	 * 
	 * @return The call handler.
	 * @see CService#setCallHandler(ICallListener)
	 */
	public ICallListener getCallHandler()
	{
		return callHandler;
	}

	/**
	 * Sets the Async Poll Interval (in seconds) - is every how many seconds will SMSLib poll the GSM modem for new messages.
	 * 
	 * @param secs
	 *            The interval in seconds.
	 * @see CService#getAsyncPollInterval()
	 * @see CService#setAsyncRecvClass(int)
	 * @see CService#getAsyncRecvClass()
	 */
	public void setAsyncPollInterval(int secs)
	{
		this.asyncPollInterval = secs * 1000;
	}

	/**
	 * Returns the Async Poll Interval, in seconds.
	 * 
	 * @return The Poll Interval in seconds.
	 * @see CService#setAsyncPollInterval(int)
	 * @see CService#setAsyncRecvClass(int)
	 * @see CService#getAsyncRecvClass()
	 */
	public int getAsyncPollInterval()
	{
		return (asyncPollInterval / 1000);
	}

	public void setAsyncRecvClass(int msgClass)
	{
		asyncRecvClass = msgClass;
	}

	public int getAsyncRecvClass()
	{
		return asyncRecvClass;
	}

	/**
	 * Sets the Keep-Alive Interval - every how many seconds the Keep-Alive thread will run and send a dummy OK command to the GSM modem. This is used to keep the serial port alive and prevent it from timing out. The interval is, by default, set to 30 seconds which should be enough for all modems.
	 * 
	 * @param secs
	 *            The Keep-Alive Interval in seconds.
	 * @see CService#getKeepAliveInterval()
	 */
	public void setKeepAliveInterval(int secs)
	{
		this.keepAliveInterval = secs * 1000;
	}

	/**
	 * Returns the Keep-Alive Interval, in seconds.
	 * 
	 * @return The Keep-Alive Interval in seconds.
	 * @see CService#setKeepAliveInterval(int)
	 */
	public int getKeepAliveInterval()
	{
		return keepAliveInterval / 1000;
	}

	/**
	 * Sets the number of retries that SMSLib performs during dispatch of a message, if it fails to get a response from the modem within the timeout period.
	 * <p>
	 * After the number of retries complete and the message is not sent, SMSLib treats it as undeliverable.
	 * <p>
	 * The default values should be ok in most cases.
	 * 
	 * @param retries
	 *            The number of retries.
	 * @see CService#getRetriesNoResponse()
	 * @see CService#setDelayNoResponse(int)
	 * @see CService#getDelayNoResponse()
	 */
	public void setRetriesNoResponse(int retries)
	{
		this.retriesNoResponse = retries;
	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜精品一区二区三区嫩草 | 国内精品国产成人| 亚洲男人电影天堂| 国产女主播一区| 久久久99久久| 国产欧美一区二区精品久导航 | 久久综合狠狠综合久久激情| 欧美精品日韩一本| 欧美三级视频在线| 欧美一区二区在线播放| 91精品欧美福利在线观看| 欧美性色综合网| 日本乱人伦aⅴ精品| 91成人在线精品| 欧美日韩国产成人在线免费| 7777精品伊人久久久大香线蕉经典版下载 | 国产午夜一区二区三区| 国产蜜臀av在线一区二区三区| 欧美国产欧美综合| 亚洲视频在线一区观看| 一区二区三区美女视频| 日韩精品亚洲专区| 国产又黄又大久久| 91免费视频网| 欧美精品乱人伦久久久久久| 日韩精品一区二区三区视频播放| 精品国产免费一区二区三区香蕉| 欧美激情一区二区三区| 亚洲三级免费观看| 日韩有码一区二区三区| 国产一区在线不卡| 91麻豆国产自产在线观看| 欧美日韩精品一区二区三区四区| 欧美不卡视频一区| 国产精品久久久久久久久图文区| 亚洲自拍偷拍av| 狠狠狠色丁香婷婷综合激情 | 日韩不卡一区二区| 国模娜娜一区二区三区| 91丨porny丨蝌蚪视频| 欧美精品vⅰdeose4hd| 久久亚洲精华国产精华液 | 美女尤物国产一区| a亚洲天堂av| 日韩免费看的电影| 亚洲精品日韩一| 国产一区在线观看视频| 欧美日韩一卡二卡三卡| 久久久久久久久99精品| 亚洲成a天堂v人片| 成人av资源在线| 91精品国产手机| 一区二区三区高清| 国产成人在线视频网址| 欧洲色大大久久| 国产清纯白嫩初高生在线观看91| 午夜久久久久久电影| 91在线播放网址| 2017欧美狠狠色| 日韩av中文在线观看| 在线观看视频一区二区欧美日韩| 国产婷婷一区二区| 美女精品一区二区| 欧美日韩精品一区二区| 一区二区三区国产| 色综合天天综合网国产成人综合天| www成人在线观看| 视频一区免费在线观看| 欧美少妇xxx| 夜夜夜精品看看| 色94色欧美sute亚洲线路一久| 久久久久久黄色| 国产一区二区在线看| 精品国产乱码久久久久久久久| 视频在线在亚洲| 欧美美女bb生活片| 五月激情综合婷婷| 在线免费观看日韩欧美| 亚洲欧美日韩国产手机在线| 99久久久精品免费观看国产蜜| 久久精品夜夜夜夜久久| 国产aⅴ综合色| 国产精品嫩草久久久久| 成人爱爱电影网址| 国产午夜精品久久久久久免费视| 国产风韵犹存在线视精品| 久久久噜噜噜久久中文字幕色伊伊| 蜜臀av一区二区| 精品日韩在线观看| 国产一区视频网站| 日韩一区在线播放| 91久久久免费一区二区| 亚洲国产欧美日韩另类综合 | 丁香婷婷深情五月亚洲| 国产欧美日韩亚州综合 | 欧美人动与zoxxxx乱| 视频一区在线播放| 精品国产电影一区二区| 成人av影院在线| 亚洲最新在线观看| 欧美一级专区免费大片| 国产精品自拍av| 亚洲青青青在线视频| 欧美一区二区三区日韩| 国产成人激情av| 亚洲国产一区二区在线播放| 日韩区在线观看| 不卡免费追剧大全电视剧网站| 亚洲人成人一区二区在线观看 | 日本色综合中文字幕| 国产色爱av资源综合区| 在线视频一区二区三| 久久国产婷婷国产香蕉| 国产精品久久久久永久免费观看 | 三级久久三级久久久| www国产成人免费观看视频 深夜成人网| 国产欧美日韩在线视频| 欧美日韩一区成人| 成人国产视频在线观看| 免费高清视频精品| 最近日韩中文字幕| 欧美videossexotv100| 91首页免费视频| 国产酒店精品激情| 五月综合激情日本mⅴ| 国产精品久久久久久久岛一牛影视 | 欧美视频一区二| 成人免费毛片嘿嘿连载视频| 日韩在线一区二区三区| 亚洲婷婷国产精品电影人久久| 日韩久久精品一区| 欧美日韩国产色站一区二区三区| 成人午夜激情片| 韩国一区二区视频| 美腿丝袜在线亚洲一区| 亚洲一区二区三区四区五区黄 | 亚洲美女屁股眼交3| 国产欧美一区二区精品久导航| 欧美精品视频www在线观看| 日本韩国欧美国产| 国产精品资源站在线| 精品一区二区久久久| 三级欧美在线一区| 亚欧色一区w666天堂| 亚洲精品视频在线看| 国产精品精品国产色婷婷| 国产亚洲一二三区| 久久免费美女视频| 精品国产自在久精品国产| 日韩视频不卡中文| 欧美福利视频一区| 在线播放中文字幕一区| 在线成人av网站| 欧美精品三级在线观看| 91精品国产免费| 91精品欧美久久久久久动漫| 91精品国产高清一区二区三区| 欧美色网站导航| 欧美丰满一区二区免费视频| 91麻豆精品久久久久蜜臀| 欧美一区二区在线视频| 欧美一区二区三区小说| 日韩一级黄色大片| 精品久久国产字幕高潮| 亚洲精品一区二区三区福利| 久久综合久久鬼色中文字| 久久久99精品久久| 亚洲欧洲日韩一区二区三区| 亚洲男人天堂av| 午夜欧美视频在线观看 | 精品久久人人做人人爱| 久久婷婷久久一区二区三区| 中文字幕欧美国产| 亚洲免费观看高清完整| 首页国产欧美日韩丝袜| 狠狠色综合色综合网络| av一区二区三区| 欧美日韩国产经典色站一区二区三区 | 成熟亚洲日本毛茸茸凸凹| 91欧美一区二区| 在线综合视频播放| 国产日产欧美精品一区二区三区| 国产精品乱码人人做人人爱| 一级日本不卡的影视| 青椒成人免费视频| 成人黄页毛片网站| 欧美日韩五月天| 中文字幕av资源一区| 亚洲午夜久久久久中文字幕久| 国内外成人在线视频| 91欧美激情一区二区三区成人| 日韩一卡二卡三卡国产欧美| 国产精品久久久久久久久免费相片 | 国产欧美精品一区二区色综合| 亚洲精品国产第一综合99久久| 蜜桃精品视频在线| 99v久久综合狠狠综合久久| 91麻豆精品国产自产在线观看一区| 欧美激情资源网| 久久精品国产网站|