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

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

?? smsservice.java

?? 一個SMS 的短信平臺的原代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
package edu.soft.buaa.message.sms;

import java.io.*;
import java.util.*;

import java.text.*;

public class SMSService {
	/**
		Internal Software Name.
	*/
	public static final String _name = "短信系統 API";
	/**
		Version.
	*/
	public static final String _version = "0.1";
	/**
		Release Date.
	*/
	public static final String _reldate = "2005.8.4";

	

	/**
		This error value is returned when the operation was succesfull.
	*/
	public static final int ERR_OK = 0;

	/**
		This is a generic error, which is not classified yet. More error classifications may
		be introduced at a later stage.
	*/
	public static final int ERR_GENERIC_ERROR = -1;

	/**
		This error value is returned when the service is not initialized yet. You should call method
		initialize().
	*/
	public static final int ERR_NOT_INITIALIZED = -10;

	/**
		This error value is returned when the service is not connected to the GSM device.
		You should call method connect().
	*/
	public static final int ERR_NOT_CONNECTED = -11;

	/**
		This error value is returned when the GSM device does not support ASCII or
		PDU mode. This is a fatal error, in the sense that jSMSEngine can work only
		with GSM devices supporting ASCII or PDU Mode.
	*/
	public static final int ERR_COMM_NOT_SUPPORTED = -20;

	/**
		This error value is returned when the GSM device does not support HEX mode.
		This is a fatal error, in the sense that jSMSEngine can work only with GSM
		devices supporting HEX Mode when in ASCII mode. In order to get around this
		error, switch to PDU mode.
	*/
	public static final int ERR_CHARSET_HEX_NOT_SUPPORTED = -21;

	/**
		This error value is returned when the GSM device does not support the 
		AT+CNMI command for disabling indications to TE.
	*/
	public static final int ERR_CANNOT_DISABLE_INDICATIONS = -22;

	/**
		This error value is returned when the specific message was not found.
		Double-check your message and/or memory index used.
	*/
	public static final int ERR_MESSAGE_NOT_FOUND = -30;

	/**
		This error value is returned when a send-message operation failed.
		This could be attributed to a number of reasons: Coverage problems,
		invalid recipient phone number, GSM device malfunction.
	*/
	public static final int ERR_SEND_FAILED = -40;

	/**
		This error value is returned when the specified phonebook file did not load.
		Recheck your XML file for errors in its structure.
	*/
	public static final int ERR_PHONEBOOK_NOT_LOADED = -50;

	/**
		This error value is returned when the given directory is invalid.
	*/
	public static final int ERR_INVALID_DIR = -100;

	/**
		This error value on attempting to connect to the GSM device without first
		having defined the cache directories.
	*/
	public static final int ERR_NO_CACHE = -101;

	/**
		This error value is returned when the GSM device asks for a PIN number,
		however the PIN given is invalid. Please check your PIN.
	*/
	public static final int ERR_SIM_PIN_ERROR = -102;

	/**
		This error value is returned when the specified operation is not supported by
		jSMSEngine API.
	*/
	public static final int ERR_NOT_SUPPORTED = -9999;

	/**
		Constant value for ASCII operation mode. 
	*/
	public static final int MODE_ASCII = 1;

	/**
		Constant value for PDU operation mode. 
	*/
	public static final int MODE_PDU = 2;

	/**
		Receive modes: Synchronous and Ascynchronous.
	*/
	public static final int RECEIVE_MODE_SYNC = 1;
	public static final int RECEIVE_MODE_ASYNC = 2;

	/**
		Default value for information that is not reported by the GSM device. 
	*/
	public static final String DEFAULT_VALUE_NOT_REPORTED = "* N/A *";

	public static final int MAX_SMS_LEN_7BIT = 160;
	public static final int MAX_SMS_LEN_8BIT = 140;
	public static final int MAX_SMS_LEN_UNICODE = 70;
	private static final String SMS_SPLIT_SIGNATURE = "?$;";
	private static final int SMS_PARTS = 8;
	private static int smsSplitId = 0;

	private String cacheDir;
	private String smscNumber;
	private String simPin;
	private int operationMode;
	private int supportedModes;
	private int receiveMode;

	private SMSSerialDriver serialDriver;
	private boolean initialized;
	private boolean connected;

	private SMSDeviceInfo deviceInfo;

	/**
		Synchronization object for critical sections of the API.
	*/
	private Object _SYNC_ = new Object();

	/**
		Default constructor of the class.
	
		@param	port	the serial port where the GSM device is connected (e.g. "com1"). 
		@param	baud	the connection speed (i.e. 9600, 19200 etc).
	
		<br><br>
		Notes:
		<ul>
			<li>Use one of the standard values for baud. Most GSM devices work well
					at 9600 or 19200. Some may handle speeds up to 115200 (like Nokia
					mobile phone model 6210 does). The connection speed is not that
					important to the speed at which jSMSEngine processes messages.
					Personally, I work at 9200 to avoid pushing the mobile. Dedicated GSM
					modems may handle higher speeds better than mobile phones do.</li>
		</ul>
	*/
	public SMSService(String port, int baud) {
		setInitialized(false);
		setConnected(false);
		serialDriver = new SMSSerialDriver(port, baud);
		//phoneBook = new PhoneBook();
		deviceInfo = new SMSDeviceInfo();
		receiveMode = RECEIVE_MODE_SYNC;
		//receiveThread = new CReceiveThread();
		//receiveThread.start();
	
	}

	/**
		Returns TRUE if the service has already been initialized.
	
		@return  TRUE if the service has already been initialized.
	*/
	public boolean getInitialized() {
		return initialized;
	}

	/**
		Returns TRUE if the service is connected with the GSM device.
	
		@return  TRUE if the service is connected with the GSM device.
	*/
	public boolean getConnected() {
		return connected;
	}

	/**
		Returns a SMSDeviceInfo object that holds information about the GSM
		device in use.
	
		@return  a SMSDeviceInfo object.
		@see	SMSDeviceInfo
	*/
	public SMSDeviceInfo getDeviceInfo() {
		return deviceInfo;
	}

	/**
		Sets the cache directory for messages.
	
		@param	dir	The directory which will act like a cache.
		@return  One of ERR_* values.
	*/
	public int setCacheDir(String dir) {
		if (dir == null)
			return ERR_INVALID_DIR;
		else {
			File f = new File(dir);
			if (f.exists()) {
				cacheDir = dir;
				return ERR_OK;
			} else
				return ERR_INVALID_DIR;
		}
	}

	/**
		Sets the Short Message Service Center (SMSC) number. Please use international format.
		If you don't want to set the SMSC and use the one defined in your GSM device, use an
		empty string parameter. Another way to do the same, is to pass a null parameter. Some
		phones may prefer one way or the other - please test your phone.
	
		@param	smscNumber	the SMSC number.
	*/
	public void setSmscNumber(String smscNumber) {
		this.smscNumber = smscNumber;
	}

	/**
		Returns the Short Message Service Center (SMSC) number you have previously
		defined with setSmscNumber().
	
		@return  the SMSC number.
	*/
	public String getSmscNumber() {
		return smscNumber;
	}

	/**
		Sets the SIM pin number. This is used if and when the GSM device asks for it. If you set it to
		null, then the API does not give any PIN to the device (in order to avoid locking it up), and
		returns ERR_SIM_PIN_ERROR.
	
		@param	simPin	the SIM pin number.
	*/
	public void setSimPin(String simPin) {
		this.simPin = simPin;
	}

	/**
		Returns the SIM pin number.
	
		@return  the SIM pin number.
	*/
	public String getSimPin() {
		return simPin;
	}

	/**
		Sets the operation mode of the GSM device
	
		@param	mode	the mode of operation (one of values MODE_ASCII, MODE_PDU).
		@return	TRUE if the change of mode succeded.
		@see	SMSService#getOperationMode()
	*/
	public boolean setOperationMode(int mode) {
		boolean result;

		try {
			switch (mode) {
				case MODE_ASCII :
					serialDriver.send(SMSATCommands.AT_ASCII_MODE);
					if (serialDriver
						.getResponse()
						.equalsIgnoreCase(SMSATCommands.AT_OK)) {
						result = true;
						operationMode = MODE_ASCII;
					} else
						result = false;
					break;
				case MODE_PDU :
					serialDriver.send(SMSATCommands.AT_PDU_MODE);
					if (serialDriver
						.getResponse()
						.equalsIgnoreCase(SMSATCommands.AT_OK)) {
						result = true;
						operationMode = MODE_PDU;
					} else
						result = false;
					break;
				case 0 :
					operationMode = 0;
					result = true;
					break;
				default :
					result = false;
			}
		} catch (Exception e) {
			result = false;

		}
		return result;
	}

