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对象
    1. 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支持的类型:

    1. TLVType = {
    2. Int8 : 0x21,
    3. Uint8 : 0x22,
    4. Int16 : 0x21,
    5. Uint16 : 0x24,
    6. Int32 : 0x25,
    7. Uint32 : 0x26,
    8. Byte : 0x29,
    9. Double : 0x2a,
    10. Float : 0x2b,
    11. Int8Repeated : 0x31,
    12. Uint8Repeated : 0x32,
    13. Int16Repeated : 0x33,
    14. Uint16Repeated : 0x34,
    15. Uint32Repeated : 0x36,
    16. Int64Repeated : 0x37,
    17. Uint64Repeated : 0x38,
    18. ByteRepeated : 0x39,
    19. DoubleRepeated : 0x3a,
    20. FloatRepeated : 0x3b
    21. }

    TLV作为数据发送 / 接收: