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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cservice.java

?? Sending and receiving of SMS using Java
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:

	/**
	 * Returns the current number of retries.
	 * 
	 * @return The number of retries.
	 * @see CService#setRetriesNoResponse(int)
	 */
	public int getRetriesNoResponse()
	{
		return retriesNoResponse;
	}

	/**
	 * Sets the delay between consecutive attemps for dispatching a message.
	 * 
	 * @param delay
	 *            The delay in millisecs.
	 * @see CService#getDelayNoResponse()
	 * @see CService#setRetriesNoResponse(int)
	 * @see CService#getRetriesNoResponse()
	 */
	public void setDelayNoResponse(int delay)
	{
		this.delayNoResponse = delay * 1000;
	}

	/**
	 * Gets the delay between consecutive attemps for dispatching a message.
	 * 
	 * @return delay The delay in millisecs.
	 * @see CService#getDelayNoResponse()
	 * @see CService#setRetriesNoResponse(int)
	 * @see CService#getRetriesNoResponse()
	 */
	public int getDelayNoResponse()
	{
		return delayNoResponse;
	}

	public void setRetriesCmsErrors(int retries)
	{
		this.retriesCmsErrors = retries;
	}

	public int getRetriesCmsErrors()
	{
		return retriesCmsErrors;
	}

	public void setDelayCmsErrors(int delay)
	{
		this.delayCmsErrors = delay * 1000;
	}

	public int getDelayCmsErrors()
	{
		return delayCmsErrors;
	}

	/**
	 * Returns the Log4J logger object used by SMSLib.
	 * 
	 * @return The Log4J logger object.
	 */
	public Logger getLogger()
	{
		return log;
	}

	/**
	 * Sets the logger to a custom Log4J Logger object. You can also use this call to completely disable logging, by passing a null object.
	 * 
	 * @param log
	 *            A Log4J logger object.
	 */
	public void setLogger(Logger log)
	{
		this.log = log;
	}

	/**
	 * Sets the receive mode.
	 * 
	 * @param receiveMode
	 *            The receive mode.
	 * @see CService.ReceiveMode
	 */
	public void setReceiveMode(int receiveMode) throws Exception
	{
		synchronized (_SYNC_)
		{
			this.receiveMode = receiveMode;
			if (connected)
			{
				if (receiveMode == ReceiveMode.AsyncCnmi)
				{
					if (!atHandler.enableIndications())
					{
						if (log != null) log.warn("Could not enable CMTI indications, continuing without them...");
					}
				}
				else
				{
					if (!atHandler.disableIndications())
					{
						if (log != null) log.warn("Could not disable CMTI indications, continuing without them...");
					}
				}
			}
		}
	}

	/**
	 * Returns the Receive Mode.
	 * 
	 * @return The Receive Mode.
	 * @see CService.ReceiveMode
	 */
	public int getReceiveMode()
	{
		return receiveMode;
	}

	/**
	 * Sets the protocol to be used.
	 * <p>
	 * The default protocol is PDU. If you want to change it, you must call this method after constructing the CService object and before connecting. Otherwise, you will get an exception.
	 * 
	 * @param protocol
	 *            The protocol to be used.
	 * @see CService#getProtocol()
	 * @see CService.Protocol
	 */
	public void setProtocol(int protocol) throws Exception
	{
		if (getConnected()) throw new OopsException("Cannot change protocol while connected!");
		else this.protocol = protocol;
	}

	/**
	 * Returns the protocol in use.
	 * 
	 * @return The protocol use.
	 * @see CService.Protocol
	 */
	public int getProtocol()
	{
		return protocol;
	}

	/**
	 * Sets the storage locations to be read by SMSLib.
	 * <p>
	 * Normally, SMSLib tries to read the available storage locations reported by the modem itself. Sometimes, the modem does not report all storage locations, so you can use this method to define yours, without messing with main SMSLib code.
	 * 
	 * @param loc
	 *            The storage locations (i.e. a string similar to "SMME", which is specific to each modem)
	 */
	public void setStorageLocations(String loc)
	{
		atHandler.setStorageLocations(loc);
	}

	/**
	 * Connects to the GSM modem.
	 * <p>
	 * The connect() function should be called before any operations. Its purpose is to open the serial link, check for modem existence, initialize modem, start background threads and prepare for subsequent operations.
	 * 
	 * @see #disconnect()
	 * @throws NotConnectedException
	 *             Nobody is answering.
	 * @throws AlreadyConnectedException
	 *             Already connected.
	 * @throws NoPinException
	 *             If PIN is requested from the modem but no PIN is defined.
	 * @throws InvalidPinException
	 *             If the defined PIN is not accepted by the modem.
	 * @throws NoPduSupportException
	 *             The modem does not support PDU mode - fatal error!
	 */
	public void connect() throws Exception
	{
		synchronized (_SYNC_)
		{
			if (getConnected()) throw new AlreadyConnectedException();
			else try
			{
				serialDriver.open();
				connected = true;
				atHandler.sync();
				serialDriver.emptyBuffer();
				atHandler.reset();
				serialDriver.setNewMsgMonitor(newMsgMonitor);
				if (atHandler.isAlive())
				{
					if (atHandler.waitingForPin())
					{
						if (getSimPin() == null) throw new NoPinException();
						else if (!atHandler.enterPin(getSimPin())) throw new InvalidPinException();
						if (atHandler.waitingForPin())
						{
							if (getSimPin2() == null) throw new NoPin2Exception();
							else if (!atHandler.enterPin(getSimPin2())) throw new InvalidPin2Exception();
						}
					}
					atHandler.init();
					atHandler.echoOff();
					waitForNetworkRegistration();
					atHandler.setVerboseErrors();
					if (atHandler.storageLocations.length() == 0) atHandler.getStorageLocations();
					if (log != null) log.info("MEM: Storage Locations Found: " + atHandler.storageLocations);
					switch (protocol)
					{
						case Protocol.PDU:
							if (log != null) log.info("PROT: Using PDU protocol.");
							if (!atHandler.setPduMode()) throw new NoPduSupportException();
							break;
						case Protocol.TEXT:
							if (log != null) log.info("PROT: Using TEXT protocol.");
							if (!atHandler.setTextMode()) throw new NoTextSupportException();
							break;
						default:
							throw new OopsException("Invalid protocol! Should be PDU or TEXT.");
					}
					setReceiveMode(receiveMode);
					refreshDeviceInfo();

					receiveThread = new CReceiveThread();
					receiveThread.start();
					keepAliveThread = new CKeepAliveThread();
					keepAliveThread.start();
				}
				else throw new NotConnectedException("GSM device is not responding.");
			}
			catch (Exception e)
			{
				try
				{
					disconnect();
				}
				catch (Exception e2)
				{
				}
				throw e;
			}
		}
	}

	/**
	 * Disconnects from the GSM modem.
	 * <p>
	 * This should be the last function called. Closes serial connection, shuts down background threads and performs clean-up.
	 * <p>
	 * <strong>Notes</strong>
	 * <ul>
	 * <li>Do not connect and disconnect continously - at least if you can avoid it. It takes time and resources. Connect once and stay connected.</li>
	 * </ul>
	 * 
	 * @see CService#connect()
	 */
	public void disconnect() throws Exception
	{
		if (getConnected())
		{
			assert (receiveThread != null);
			assert (keepAliveThread != null);

			final int wait = 100;
			int timeout = DISCONNECT_TIMEOUT;
			receiveThread.killMe();
			keepAliveThread.killMe();
			while (timeout > 0 && !receiveThread.killed() && !keepAliveThread.killed())
			{
				Thread.sleep(wait);
				timeout -= wait;
			}

			try
			{
				serialDriver.killMe();
				if (!receiveThread.killed())
				{
					receiveThread.interrupt();
					receiveThread.join();
				}

				if (!keepAliveThread.killed())
				{
					keepAliveThread.interrupt();
					keepAliveThread.join();
				}

			}
			finally
			{
				receiveThread = null;
				keepAliveThread = null;
				serialDriver.close();
				connected = false;
			}
		}
		else throw new NotConnectedException();
	}

	/**
	 * Reads all SMS messages from the GSM modem.
	 * 
	 * @param messageList
	 *            The list to be populated with messages.
	 * @param messageClass
	 *            The message class of the messages to read.
	 * @throws NotConnectedException
	 *             Either connect() is not called or modem has been disconnected.
	 * @see CService#readMessages(LinkedList, int, int)
	 * @see CIncomingMessage
	 * @see CIncomingMessage.MessageClass
	 * @see CService#sendMessage(COutgoingMessage)
	 */
	public void readMessages(LinkedList messageList, int messageClass) throws Exception
	{
		switch (protocol)
		{
			case Protocol.PDU:
				readMessages_PDU(messageList, messageClass, 0);
				break;
			case Protocol.TEXT:
				readMessages_TEXT(messageList, messageClass, 0);
		}
	}

	/**
	 * Reads up to a specific number of SMS messages from the GSM modem.
	 * 
	 * @param messageList
	 *            The list to be populated with messages.
	 * @param messageClass
	 *            The message class of the messages to read.
	 * @param limit
	 *            Read up to <limit> number of messages. If limit is set to 0, read all messages.
	 * @throws NotConnectedException
	 *             Either connect() is not called or modem has been disconnected.
	 * @see CService#readMessages(LinkedList, int)
	 * @see CIncomingMessage
	 * @see CIncomingMessage.MessageClass
	 * @see CService#sendMessage(COutgoingMessage)
	 */
	public void readMessages(LinkedList messageList, int messageClass, int limit) throws Exception
	{
		switch (protocol)
		{
			case Protocol.PDU:
				readMessages_PDU(messageList, messageClass, limit);
				break;
			case Protocol.TEXT:
				readMessages_TEXT(messageList, messageClass, limit);
				break;
		}
	}

	//@SuppressWarnings("unchecked")
	private void readMessages_PDU(LinkedList messageList, int messageClass, int limit) throws Exception
	{
		int i, j, memIndex;
		String response, line, pdu;
		BufferedReader reader;
		CIncomingMessage mpMsg;

		if (limit < 0) limit = 0;
		mpMsg = null;
		synchronized (_SYNC_)
		{
			if (getConnected())
			{
				atHandler.switchToCmdMode();
				for (int ml = 0; ml < (atHandler.storageLocations.length() / 2); ml++)
				{
					if (atHandler.setMemoryLocation(atHandler.storageLocations.substring((ml * 2), (ml * 2) + 2)))
					{
						response = atHandler.listMessages(messageClass);
						response = response.replaceAll("\\s+OK\\s+", "\nOK");
						reader = new BufferedReader(new StringReader(response));
						for (;;)
						{
							line = reader.readLine().trim();
							if (line == null) break;
							line = line.trim();
							if (line.length() > 0) break;
						}
						while (true)
						{
							if (line == null) break;
							line = line.trim();
							if (line.length() <= 0 || line.equalsIgnoreCase("OK")) break;
							i = line.indexOf(':');
							j = line.indexOf(',');
							memIndex = Integer.parseInt(line.substring(i + 1, j).trim());
							pdu = reader.readLine().trim();
							try
							{
								if (isIncomingMessage(pdu))
								{
									CIncomingMessage msg;

									msg = new CIncomingMessage(pdu, memIndex, atHandler.storageLocations.substring((ml * 2), (ml * 2) + 2));
									if (log != null) log.debug("IN-DTLS: MI:" + msg.getMemIndex() + " REF:" + msg.getMpRefNo() + " MAX:" + msg.getMpMaxNo() + " SEQ:" + msg.getMpSeqNo());
									if (msg.getMpRefNo() == 0)
									{
										if (mpMsg != null) mpMsg = null;
										messageList.add(msg);
										deviceInfo.getStatistics().incTotalIn();
									}
									else
									{
										int k, l;
										LinkedList tmpList;
										CIncomingMessage listMsg;
										boolean found, duplicate;

										found = false;
										for (k = 0; k < mpMsgList.size(); k++)
										{
											tmpList = (LinkedList) mpMsgList.get(k);
											listMsg = (CIncomingMessage) tmpList.get(0);
											if (listMsg.getMpRefNo() == msg.getMpRefNo())

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本三级亚洲精品| 一区二区三区在线视频播放| 美女一区二区视频| 欧美一区二区日韩| 美洲天堂一区二卡三卡四卡视频 | 成av人片一区二区| 国产精品久久毛片av大全日韩| 99热在这里有精品免费| 一区二区三区四区不卡在线| 欧美日韩国产a| 蜜臀av在线播放一区二区三区 | 884aa四虎影成人精品一区| 日本亚洲免费观看| 久久色在线观看| 99久久精品国产导航| 天堂va蜜桃一区二区三区| 欧美精品一区二区在线播放| 成人精品小蝌蚪| 亚洲一区二区三区中文字幕| 日韩一区二区三区免费看| 懂色av噜噜一区二区三区av| 亚洲宅男天堂在线观看无病毒 | 久久久精品综合| 91在线高清观看| 青青草91视频| 成人欧美一区二区三区| 欧美精选午夜久久久乱码6080| 国产一区二区女| 一区二区欧美视频| 久久天天做天天爱综合色| 在线观看国产91| 国产精品自拍一区| 亚洲一区二区高清| 国产日韩视频一区二区三区| 日本韩国欧美在线| 国产麻豆精品在线观看| 一片黄亚洲嫩模| 久久久国产精华| 制服视频三区第一页精品| 成人app网站| 狠狠狠色丁香婷婷综合激情| 一区二区三区欧美在线观看| 国产午夜精品久久久久久免费视 | 色婷婷亚洲婷婷| 国产乱码精品一区二区三区av | 久久99精品久久久久久国产越南 | 26uuu国产在线精品一区二区| 在线一区二区三区| 国产成人精品免费视频网站| 美女www一区二区| 国产电影一区在线| 美女精品一区二区| 亚洲国产另类精品专区| 国产精品麻豆久久久| 欧美大度的电影原声| 欧美性大战久久| 色婷婷一区二区| 色综合亚洲欧洲| 欧美日韩一区中文字幕| 99久久99久久精品国产片果冻| 国产一本一道久久香蕉| 秋霞av亚洲一区二区三| 亚洲第一会所有码转帖| 亚洲精品久久久久久国产精华液| 国产女同性恋一区二区| 久久午夜色播影院免费高清| 欧美videos中文字幕| 91精品国产综合久久久久久久久久 | 欧美videos大乳护士334| 欧美精品久久久久久久久老牛影院| 一本色道亚洲精品aⅴ| 色综合天天综合网天天狠天天| 成人免费不卡视频| 国产·精品毛片| 不卡av电影在线播放| 成人污污视频在线观看| 成人黄色777网| 成人免费毛片app| 99精品一区二区| 色8久久精品久久久久久蜜| 色哟哟欧美精品| 欧美日韩亚洲综合| 欧美精品777| 欧美va亚洲va国产综合| 精品成人一区二区| 国产网站一区二区| 中文字幕日韩一区二区| 樱花草国产18久久久久| 亚洲一区免费视频| 天堂av在线一区| 久久99精品久久只有精品| 国产精品99久久久久久久vr | 亚洲一区二区视频在线| 三级久久三级久久久| 久久国产尿小便嘘嘘| 国产成人免费视频网站高清观看视频 | 欧美日韩aaaaa| 日韩欧美在线影院| 久久久美女艺术照精彩视频福利播放| 中文字幕乱码一区二区免费| 国产精品超碰97尤物18| 亚洲一区二区中文在线| 美腿丝袜亚洲一区| 福利视频网站一区二区三区| 91行情网站电视在线观看高清版| 欧美色欧美亚洲另类二区| 日韩美女一区二区三区| 国产精品私人自拍| 视频一区欧美日韩| 国产精品亚洲专一区二区三区| 一本久久精品一区二区| 欧美一级日韩免费不卡| 中文字幕精品—区二区四季| 一区二区高清在线| 国产精品白丝av| 欧美日韩黄色影视| 国产亚洲欧美色| 香蕉久久夜色精品国产使用方法| 黑人巨大精品欧美黑白配亚洲| 成人h动漫精品| 欧美日韩精品久久久| 日韩欧美一级在线播放| 亚洲视频资源在线| 久久99最新地址| 欧美在线视频日韩| 国产精品欧美一区喷水| 青草国产精品久久久久久| 色综合久久天天综合网| 欧美成人国产一区二区| 一区二区三区在线视频免费 | 日韩一区有码在线| 久久99热99| 精品视频色一区| 亚洲欧洲日本在线| 国内成人精品2018免费看| 欧美视频在线一区| 中文字幕在线不卡| 国产精品资源站在线| 欧美一区二区日韩一区二区| 亚洲精品国产第一综合99久久| 国产精品99久久久久久宅男| 欧美一区二区黄| 亚洲国产精品久久久久婷婷884 | 一本大道av一区二区在线播放 | 91精品国产色综合久久久蜜香臀| 日韩理论片网站| 国产超碰在线一区| 欧美精品一区二区三区久久久| 日韩精品一二三四| 欧美午夜电影在线播放| 亚洲视频一区二区免费在线观看 | 麻豆91在线播放免费| 欧美日韩精品一区二区三区| 亚洲美女屁股眼交| 97精品国产露脸对白| 亚洲国产成人私人影院tom| 激情综合色综合久久| 欧美一区二区三区的| 日本不卡视频在线观看| 7777精品久久久大香线蕉| 性久久久久久久久久久久| 91久久人澡人人添人人爽欧美| 中文字幕人成不卡一区| av电影在线不卡| 一区视频在线播放| 91美女蜜桃在线| 亚洲柠檬福利资源导航| 色综合久久综合中文综合网| 一区二区不卡在线播放| 欧美私人免费视频| 亚洲成人av在线电影| 7777精品伊人久久久大香线蕉超级流畅| 亚洲国产精品一区二区www| 欧美日韩国产首页| 日本视频免费一区| 精品国产污污免费网站入口| 国产一区二区三区免费播放| 久久精品日韩一区二区三区| 成人福利视频网站| 亚洲激情自拍视频| 欧美日韩大陆一区二区| 蜜桃视频在线观看一区二区| 精品久久国产老人久久综合| 国产在线一区二区| 日本一区二区电影| 91电影在线观看| 日韩中文字幕一区二区三区| 欧美成人在线直播| 成人免费毛片片v| 亚洲一本大道在线| 欧美一级专区免费大片| 国产成人av资源| 亚洲欧美日韩精品久久久久| 3751色影院一区二区三区| 寂寞少妇一区二区三区| 国产精品麻豆一区二区| 欧美美女一区二区| 懂色av中文字幕一区二区三区| 亚洲综合区在线| 日韩欧美久久久|