mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-05 03:23:50 +08:00
update tlv.
This commit is contained in:
parent
d87c354649
commit
a1d72e772a
19
protocol/tlv/t1b.go
Normal file
19
protocol/tlv/t1b.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package tlv
|
||||||
|
|
||||||
|
import "github.com/Mrs4s/MiraiGo/binary"
|
||||||
|
|
||||||
|
func T1B(micro, version, size, margin, dpi, ecLevel, hint uint32) []byte {
|
||||||
|
return binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteUInt16(0x1B)
|
||||||
|
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteUInt32(micro)
|
||||||
|
w.WriteUInt32(version)
|
||||||
|
w.WriteUInt32(size)
|
||||||
|
w.WriteUInt32(margin)
|
||||||
|
w.WriteUInt32(dpi)
|
||||||
|
w.WriteUInt32(ecLevel)
|
||||||
|
w.WriteUInt32(hint)
|
||||||
|
w.WriteUInt16(0)
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
16
protocol/tlv/t1d.go
Normal file
16
protocol/tlv/t1d.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package tlv
|
||||||
|
|
||||||
|
import "github.com/Mrs4s/MiraiGo/binary"
|
||||||
|
|
||||||
|
func T1D(miscBitmap uint32) []byte {
|
||||||
|
return binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteUInt16(0x1D)
|
||||||
|
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteByte(1)
|
||||||
|
w.WriteUInt32(miscBitmap)
|
||||||
|
w.WriteUInt32(0)
|
||||||
|
w.WriteByte(0)
|
||||||
|
w.WriteUInt32(0)
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
24
protocol/tlv/t1f.go
Normal file
24
protocol/tlv/t1f.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package tlv
|
||||||
|
|
||||||
|
import "github.com/Mrs4s/MiraiGo/binary"
|
||||||
|
|
||||||
|
func T1F(isRoot bool, osName, osVersion, simOperatorName, apn []byte, networkType uint16) []byte {
|
||||||
|
return binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteUInt16(0x1F)
|
||||||
|
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteByte(func() byte {
|
||||||
|
if isRoot {
|
||||||
|
return 1
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}())
|
||||||
|
w.WriteTlv(osName)
|
||||||
|
w.WriteTlv(osVersion)
|
||||||
|
w.WriteUInt16(networkType)
|
||||||
|
w.WriteTlv(simOperatorName)
|
||||||
|
w.WriteTlv([]byte{})
|
||||||
|
w.WriteTlv(apn)
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
10
protocol/tlv/t33.go
Normal file
10
protocol/tlv/t33.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package tlv
|
||||||
|
|
||||||
|
import "github.com/Mrs4s/MiraiGo/binary"
|
||||||
|
|
||||||
|
func T33(guid []byte) []byte {
|
||||||
|
return binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteUInt16(0x33)
|
||||||
|
w.WriteTlv(guid)
|
||||||
|
})
|
||||||
|
}
|
12
protocol/tlv/t35.go
Normal file
12
protocol/tlv/t35.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package tlv
|
||||||
|
|
||||||
|
import "github.com/Mrs4s/MiraiGo/binary"
|
||||||
|
|
||||||
|
func T35(productType uint32) []byte {
|
||||||
|
return binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteUInt16(0x35)
|
||||||
|
w.WriteTlv(binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.WriteUInt32(productType)
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user