github.com/LagrangeDev/LagrangeGo@v0.0.0-20240512064304-ad4a85e10cb4/client/packets/tlv/qrcode.go (about)

     1  package tlv
     2  
     3  import (
     4  	"github.com/LagrangeDev/LagrangeGo/internal/proto"
     5  	"github.com/LagrangeDev/LagrangeGo/utils/binary"
     6  )
     7  
     8  func T11(unusualSign []byte) []byte {
     9  	return binary.NewBuilder(nil).
    10  		WriteBytes(unusualSign).
    11  		Pack(0x11)
    12  }
    13  
    14  func T16(appid, subAppid int, guid []byte, ptVersion, packageName string) []byte {
    15  	return binary.NewBuilder(nil).
    16  		WriteU32(0).
    17  		WriteU32(uint32(appid)).
    18  		WriteU32(uint32(subAppid)).
    19  		WriteBytes(guid).
    20  		WritePacketString(packageName, "u16", false).
    21  		WritePacketString(ptVersion, "u16", false).
    22  		WritePacketString(packageName, "u16", false).
    23  		Pack(0x16)
    24  }
    25  
    26  func T1b() []byte {
    27  	return binary.NewBuilder(nil).
    28  		WriteStruct(uint32(0), uint32(0), uint32(3), uint32(4), uint32(72), uint32(2), uint32(2), uint16(0)).
    29  		Pack(0x1B)
    30  }
    31  
    32  func T1d(miscBitmap int) []byte {
    33  	return binary.NewBuilder(nil).
    34  		WriteU8(1).
    35  		WriteU32(uint32(miscBitmap)).
    36  		WriteU32(0).
    37  		WriteU8(0).
    38  		Pack(0x1d)
    39  }
    40  
    41  func T33(guid []byte) []byte {
    42  	return binary.NewBuilder(nil).WriteBytes(guid).Pack(0x33)
    43  }
    44  
    45  func T35(PtOSVersion int) []byte {
    46  	return binary.NewBuilder(nil).WriteU32(uint32(PtOSVersion)).Pack(0x35)
    47  }
    48  
    49  func T66(PtOSVersion int) []byte {
    50  	return binary.NewBuilder(nil).WriteU32(uint32(PtOSVersion)).Pack(0x66)
    51  }
    52  
    53  func Td1(AppOS, DeviceName string) []byte {
    54  	return binary.NewBuilder(nil).
    55  		WriteBytes(proto.DynamicMessage{
    56  			1: proto.DynamicMessage{
    57  				1: AppOS,
    58  				2: DeviceName,
    59  			},
    60  			4: proto.DynamicMessage{
    61  				6: 1,
    62  			},
    63  		}.Encode()).
    64  		Pack(0xd1)
    65  }