guowenxue
2021-01-23 8fee9f5701ffdcc17e1f0f2453d495fe849d1fe2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*********************************************************************************
 *      Copyright:  (C) 2018 LingYun IoT System Studio
 *                  All rights reserved.
 *
 *       Filename:  tlv.h
 *    Description:  This file is TLV(Tag Length Value) protocal head file
 *                 
 *        Version:  1.0.0(2018/10/14)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "2018/10/14 12:13:26"
 *                 
 ********************************************************************************/
 
#ifndef __TLV_H_
#define __TLV_H_
 
 
/*+-----------------------------------------------+ 
 *| TLV Format:  Tag(1B) Length(1B) Value(2B)     | 
 *+-----------------------------------------------+*/
 
 
/*TLV Format Tag definition */
enum
{
           TAG_TEMP = 1,  /* Temperature */
           TAG_HUMI,      /* Relative Humidity */
           TAG_DOOR,      /* Door open status */
 
    TAG_NAK=0xFD,  /* NAK packet */
    TAG_ACK=0xFE,  /* ACK packet */
};
 
void tlv_dump_buf(const char *prompt, char *buf, int size);
 
int tlv_pack_ack(char *buf, int size);
 
int tlv_pack_nak(char *buf, int size);
 
 
#endif