예제 #1
0
  public void parsePacketInfo(byte[] data) {

    PacketInfo p = new PacketInfo();
    int offset = 0;

    p.setPacket_len(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_no(Tools.byteToInteger(data, offset, 4));
    offset += 4;

    p.setPacket_address(Tools.formatIp6Address(Tools.byteToHexString(data, offset, 16)));
    offset += 16;

    p.setPacket_channel(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_network_id(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_link_quality(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    Integer rssi = Tools.byteToInteger(data, offset, 2);
    p.setPacket_rssi(rssi.shortValue());
    offset += 2;

    p.setPacket_timestamp(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_txpower(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_listen_time(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_transmit_time(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_max_transmission(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_mac_squno(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    p.setPacket_mac_ack(Tools.byteToInteger(data, offset, 2));
    offset += 2;

    if (offset != data.length) {
      logger.warn("get unknow format data");
      return;
    }
    DBManager.savePacketInfo(p);
    data = null;
  }