BK.TLV [Tag][Length][Value]
构造函数
new BK.TLV(n)
返回值:
类型 | 名称 | 备注 |
---|---|---|
Object | BK.TLV |
例子:
new BK.TLV(buff)
返回值:
类型 | 名称 | 备注 |
---|---|---|
Object | BK.TLV |
例子:
解析 bkJSParseTLV() / parseTLV()
返回值:
例子:
从tlv中取出buff bkJSTLVGetBuffer() / getBuffer()
参数:无
返回值:
类型 | 名称 | 备注 |
---|---|---|
Object | BK.Buffer对象 |
var recvBuffer = sendTlv.bkJSTLVGetBuffer();
获取tlv长度 bkJSTLVGetLength() / getLength()
参数:无
返回值:
例子:
写数据
使用方法和相似
- bkJSTLVWriteInt8 / writeInt8
- bkJSTLVWriteInt16 / writeInt16
- bkJSTLVWriteInt32 / writeInt32
- bkJSTLVWriteUInt8 / writeUInt8
- bkJSTLVWriteUInt16 / writeUInt16
- bkJSTLVWriteUInt32 / writeUInt32
- bkJSTLVWriteUInt64 / writeUInt64
- bkJSTLVWriteFloat / writeFloat
- bkJSTLVWriteDouble / writeDouble
- bkJSTLVWriteBuffer / writeBuffer
TLV支持的类型:
TLVType = {
Int8 : 0x21,
Uint8 : 0x22,
Int16 : 0x21,
Uint16 : 0x24,
Int32 : 0x25,
Uint32 : 0x26,
Byte : 0x29,
Double : 0x2a,
Float : 0x2b,
Int8Repeated : 0x31,
Uint8Repeated : 0x32,
Int16Repeated : 0x33,
Uint16Repeated : 0x34,
Uint32Repeated : 0x36,
Int64Repeated : 0x37,
Uint64Repeated : 0x38,
ByteRepeated : 0x39,
DoubleRepeated : 0x3a,
FloatRepeated : 0x3b
}