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

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

?? coutgoingmessage.java

?? Sending and receiving of SMS using Java
?? JAVA
字號(hào):
// 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.util.*;

/**
 * This class represents a normal (text) outgoing / outbound message.
 * 
 * @see CWapSIMessage
 */
public class COutgoingMessage extends CMessage
{
	private static final long serialVersionUID = 1L;

	protected Date dispatchDate;

	protected int validityPeriod;

	protected boolean statusReport;

	protected boolean flashSms;

	protected int srcPort;

	protected int dstPort;

	public COutgoingMessage()
	{
		super(CMessage.MessageType.Outgoing, null, null, null, null);

		validityPeriod = -1;
		statusReport = false;
		flashSms = false;
		srcPort = -1;
		dstPort = -1;
		pid = 0;
		dcs = 0;
		dispatchDate = null;
		setDate(new Date());
		setMessageEncoding(MessageEncoding.Enc7Bit);
	}

	/**
	 * General constructor for an outgoing message. Only the text and the recipient's number is required. The message encoding is set to 7bit by default.
	 * 
	 * @param recipient
	 *            The recipient's number - should be in international format.
	 * @param text
	 *            The message text.
	 * @see #setMessageEncoding(int)
	 * @see #setValidityPeriod(int)
	 * @see #setStatusReport(boolean)
	 * @see #setFlashSms(boolean)
	 * @see #setSourcePort(int)
	 * @see #setDestinationPort(int)
	 */
	public COutgoingMessage(String recipient, String text)
	{
		super(CMessage.MessageType.Outgoing, new Date(), null, recipient, text);

		validityPeriod = -1;
		statusReport = false;
		flashSms = false;
		srcPort = -1;
		dstPort = -1;
		pid = 0;
		dcs = 0;
		dispatchDate = null;
		setDate(new Date());
		setMessageEncoding(MessageEncoding.Enc7Bit);
	}

	protected boolean isBig() throws Exception
	{
		int messageLength;

		messageLength = encodedText.length() / 2;
		return (messageLength > maxSize() ? true : false);
	}

	protected int getNoOfParts() throws Exception
	{
		int noOfParts = 0;
		int partSize;
		int messageLength;

		partSize = maxSize() - 8;
		messageLength = encodedText.length() / 2;
		noOfParts = messageLength / partSize;
		if ((noOfParts * partSize) < (messageLength)) noOfParts++;
		return noOfParts;
	}

	private int maxSize() { return 140; }

	private String getPart(int partNo, int udhLength) throws Exception
	{
		int partSize;

		if (partNo != 0)
		{
			partSize = maxSize() - udhLength;
			partSize *= 2;
			if (((partSize * (partNo - 1)) + partSize) > encodedText.length()) return encodedText.substring(partSize * (partNo - 1));
			else return encodedText.substring(partSize * (partNo - 1), (partSize * (partNo - 1)) + partSize);
		}
		else return encodedText;
	}