	/**
		Returns the operation mode of the GSM device, i.e. one of the values
		MODE_ASCII, MODE_PDU.
	
		@return  the operation mode.
		@see	SMSService#setOperationMode(int)
	*/
	public int getOperationMode() {

		return operationMode;

	}

	/**
		Sets the reception mode.
		There are two reception modes, the synchronous and the asynchronous.
		In synchronous mode, you should call readMessages() function on demand,
		where you want to check for new messages. In asynchronous mode, the engine
		automatically calls the received() method (which you <strong>should</strong>
		override) for every received message.
		<br>By default, the reception mode is the synchronous one.
	
		@param	receiveMode	the reception mode (one of values RECEIVE_MODE_ASYNC, RECEIVE_MODE_SYNC).
		@see	SMSService#getReceiveMode()
	*/
	public void setReceiveMode(int receiveMode) {

		this.receiveMode = receiveMode;

	}

	/**
		Returns the reception mode.
	
		@return	the reception mode (one of values RECEIVE_MODE_ASYNC, RECEIVE_MODE_SYNC).
		@see	SMSService#setReceiveMode(int)
	*/
	public int getReceiveMode() {

		return receiveMode;

	}

	/**
		Returns the cache directory for messages.
	
		@return  the caching directory.
		@see	SMSService#setCacheDir(String)
	*/
	public String getCacheDir() {

		return cacheDir;

	}

	/**
		Initializes the service. This should be the first method call.
	
		@return  ERR_OK (for this version).
		@see	SMSService#connect()
	*/
	public int initialize() {
		cacheDir = null;
		smscNumber = null;
		simPin = null;
		operationMode = 0;
		supportedModes = 0;
		setInitialized(true);
		return ERR_OK;
	}

