JML

net.sf.jqql.packets.in
Class WeatherOpReplyPacket

java.lang.Object
  extended by net.sf.jqql.packets.Packet
      extended by net.sf.jqql.packets.InPacket
          extended by net.sf.jqql.packets.BasicInPacket
              extended by net.sf.jqql.packets.in.WeatherOpReplyPacket

public class WeatherOpReplyPacket
extends BasicInPacket

 reply packet of weather operate
 1. header
 2. subcommand, 1 byte
 3. reply code, 1 byte
 4. byte length of province name, 1 byte
 5. province
 6. byte length of city name, 1 byte
 7. city
 Note: if part 4 is 0, can consider that tencent can find weather forecast message you wanted, don't parse follow
 8. unknown 2 byte
 9. byte length of city(2) name, 1 byte
 10. city(2)
 Note: I don't understand why have two cities, these two cities sometimes all have content, sometimes only one have content
       should be note each condition
 11. number of forecast days, 1 byte, if 72 hours forecast, it's 0x03
 12. time, 4 byte, beginning time of weather date
 13. byte length of weather condition, 1 byte
 14. weather condition
 15. byte length of wind direction, 1 byte
 16. wind direction
 17. minimum temperature, 2 byte, unit is degree Celsius
 18. maximum temperature, 2 byte, unit is degree Celsius
 19. unknown 1 byte
 20. tips byte length, 1 byte
 21. tips
 22. if has more data, repeat part 12-21
 23. unknown 2 byte
 24. tail

 天气操作回复包
 1. 头部
 2. 子命令,1字节
 3. 回复码,1字节
 4. 省名称字节长度,1字节
 5. 省
 6. 市名称字节长度,1字节
 7. 市
 Note: 如果4部分为0,则可以认为腾讯无法找到你要的天气预报信息,不应再往下解析
 8. 未知的2字节
 9. 市(2)名称字节长度,1字节
 10. 市(2)
 Note: 不明白为什么有两个市,这两个市有时候都有内容,有时候只有一个,要注意各种情况
 11. 预报的天数,1字节,如果72小时预报,这个就是0x03
 12. 时间,4字节,天气数据的开始时间
 13. 天气情况字节长度,1字节
 14. 天气情况
 15. 风向字节长度,1字节
 16. 风向
 17. 最低温度,2字节,单位是摄氏度
 18. 最高温度,2字节,单位是摄氏度
 Note: 要注意温度为零下时,是负数,用java处理时要注意转换
 19. 未知的1字节
 20. 提示字节长度,1字节
 21. 提示
 22. 如果还有更多数据,重复12-21部分
 23. 未知的2字节
 24. 尾部
 

Author:
luma

Field Summary
 String city
           
 String province
           
 byte replyCode
           
 byte subCommand
           
 List<Weather> weathers
           
 
Fields inherited from class net.sf.jqql.packets.Packet
bodyBuf, bodyDecrypted, command, crypter, ds, duplicated, header, log, sequence, source, user
 
Constructor Summary
WeatherOpReplyPacket(ByteBuffer buf, int length, QQUser user)
           
 
Method Summary
protected  void parseBody(ByteBuffer buf)
          parse packet body, from begin position of buf 解析包体,从buf的开头位置解析起
 
Methods inherited from class net.sf.jqql.packets.BasicInPacket
decryptBody, encryptBody, getBodyBytes, getCryptographStart, getFamily, getHeadLength, getLength, getPacketName, getTailLength, parseHeader, parseTail, putBody, putHead, putTail, toString
 
Methods inherited from class net.sf.jqql.packets.InPacket
validateHeader
 
Methods inherited from class net.sf.jqql.packets.Packet
dump, equals, getCommand, getHeader, getSequence, getSource, hash, hashCode, isDuplicated, setDuplicated, setHeader, setSequence
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

subCommand

public byte subCommand

replyCode

public byte replyCode

province

public String province

city

public String city

weathers

public List<Weather> weathers
Constructor Detail

WeatherOpReplyPacket

public WeatherOpReplyPacket(ByteBuffer buf,
                            int length,
                            QQUser user)
                     throws PacketParseException
Throws:
PacketParseException
Method Detail

parseBody

protected void parseBody(ByteBuffer buf)
                  throws PacketParseException
Description copied from class: Packet
parse packet body, from begin position of buf 解析包体,从buf的开头位置解析起

Specified by:
parseBody in class Packet
Parameters:
buf - ByteBuffer
Throws:
PacketParseException - if parse error 如果解析出错

JML