	protected String getPDU(String smscNumber, int mpRefNo, int partNo) throws Exception
	{
		String pdu, udh, ud, dataLen;
		String str1, str2;

		pdu = "";
		udh = "";
		if ((smscNumber != null) && (smscNumber.length() != 0))
		{
			str1 = "91" + toBCDFormat(smscNumber.substring(1));
			str2 = Integer.toHexString(str1.length() / 2);
			if (str2.length() != 2) str2 = "0" + str2;
			pdu = pdu + str2 + str1;
		}
		else if ((smscNumber != null) && (smscNumber.length() == 0)) pdu = pdu + "00";
		if (((srcPort != -1) && (dstPort != -1)) || (isBig()))
		{
			if (statusReport) pdu = pdu + "71";
			else pdu = pdu + "51";
		}
		else
		{
			if (statusReport) pdu = pdu + "31";
			else pdu = pdu + "11";
		}
		pdu = pdu + "00";
		str1 = getRecipient();
		if (str1.charAt(0) == '+')
		{
			str1 = toBCDFormat(str1.substring(1));
			str2 = Integer.toHexString(getRecipient().length() - 1);
			str1 = "91" + str1;
		}
		else
		{
			str1 = toBCDFormat(str1);
			str2 = Integer.toHexString(getRecipient().length());
			str1 = "81" + str1;
		}
		if (str2.length() != 2) str2 = "0" + str2;
		pdu = pdu + str2 + str1;

		{
			String s;

			s = Integer.toHexString(pid);
			while (s.length() < 2)
				s = "0" + s;
			pdu = pdu + s;
		}

		switch (getMessageEncoding())
		{
			case CMessage.MessageEncoding.Enc7Bit:
				if (flashSms) pdu = pdu + "10";
				else pdu = pdu + "00";
				break;
			case CMessage.MessageEncoding.Enc8Bit:
				if (flashSms) pdu = pdu + "14";
				else pdu = pdu + "04";
				break;
			case CMessage.MessageEncoding.EncUcs2:
				if (flashSms) pdu = pdu + "18";
				else pdu = pdu + "08";
				break;
			case CMessage.MessageEncoding.EncCustom:
			{
				String s;

				if (dcs == 0) throw new OopsException();
				s = Integer.toHexString(dcs);
				while (s.length() < 2)
					s = "0" + s;
				pdu = pdu + s;
			}
				break;
			default:
				throw new OopsException();
		}

		pdu = pdu + getValidityPeriodBits();

		if ((srcPort != -1) && (dstPort != -1))
		{
			String s;

			udh += "060504";
			s = Integer.toHexString(dstPort);
			while (s.length() < 4)
				s = "0" + s;
			udh += s;
			s = Integer.toHexString(srcPort);
			while (s.length() < 4)
				s = "0" + s;
			udh += s;
		}

		if (isBig())
		{
			String s;

			if ((srcPort != -1) && (dstPort != -1)) udh = "0C" + udh.substring(2) + "0804";
			else udh += "060804";
			s = Integer.toHexString(mpRefNo);
			while (s.length() < 4)
				s = "0" + s;
			udh += s;
			s = Integer.toHexString(getNoOfParts());
			while (s.length() < 2)
				s = "0" + s;
			udh += s;
			s = Integer.toHexString(partNo);
			while (s.length() < 2)
				s = "0" + s;
			udh += s;
		}

		switch (messageEncoding)
		{
			case MessageEncoding.Enc7Bit:
				ud = getPart(partNo, udh.length());
				dataLen = Integer.toHexString(((ud.length() + udh.length()) * 8 / 7) / 2);
				break;
			case MessageEncoding.Enc8Bit:
				ud = getPart(partNo, udh.length());
				dataLen = Integer.toHexString((ud.length() + udh.length()) / 2);
				break;
			case MessageEncoding.EncUcs2:
				ud = getPart(partNo, udh.length());
				dataLen = Integer.toHexString((ud.length() + udh.length()) / 2);
				break;
			case MessageEncoding.EncCustom:
				if ((dcs & 0x04) == 0)
				{
					ud = getPart(partNo, udh.length());
					dataLen = Integer.toHexString(((ud.length() + udh.length()) * 8 / 7) / 2);
				}
				else
				{
					ud = getPart(partNo, udh.length());
					dataLen = Integer.toHexString((ud.length() + udh.length()) / 2);
				}
				break;
			default: throw new OopsException();
		}
		if (dataLen.length() != 2) dataLen = "0" + dataLen;
		if (udh.length() != 0) pdu = pdu + dataLen + udh + ud;
		else pdu = pdu + dataLen + ud;
		return pdu.toUpperCase();
	}

	private String getValidityPeriodBits()
	{
		String bits;
		int value;

		if (validityPeriod == -1) bits = "FF";
		else
		{
			if (validityPeriod <= 12) value = (validityPeriod * 12) - 1;
			else if (validityPeriod <= 24) value = (((validityPeriod - 12) * 2) + 143);
			else if (validityPeriod <= 720) value = (validityPeriod / 24) + 166;
			else value = (validityPeriod / 168) + 192;
			bits = Integer.toHexString(value);
			if (bits.length() != 2) bits = "0" + bits;
			if (bits.length() > 2) bits = "FF";
		}
		return bits;
	}

	private String toBCDFormat(String s)
	{
		String bcd;
		int i;

		if ((s.length() % 2) != 0) s = s + "F";
		bcd = "";
		for (i = 0; i < s.length(); i += 2)
			bcd = bcd + s.charAt(i + 1) + s.charAt(i);
		return bcd;
	}

	/**
	 * Sets the Recipient's number. The number should be in international format.
	 * 
	 * @param recipient
	 *            The Recipient's number.
	 */
	public void setRecipient(String recipient)
	{
		this.recipient = recipient;
	}

	/**
	 * Returns the message recipient number. Number is in international format.
	 * 
	 * @return The Recipient's number.
	 */
	public String getRecipient()
	{
		return recipient;
	}

	/**
	 * Sets the validity period. By default, an outgoing message has the maximum allowed validity period.
	 * 
	 * @param hours
	 *            The validity period in hours.
	 */
	public void setValidityPeriod(int hours)
	{
		this.validityPeriod = hours;
	}

