亚洲欧美第一页_禁久久精品乱码_粉嫩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精品| 精品美女一区二区三区| 国产成人免费视频网站| 九九热在线视频观看这里只有精品| 亚洲午夜电影在线| 亚洲一区精品在线| 亚洲高清三级视频| 麻豆精品一区二区av白丝在线| 午夜精品aaa| 蜜桃免费网站一区二区三区| 免费在线观看视频一区| 极品瑜伽女神91| 国产精品自在在线| www.日韩精品| 色婷婷国产精品综合在线观看| 在线看不卡av| 欧美一卡二卡三卡| 国产日韩亚洲欧美综合| 中文字幕不卡在线播放| 中文字幕字幕中文在线中不卡视频| 国产精品高潮呻吟久久| 亚洲精品va在线观看| 夜夜精品浪潮av一区二区三区| 亚洲午夜在线观看视频在线| 美女国产一区二区| 成人性生交大合| 91美女精品福利| 欧美一二三四区在线| 久久综合狠狠综合久久激情 | 成人精品视频.| 99re热视频这里只精品| 欧美色图免费看| xvideos.蜜桃一区二区| 中文字幕av一区二区三区| 一区二区三区不卡视频在线观看 | 日韩欧美一区二区不卡| 久久久综合网站| 国产精品第13页| 久久精品免费观看| 91社区在线播放| 精品久久久久久无| 亚洲一区日韩精品中文字幕| 国产露脸91国语对白| 欧美亚洲综合久久| 久久久午夜精品| 日韩精品一级中文字幕精品视频免费观看| 国产在线精品视频| 欧美人与禽zozo性伦| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲第一在线综合网站| 国产.欧美.日韩| 日韩一区二区三区视频在线观看| 亚洲人午夜精品天堂一二香蕉| 久久91精品久久久久久秒播| 欧美三区免费完整视频在线观看| 久久精品亚洲一区二区三区浴池 | 国产精品久久毛片a| 日韩国产精品久久| 欧美亚洲丝袜传媒另类| 国产精品乱子久久久久| 国产毛片精品国产一区二区三区| 欧美日韩国产综合一区二区| 亚洲精品一二三| 成人午夜电影小说| 欧美不卡在线视频| 奇米精品一区二区三区在线观看一| 色综合久久久久综合| 国产精品妹子av| 国产1区2区3区精品美女| 久久久亚洲高清| 国产资源在线一区| 日韩三级视频在线观看| 免费观看成人av| 日韩一区二区三区精品视频| 亚洲福利一二三区| 欧美色中文字幕| 亚洲狠狠丁香婷婷综合久久久| 99精品一区二区| 中文字幕欧美一| 99精品欧美一区| 亚洲精品欧美综合四区| 一本大道久久a久久综合婷婷| 国产精品久久久久三级| 99riav一区二区三区| 18成人在线观看| 色婷婷精品久久二区二区蜜臀av | 亚洲成人午夜电影| 欧美日韩五月天| 天天综合日日夜夜精品| 日韩你懂的在线播放| 国内外成人在线| 亚洲国产精品v| 在线一区二区三区做爰视频网站| 亚洲va中文字幕| 欧美xxxxxxxx| www.亚洲精品| 天堂久久久久va久久久久| 欧美精品一区二区在线播放| 成人在线一区二区三区| 亚洲自拍偷拍欧美| 日韩精品一区二区三区视频播放| 国产成人免费av在线| 亚洲精品成人a在线观看| 3atv一区二区三区| 国产91丝袜在线播放0| 亚洲午夜影视影院在线观看| 欧美v亚洲v综合ⅴ国产v| 成人h版在线观看| 日韩国产欧美在线播放| 国产农村妇女精品| 欧美丰满一区二区免费视频| 国产成人免费av在线| 香蕉av福利精品导航| 久久久久久综合| 欧美日韩亚洲综合| 成人在线综合网| 毛片一区二区三区| 亚洲人精品一区| 久久综合久久综合亚洲| 色999日韩国产欧美一区二区| 国产综合久久久久影院| 亚洲一二三专区| 欧美国产日韩精品免费观看| 在线播放/欧美激情| www.99精品| 国产精品原创巨作av| 日韩中文字幕av电影| 日韩理论片中文av| 久久在线免费观看| 欧美日韩国产三级| 色婷婷精品大在线视频| 国产激情偷乱视频一区二区三区| 亚洲第一成人在线| 中文字幕在线播放不卡一区| www日韩大片| 日韩欧美国产三级电影视频| 欧美日韩三级一区二区| 99久久伊人久久99| 成人美女视频在线观看18| 麻豆精品在线视频| 免费人成在线不卡| 日本成人在线视频网站| 亚洲综合色在线| 亚洲精品国产精华液| 国产精品白丝在线| 国产精品麻豆99久久久久久| 久久精品一区二区三区av| 精品国产一区二区三区久久影院 | 国产亚洲综合av| 精品欧美一区二区在线观看| 日韩视频一区二区三区在线播放 | 亚洲色大成网站www久久九九| 国产精品青草综合久久久久99| 久久亚洲欧美国产精品乐播| 日韩欧美国产综合在线一区二区三区| 欧美美女视频在线观看| 欧美日韩国产首页在线观看| 欧美日韩大陆在线| 欧美精品乱码久久久久久按摩| 欧美中文字幕亚洲一区二区va在线| 色综合视频在线观看| 欧美性猛交一区二区三区精品| 色综合久久综合中文综合网| 日本久久电影网| 欧美日韩日本视频| 日韩一区和二区| 久久亚洲精品小早川怜子| 久久精品视频一区二区三区| 日本一区二区三级电影在线观看| 亚洲妇女屁股眼交7| 丝袜美腿亚洲色图| 久久成人免费网| 国产精品 日产精品 欧美精品| 成年人网站91| 欧美三区在线视频| 2023国产一二三区日本精品2022| 国产视频一区不卡| 亚洲精品乱码久久久久久久久 | 欧美放荡的少妇| 日韩一区二区三区在线视频| 久久久久久久综合日本| 国产精品国产三级国产aⅴ原创| 亚洲美女屁股眼交| 人人超碰91尤物精品国产| 国产精品一级片在线观看| 一本大道久久a久久精二百| 日韩亚洲电影在线| 综合分类小说区另类春色亚洲小说欧美| 亚洲一区二区五区| 老司机精品视频线观看86 | 午夜在线成人av| 国产精品自拍av| 欧美日韩三级视频| 国产午夜精品久久久久久免费视 | 久久99这里只有精品| 成人av高清在线| 日韩欧美成人一区二区| 一区二区三区久久久| 久久99九九99精品| 在线观看一区日韩|