	/**
		Connects to the GSM device. Opens the serial port, and sends the appropriate
		AT commands to initialize the operation mode of the GSM device. Retrieves
		information about the GSM device. This method should be called after
		initialize() has been called.
		<br>
		By default, jSMSEngine API sets your GSM device to PDU mode. If you want to
		switch to ASCII mode (I don't see any reason why, but anyway...), use the
		setOperationMode() method.
		<br><br>
		Notes:
		<br>
		<ul>
			<li>The GSM device specific information (read by the call to refreshDeviceInfo()
					function is called once from this method. Since some information changes
					with time (such as battery or signal level), its your responsibility to
					call refreshDeviceInfo() periodically in order to have the latest information.
					Otherwise, you will get the information snapshot taken at the time
					of the initial connection.
			</li>
		</ul>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91成人免费在线视频| 精品日韩av一区二区| 欧美男人的天堂一二区| 日韩一区二区三区视频在线观看 | 欧美亚洲国产一区二区三区va| 欧美亚洲综合一区| 精品国产一区二区三区av性色| 欧美高清在线视频| 日韩成人一级片| 成人app下载| 欧美一区二区视频观看视频| 国产精品乱人伦| 婷婷综合另类小说色区| 成人午夜又粗又硬又大| 欧美日韩高清在线| 中文字幕在线观看不卡| 蜜臀99久久精品久久久久久软件| 99re66热这里只有精品3直播| 日韩午夜电影av| 亚洲欧美经典视频| 日韩—二三区免费观看av| 97精品久久久午夜一区二区三区 | 1区2区3区欧美| 美女www一区二区| 色网站国产精品| 久久精品在线观看| 日韩制服丝袜av| 色综合久久综合网97色综合| 久久久精品天堂| 美腿丝袜亚洲综合| 欧美影院午夜播放| 亚洲视频一二三区| 粉嫩久久99精品久久久久久夜 | 大胆欧美人体老妇| 精品少妇一区二区三区视频免付费| 亚洲精品欧美激情| a美女胸又www黄视频久久| 欧美不卡视频一区| 亚洲成人综合网站| 国产黄色成人av| 欧美变态tickling挠脚心| 午夜久久电影网| 欧美色图在线观看| 亚洲成av人综合在线观看| 在线免费一区三区| 亚洲激情自拍偷拍| 日本精品免费观看高清观看| 国产精品进线69影院| 国产91在线看| 欧美激情一区二区| 成人综合在线视频| 国产精品理论在线观看| 99久久精品情趣| 精品免费国产二区三区| 青青草国产成人av片免费| 欧美精品欧美精品系列| 理论电影国产精品| 久久久久99精品国产片| 国产91精品露脸国语对白| 中文字幕在线免费不卡| 91在线视频18| 亚洲成人免费av| 欧美日韩国产小视频在线观看| 综合欧美一区二区三区| 在线观看国产91| 婷婷夜色潮精品综合在线| 337p亚洲精品色噜噜噜| 韩日精品视频一区| 欧美一区二区三区免费观看视频| 免费精品视频最新在线| 精品久久久久香蕉网| 国产成人av电影在线播放| 亚洲人精品一区| 91精品国产综合久久小美女| 国产乱子轮精品视频| 亚洲欧美激情小说另类| 欧美精品粉嫩高潮一区二区| 国产在线日韩欧美| 亚洲天天做日日做天天谢日日欢| 欧美日韩一区精品| 国产伦精一区二区三区| 一区二区三区四区在线| 欧美一区二区久久| www.av精品| 美女网站一区二区| 亚洲欧洲99久久| 精品视频在线免费| 久久97超碰色| 亚洲欧美经典视频| 欧美一区二区三区电影| 成av人片一区二区| 亚洲成人激情自拍| 久久久精品天堂| 福利一区二区在线| 亚洲自拍偷拍欧美| 久久亚洲一区二区三区四区| 欧美手机在线视频| 国产91在线|亚洲| 久久精品国产网站| 亚洲综合免费观看高清完整版在线| 精品av综合导航| 欧美色综合影院| 成人精品免费视频| 美女尤物国产一区| 亚洲午夜免费电影| 国产欧美日韩不卡| 日韩一区二区免费电影| 欧美视频三区在线播放| 成人免费高清在线观看| 奇米综合一区二区三区精品视频| 中文字幕亚洲在| 欧美电影免费观看高清完整版在线观看 | 国产日韩欧美a| 555www色欧美视频| 日本伦理一区二区| 91麻豆swag| 成人sese在线| 国产一区二区影院| 精品一区二区三区在线观看国产| 亚洲一区二区三区自拍| 日韩码欧中文字| 欧美激情资源网| wwwwxxxxx欧美| 精品久久久久久久久久久院品网| 911精品产国品一二三产区| 色94色欧美sute亚洲13| 99久久精品免费看国产免费软件| 国产精品996| 精品一区二区在线看| 亚洲成人av电影| 一区二区三区在线视频免费观看| 国产精品久久久久一区二区三区| 国产日韩av一区二区| 久久精品人人做人人综合 | 成人av免费在线观看| 成人精品视频.| av不卡免费在线观看| 色哟哟国产精品免费观看| 99九九99九九九视频精品| 韩国视频一区二区| 免费成人在线影院| 国内偷窥港台综合视频在线播放| 国产一区视频在线看| 成人成人成人在线视频| 91免费精品国自产拍在线不卡| 91国内精品野花午夜精品| 欧美色爱综合网| 欧美成人精品二区三区99精品| 精品国产一区二区三区四区四| 久久综合九色综合欧美就去吻| 久久免费看少妇高潮| 国产日韩欧美制服另类| 国产精品国产自产拍高清av王其| 国产精品乱码一区二区三区软件| 亚洲欧美影音先锋| 亚洲欧美中日韩| 中文字幕亚洲区| 久久综合久久综合久久| 亚洲精品在线免费观看视频| 欧美激情一区二区三区全黄| 亚洲精品高清在线观看| 日韩av一区二区在线影视| 国内精品国产三级国产a久久| 成人免费视频一区二区| 色偷偷久久人人79超碰人人澡| 欧美一区二区成人6969| 国产区在线观看成人精品| 日韩精品一区第一页| 91影院在线免费观看| www激情久久| 奇米四色…亚洲| 欧美三级蜜桃2在线观看| 中日韩av电影| 国产尤物一区二区| 欧美xxxxxxxxx| 日韩在线卡一卡二| 欧美日韩成人综合天天影院| 亚洲欧美成人一区二区三区| 成人av电影在线观看| 2017欧美狠狠色| 久久国产精品露脸对白| 欧美乱妇23p| 天天色综合成人网| 91精彩视频在线观看| 国产精品久久久久aaaa樱花| 国产一区二区三区四| 欧美一区二区三区思思人| 性做久久久久久| 在线亚洲免费视频| 一区二区在线观看免费视频播放| 国产99久久久国产精品| 国产午夜精品福利| 国产精品一区二区黑丝| 久久综合色之久久综合| 国产在线精品视频| 欧美va在线播放| 久久疯狂做爰流白浆xx| 欧美大片在线观看一区二区| 久久不见久久见免费视频7| 欧美大片在线观看一区二区|