	/**
	 * Returns the defined validity period in hours.
	 * 
	 * @return The validity period (hours).
	 */
	public int getValidityPeriod()
	{
		return validityPeriod;
	}

	/**
	 * Sets the delivery status report functionality. Set this to true if you want to enable delivery status report for this specific message.
	 * 
	 * @param statusReport
	 *            True if you want to enable delivery status reports.
	 */
	public void setStatusReport(boolean statusReport)
	{
		this.statusReport = statusReport;
	}

	/**
	 * Returns the state of the delivery status report request.
	 * 
	 * @return True if delivery status report request is enabled.
	 * @see #setValidityPeriod(int)
	 */
	public boolean getStatusReport()
	{
		return statusReport;
	}

	/**
	 * Set the Flash SMS indication.
	 * <p>
	 * Flash SMS appear directly on recipient's screen. This functionality may not be supported on all headsets.
	 * 
	 * @param flashSms
	 *            True if you want to send a Flash SMS.
	 */
	public void setFlashSms(boolean flashSms)
	{
		this.flashSms = flashSms;
	}

	/**
	 * Returns true if the SMS is a flash SMS.
	 * 
	 * @return True if the SMS is a flash SMS.
	 * @see #setFlashSms(boolean)
	 */
	public boolean getFlashSms()
	{
		return flashSms;
	}

	/**
	 * Sets the Source Port information field. This settings affects PDU header creation.
	 * 
	 * @param port
	 *            The Source Port.
	 */
	public void setSourcePort(int port)
	{
		this.srcPort = port;
	}

	/**
	 * Return the message source-port information. Returns -1 if the source-port is undefined.
	 * 
	 * @return The message source-port information.
	 * @see #setSourcePort(int)
	 * @see #getDestinationPort()
	 */
	public int getSourcePort()
	{
		return srcPort;
	}

	/**
	 * Sets the DestinationPort information field. This settings affects PDU header creation.
	 * 
	 * @param port
	 *            The Destination Port.
	 */
	public void setDestinationPort(int port)
	{
		this.dstPort = port;
	}

	/**
	 * Return the message destination-port information. Returns -1 if the destination-port is undefined.
	 * 
	 * @return The message destination-port information.
	 * @see #setDestinationPort(int)
	 * @see #getSourcePort()
	 */
	public int getDestinationPort()
	{
		return dstPort;
	}

