func (pkt *SubAckPacket) WriteTo(w io.Writer, version byte) (n int, err error) {
	var d int
	n, err = pkt.Header().WriteTo(w)
	if err != nil {
		return
	}
	d, err = writeInt(w, pkt.ID)
	n += d
	if err != nil {
		return
	}
	for _, qos := range pkt.Granted {

		if version == 2 && qos == 0x80 {
			// Version 2 does not have failure indication
			qos = 0
		}

		d, err = w.Write([]byte{qos})
		n += d
		if err != nil {
			return
		}
	}
	return
}
// WriteTo writes the packet to the io.Writer.
WriteTo writes the packet to the io.Writer.
// WriteTo writes the packet to the io . Writer .
func (pkt *SubAckPacket) WriteTo(w io.Writer, version byte) (n int, err error) {
	var d int
	n, err = pkt.Header().WriteTo(w)
	if err != nil {
		return
	}
	d, err = writeInt(w, pkt.ID)
	n += d
	if err != nil {
		return
	}
	for _, qos := range pkt.Granted {
		if version == 2 && qos == 0x80 {
			qos = 0
		}
		d, err = w.Write([]byte{qos})
		n += d
		if err != nil {
			return
		}
	}
	return
}
func ( pkt * SubAckPacket ) WriteTo ( w io . Writer , version byte ) ( n int , err error ) { var d int n , err = pkt . Header ( ) . WriteTo ( w ) if err != nil { return } d , err = writeInt ( w , pkt . ID ) n += d if err != nil { return } for _ , qos := range pkt . Granted { if version == 2 && qos == 0x80 { qos = 0 } d , err = w . Write ( [ ] byte { qos } ) n += d if err != nil { return } } return }
WriteTo writes the packet to the io.Writer.
WriteTo writes the packet to the io . Writer .
// Version 2 does not have failure indication