github.com/Mrs4s/MiraiGo@v0.0.0-20240226124653-54bdd873e3fe/internal/tlv/t1f.go (about)

     1  package tlv
     2  
     3  import "github.com/Mrs4s/MiraiGo/binary"
     4  
     5  func T1F(isRoot bool, osName, osVersion, simOperatorName, apn []byte, networkType uint16) []byte {
     6  	return binary.NewWriterF(func(w *binary.Writer) {
     7  		w.WriteUInt16(0x1F)
     8  		pos := w.FillUInt16()
     9  		w.WriteBool(isRoot)
    10  		w.WriteBytesShort(osName)
    11  		w.WriteBytesShort(osVersion)
    12  		w.WriteUInt16(networkType)
    13  		w.WriteBytesShort(simOperatorName)
    14  		w.WriteUInt16(0) // w.WriteBytesShort([]byte{})
    15  		w.WriteBytesShort(apn)
    16  		w.WriteUInt16At(pos, uint16(w.Len()-4))
    17  	})
    18  }