	/**
	 * Returns the date of dispatch - the date when this message was send from SMSLib. Returns NULL if the message has not been sent yet.
	 * 
	 * @return The dispatch date.
	 */
	public Date getDispatchDate()
	{
		if (dispatchDate != null) return (Date) dispatchDate.clone();
		else return null;
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色软件下载| 理论片日本一区| 久久精品日韩一区二区三区| 日韩欧美一二三四区| 欧美一级欧美三级| 精品国产制服丝袜高跟| 久久综合九色综合97婷婷| 精品日韩欧美在线| 国产女主播一区| 国产精品热久久久久夜色精品三区| 国产亚洲精品7777| 国产精品色眯眯| 亚洲精品v日韩精品| 一区二区三区在线视频观看 | 国产综合久久久久久久久久久久| 日韩不卡在线观看日韩不卡视频| 日韩和的一区二区| 精品一区二区免费视频| 成人一区二区视频| av欧美精品.com| 色婷婷国产精品综合在线观看| 91在线国内视频| 欧美精品免费视频| 2021久久国产精品不只是精品| 国产女主播视频一区二区| 中文字幕一区二区三区乱码在线| 亚洲在线观看免费视频| 免费在线看成人av| 成人av在线播放网址| 欧美综合亚洲图片综合区| 欧美一区二区三区免费| 久久精品视频在线免费观看| 一区二区三区精品在线观看| 日产精品久久久久久久性色| 国产在线精品一区二区夜色| 91视频xxxx| 欧美精品一区二区久久婷婷| 最新国产精品久久精品| 蜜桃久久久久久| 一本久久a久久精品亚洲| 欧美一级片在线看| 一区二区激情视频| 国产成人免费av在线| 欧美日韩亚洲不卡| 欧美激情资源网| 免费观看91视频大全| 色综合天天综合网国产成人综合天| 精品日韩一区二区三区 | 精品日韩一区二区| 亚洲色图欧美在线| 国产裸体歌舞团一区二区| 在线免费亚洲电影| 一区在线观看视频| 国产乱码精品一区二区三区忘忧草 | 亚洲精品日韩一| 韩日欧美一区二区三区| 在线播放91灌醉迷j高跟美女 | 日韩高清在线电影| 99re视频精品| 国产精品素人视频| 久久国产尿小便嘘嘘尿| 欧美日韩一卡二卡| 亚洲啪啪综合av一区二区三区| 精品亚洲porn| 日韩片之四级片| 视频一区中文字幕国产| 99精品黄色片免费大全| 国产精品美女一区二区在线观看| 蜜桃精品视频在线观看| 7777精品伊人久久久大香线蕉完整版| 亚洲人吸女人奶水| 91在线免费看| 亚洲天堂免费看| 91社区在线播放| 亚洲精品久久久久久国产精华液| av在线不卡电影| 国产精品天天摸av网| 国产成人鲁色资源国产91色综 | 一区二区三区小说| 色综合天天狠狠| 亚洲国产精品久久一线不卡| 欧美在线色视频| 午夜精品福利一区二区三区av | 91片在线免费观看| 夜夜揉揉日日人人青青一国产精品| caoporn国产一区二区| 亚洲欧美在线aaa| 在线视频一区二区三| 伊人夜夜躁av伊人久久| 欧美亚洲图片小说| 蜜臀av一区二区| 久久久亚洲精华液精华液精华液 | 成人av在线看| 樱桃视频在线观看一区| 欧美男男青年gay1069videost | 国产高清不卡一区| 亚洲视频一二三| 欧美日韩在线综合| 久久99九九99精品| 国产亚洲va综合人人澡精品| 一本久道久久综合中文字幕| 亚洲国产精品尤物yw在线观看| 欧美成人午夜电影| 91首页免费视频| 久久国产精品露脸对白| 亚洲欧洲日产国产综合网| 欧美高清激情brazzers| 国产福利91精品| 亚洲五码中文字幕| 国产欧美日韩精品在线| 欧美体内she精视频| 精品午夜久久福利影院| 一区二区三区四区av| 欧美精品一区二区三区很污很色的 | 激情综合一区二区三区| 久久久国产精品麻豆| 97久久超碰国产精品电影| 美女爽到高潮91| 中文字幕亚洲欧美在线不卡| 3d动漫精品啪啪1区2区免费| 成人黄色综合网站| 人妖欧美一区二区| 自拍偷拍亚洲欧美日韩| 26uuu久久天堂性欧美| 欧美曰成人黄网| 成人免费高清在线| 五月综合激情日本mⅴ| 中文字幕一区二区三区在线播放 | 国产乱码精品1区2区3区| 一区二区三区精品久久久| 26uuuu精品一区二区| 欧美人与禽zozo性伦| 91成人在线精品| 97se亚洲国产综合自在线| 黄色小说综合网站| 日韩成人午夜电影| 一区二区免费看| 一区二区三区免费网站| 综合久久国产九一剧情麻豆| 亚洲国产精品黑人久久久 | 高清不卡一区二区在线| 麻豆精品视频在线观看| 三级亚洲高清视频| 亚洲18影院在线观看| 亚洲一区中文日韩| 一区二区三区波多野结衣在线观看| 国产精品私人影院| 国产精品日韩成人| 国产精品视频看| 亚洲国产成人自拍| 国产精品视频九色porn| 国产亚洲一区二区三区在线观看 | 91欧美激情一区二区三区成人| 成人免费高清在线观看| 成人网页在线观看| www.性欧美| 一本久道中文字幕精品亚洲嫩| 色婷婷av一区二区三区软件| 99国产精品99久久久久久| 色欧美日韩亚洲| 欧美日韩另类国产亚洲欧美一级| 欧美日韩一区二区三区不卡| 欧美精品一卡两卡| 精品久久免费看| 国产片一区二区三区| 国产精品三级av在线播放| 亚洲精品乱码久久久久久久久| 亚洲国产va精品久久久不卡综合| 五月天中文字幕一区二区| 免费看黄色91| 国产69精品久久久久毛片| av综合在线播放| 欧美精品日韩精品| 2020国产成人综合网| 国产精品久久久久影院色老大 | 国产一区二区三区香蕉| 成人污污视频在线观看| 欧美影视一区在线| 欧美成人video| 中文字幕视频一区二区三区久| 亚洲精品国产一区二区三区四区在线| 亚洲福利一区二区三区| 久久99国内精品| 91美女在线看| 日韩欧美激情一区| 日韩毛片精品高清免费| 日韩不卡免费视频| 成人精品国产免费网站| 精品视频一区三区九区| 精品人伦一区二区色婷婷| 亚洲国产成人私人影院tom| 亚洲资源中文字幕| 国产a级毛片一区| 欧美日韩精品一区二区三区四区 | 欧美国产精品一区| 视频一区二区中文字幕| 不卡的电视剧免费网站有什么| 91麻豆精品国产| 专区另类欧美日韩| 国内外成人在线视频|