net.sf.jqql.packets.out
Class SendSMSPacket
java.lang.Object
net.sf.jqql.packets.Packet
net.sf.jqql.packets.OutPacket
net.sf.jqql.packets.BasicOutPacket
net.sf.jqql.packets.out.SendSMSPacket
public class SendSMSPacket
- extends BasicOutPacket
send SMS request packet, format:
1. head
2. message sequence, 2 byte, begin with 0, used in spliting sending
3. unknown 2 bte, all 0
4. unknown 4 byte, all 0
5. sender's nick name, max length 13 byte, not long enough, fill 0 in the back.
6. unknown 1 byte, 0x01
7. if it's handsfree SMS, 0x20, other situation, 0x01
8. SMS content type, 1 byte
9. SMS content type number 4 byte
10. unknown 1 byte, 0x01
11. receiver's mobile count, 1 byte
12. mobile, 18 byte, not long enough, fill 0
13. unknown 2 byte
14. unknown 1 byte
15. If there are more mobiles, repeat part 12-14
Notice: part 12 -15 exist when part 11 is not 0
16. receiver's QQ number count, 1 byte
17. QQ number, 4 byte
18. If there more more QQ number, repeate part 17
Notice, part 17-18 exist when part 16 is not 0
19. unknown 1 byte, often 0x03
20. SMS byte length, 2 byte, If part 8 is not 0, this part is 0x0000
Notice, QQ SMS length plus sender nick name length should not exceed 58 chars, so we can ignore what QQ does. we
can send 86 byte.
发送短消息的请求包,格式为:
1. 包头
2. 消息序号,2字节,从0开始,用在拆分发送中
3. 未知2字节,全0
4. 未知4字节,全0
5. 发送者昵称,最长13个字节,如果不足,则后面为0
6. 未知的1字节,0x01
7. 如果是免提短信,0x20,其他情况,0x00
8. 短消息内容类型,1字节
9. 短消息内容类型编号,4字节
10. 未知的1字节,0x01
11. 接受者中的手机号码个数,1字节
12. 手机号码,18字节,不足的为0
13. 未知的2字节
14. 未知的1字节
15. 如果有更多手机号,重复12-14部分
注:12-15部分只在11部分不为0时存在
16. 接受者中的QQ号码个数,1字节
17. QQ号码,4字节
18. 如果有更多QQ号码,重复17部分
注:17-18部分只有在16部分不为0时存在
19. 未知1字节,一般是0x03
20. 短消息字节长度,2字节,如果8部分不为0,则此部分0x0000
注:QQ的短信和发送者昵称加起来不能超过58个字符(英文和汉字都算是一个字符),
昵称最长是13字节,所以最短也应该能发43个字符,所以可以考虑不按照QQ的做法,
我们可以尽量发满86个字节。
21. SMS byte array, message format:
if it's normal message, it's normal byte array.
If it has flashing char, use 0x01 to surround the bytes.
If the message is fragment of a long message, add a part of conent in front of message byte array. The content is:
[message sequence in string form, begin with 1] [0x2F] [ total message count in string form][0x0A]
Notice: part 21 exist only when part 20 is not 0.
22. tail
21. 短消息字节数组,消息的格式如下:
如果是普通的消息,则就是平常的字节数组而已
如果有些字符有闪烁,则那些字节要用0x01括起来
如果这条消息是一条长消息拆分而成的部分,则在消息字节数组前面要加一部分内容,这部分内容是
[消息序号的字符串形式,从1开始] [0x2F] [总消息条数的字符串形式] [0x0A]
注:21部分只有当20部分部位0时存在
22. 尾部
before use this packet, mesage content should be assembled
调用这个包时,message的内容必须是已经组装好的
- Author:
- luma
Fields inherited from class net.sf.jqql.packets.Packet |
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user |
Methods inherited from class net.sf.jqql.packets.BasicOutPacket |
decryptBody, encryptBody, getBodyBytes, getCryptographStart, getFamily, getHeadLength, getLength, getTailLength, parseHeader, parseTail, postFill, putHead, putTail, toString, validateHeader |
Methods inherited from class net.sf.jqql.packets.OutPacket |
dump, fill, getKey, getNextSeq, getSendCount, getTimeout, needAck, needResend, parseBody, setKey, setSendCount, setTimeout |
Methods inherited from class net.sf.jqql.packets.Packet |
equals, getCommand, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, setDuplicated, setHeader, setSequence |
SendSMSPacket
public SendSMSPacket(QQUser user)
- 创建SendSMSPacket
SendSMSPacket
public SendSMSPacket(ByteBuffer buf,
int length,
QQUser user)
throws PacketParseException
- Parameters:
buf
- length
-
- Throws:
PacketParseException
getPacketName
public String getPacketName()
- Overrides:
getPacketName
in class BasicOutPacket
- Returns:
- descriptive name of packet
包的描述性名称
putBody
protected void putBody(ByteBuffer buf)
- Description copied from class:
Packet
- initialize packet body
初始化包体
- Specified by:
putBody
in class Packet
- Parameters:
buf
- ByteBuffer
getContentId
public int getContentId()
- Returns:
- Returns the contentId.
setContentId
public void setContentId(int contentId)
- Parameters:
contentId
- The contentId to set.
getContentType
public byte getContentType()
- Returns:
- Returns the contentType.
setContentType
public void setContentType(byte contentType)
- Parameters:
contentType
- The contentType to set.
getMessage
public byte[] getMessage()
- Returns:
- Returns the message.
setMessage
public void setMessage(byte[] message)
- Parameters:
message
- The message to set.
getMessageSequence
public char getMessageSequence()
- Returns:
- Returns the messageSequence.
setMessageSequence
public void setMessageSequence(char messageSequence)
- Parameters:
messageSequence
- The messageSequence to set.
getSenderName
public String getSenderName()
- Returns:
- Returns the senderName.
setSenderName
public void setSenderName(String senderName)
- Parameters:
senderName
- The senderName to set.
getSendMode
public byte getSendMode()
- Returns:
- Returns the sendMode.
setSendMode
public void setSendMode(byte sendMode)
- Parameters:
sendMode
- The sendMode to set.
getReceiverMobile
public List<String> getReceiverMobile()
- Returns:
- Returns the receiverMobile.
setReceiverMobile
public void setReceiverMobile(List<String> receiverMobile)
- Parameters:
receiverMobile
- The receiverMobile to set.
getReceiverQQ
public List<Integer> getReceiverQQ()
- Returns:
- Returns the receiverQQ.
setReceiverQQ
public void setReceiverQQ(List<Integer> receiverQQ)
- Parameters:
receiverQQ
- The receiverQQ to set.