From 90025642ce97002910ace4654c64035bb91ad4a8 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 29 Apr 2020 23:48:37 +0800
Subject: [PATCH] update prj1_tlv source code, test socket client connect ok

---
 prj1_tlv/lylib/tags |  100 +++++++++++++++++++++++++++++--------------------
 1 files changed, 59 insertions(+), 41 deletions(-)

diff --git a/prj1_tlv/lylib/tags b/prj1_tlv/lylib/tags
index 6f6b962..1796b02 100644
--- a/prj1_tlv/lylib/tags
+++ b/prj1_tlv/lylib/tags
@@ -4,9 +4,8 @@
 !_TAG_PROGRAM_NAME	Exuberant Ctags	//
 !_TAG_PROGRAM_URL	http://ctags.sourceforge.net	/official site/
 !_TAG_PROGRAM_VERSION	5.9~svn20110310	//
-BUFSIZE	tlv_sample.c	21;"	d	file:
-CHARS_PER_LINE	logger.c	334;"	d	file:
-CHARS_PER_LINE	tlv_sample.c	156;"	d	file:
+CHARS_PER_LINE	logger.c	335;"	d	file:
+CHARS_PER_LINE	tlv_pack.c	102;"	d	file:
 CRC_ITU_T_H	crc-itu-t.h	14;"	d
 DBG_LOG_FILE	logger.h	35;"	d
 DEFAULT_TIME_FORMAT	logger.h	40;"	d
@@ -14,8 +13,8 @@
 FLAG_LOGGER_CONSOLE	logger.h	63;"	d
 FLAG_LOGGER_FILE	logger.h	64;"	d
 FLAG_LOGGER_LEVEL_OPT	logger.h	61;"	d
-LINELEN	logger.c	333;"	d	file:
-LINELEN	tlv_sample.c	155;"	d	file:
+LINELEN	logger.c	334;"	d	file:
+LINELEN	tlv_pack.c	101;"	d	file:
 LOG_FILE_LINE	logger.h	92;"	d
 LOG_LEVEL_DEBUG	logger.h	/^    LOG_LEVEL_DEBUG,                  \/*  Debug Level "Debug" *\/$/;"	e	enum:__anon1
 LOG_LEVEL_DISB	logger.h	/^    LOG_LEVEL_DISB = 0,               \/*  Disable "Debug" *\/$/;"	e	enum:__anon1
@@ -28,46 +27,47 @@
 LOG_LEVEL_WARN	logger.h	/^    LOG_LEVEL_WARN,                   \/*  Debug Level "warnning" *\/$/;"	e	enum:__anon1
 LOG_ROLLBACK_NONE	logger.h	38;"	d
 LOG_ROLLBACK_SIZE	logger.h	37;"	d
-LOG_TIME_FMT	logger.c	24;"	d	file:
+LOG_TIME_FMT	logger.c	25;"	d	file:
 LOG_VERSION_STR	logger.h	29;"	d
 MAGIC_CRC	crc-itu-t.h	16;"	d
 MAX_LOG_MESSAGE_LEN	logger.h	41;"	d
-OFF	tlv_sample.c	18;"	d	file:
-ON	tlv_sample.c	19;"	d	file:
-PACK_HEADER	tlv_sample.c	30;"	d	file:
+PACK_HEADER	tlv_pack.h	26;"	d
 PID_ASCII_SIZE	proc.h	18;"	d
 PRECISE_TIME_FACTOR	logger.c	16;"	d	file:
-TAG_CAMERA	tlv_sample.c	/^	TAG_CAMERA,$/;"	e	enum:__anon2	file:
-TAG_LED	tlv_sample.c	/^	TAG_LED,$/;"	e	enum:__anon2	file:
-TAG_LOGON	tlv_sample.c	/^	TAG_LOGON=1,$/;"	e	enum:__anon2	file:
-TLV_FIXED_SIZE	tlv_sample.c	41;"	d	file:
-TLV_MIN_SIZE	tlv_sample.c	44;"	d	file:
+TAG_ACK	tlv_pack.h	/^    TAG_ACK=1,$/;"	e	enum:__anon2
+TAG_SN	tlv_pack.h	/^    TAG_SN,$/;"	e	enum:__anon2
+TAG_TEMP	tlv_pack.h	/^    TAG_TEMP,$/;"	e	enum:__anon2
+TAG_TIME	tlv_pack.h	/^    TAG_TIME,$/;"	e	enum:__anon2
+TLV_BUFSIZE	tlv_pack.h	44;"	d
+TLV_FIXED_SIZE	tlv_pack.h	29;"	d
+TLV_MIN_SIZE	tlv_pack.h	32;"	d
+_DS18B20_H_	ds18b20.h	15;"	d
 _LOGGER_H_	logger.h	15;"	d
 _PROC_H_	proc.h	15;"	d
+_TLV_PACK_H_	tlv_pack.h	14;"	d
 _curOffset	logger.c	/^        long _curOffset = ftell(logger->fp);$/;"	l
 act	logger.c	/^    struct sigaction act;$/;"	l
 argp	logger.c	/^    va_list argp;$/;"	l
 args	proc.c	/^    va_list             args;$/;"	l
+buf	ds18b20.c	/^    char            buf[128];$/;"	l
 buf	logger.c	/^    char buf[MAX_LOG_MESSAGE_LEN];$/;"	l
-buf	tlv_sample.c	/^	char          buf[BUFSIZE];$/;"	l
-bytes	tlv_sample.c	/^	int           bytes;$/;"	l
+buf	tlv_pack.h	/^    char                   buf[TLV_BUFSIZE];$/;"	m	struct:tlv_buf_s	access:public
+byte	ds18b20.c	/^    uint8_t        *byte;$/;"	l
 bytes_to_ushort	crc-itu-t.c	/^unsigned short bytes_to_ushort(unsigned char *bytes, int len)$/;"	f	signature:(unsigned char *bytes, int len)
 bytes_to_ushort	crc-itu-t.h	/^extern unsigned short bytes_to_ushort(unsigned char *bytes, int len);$/;"	p	signature:(unsigned char *bytes, int len)
 c	logger.c	/^            unsigned char c = buf[idx];$/;"	l
-c	tlv_sample.c	/^            unsigned char c = data[idx];$/;"	l
+c	tlv_pack.c	/^            unsigned char c = data[idx];$/;"	l
 check_and_rollback	logger.c	/^static void check_and_rollback(void)$/;"	f	file:	signature:(void)
 check_daemon_running	proc.c	/^int check_daemon_running(const char *pid_file)$/;"	f	signature:(const char *pid_file)
 check_daemon_running	proc.h	/^extern int check_daemon_running(const char *pid_file);$/;"	p	signature:(const char *pid_file)
+chip	ds18b20.c	/^    char            chip[20];$/;"	l
 chmod	proc.c	/^        (void)chmod(ipc_dir, mode); $/;"	p	file:
 cmd	logger.c	/^            char cmd[512];$/;"	l
 cmd	proc.c	/^    char                cmd[256];$/;"	l
-cp_install_proc_signal	proc.c	/^void cp_install_proc_signal(void)$/;"	f	signature:(void)
-cp_install_proc_signal	proc.h	/^extern void cp_install_proc_signal(void);$/;"	p	signature:(void)
 cp_printout	logger.c	/^static void cp_printout(char *level, char *fmt, va_list argp)$/;"	f	file:	signature:(char *level, char *fmt, va_list argp)
 cp_printout_line	logger.c	/^static void cp_printout_line(char *level, char *fmt, char *file, int line, va_list argp)$/;"	f	file:	signature:(char *level, char *fmt, char *file, int line, va_list argp)
-cp_proc_sighandler	proc.c	/^void cp_proc_sighandler(int sig)$/;"	f	signature:(int sig)
-crc16	tlv_sample.c	/^	unsigned short      crc16 = 0;$/;"	l
-crc16	tlv_sample.c	/^	unsigned short      crc16;$/;"	l
+crc16	tlv_pack.c	/^	unsigned short      crc16 = 0;$/;"	l
+crc16	tlv_pack.c	/^	unsigned short      crc16;$/;"	l
 crc_itu_t	crc-itu-t.c	/^unsigned short crc_itu_t(unsigned short crc, const unsigned char *buffer, unsigned int len)$/;"	f	signature:(unsigned short crc, const unsigned char *buffer, unsigned int len)
 crc_itu_t	crc-itu-t.h	/^extern unsigned short crc_itu_t(unsigned short magic_crc, const unsigned char *buffer, unsigned int len);$/;"	p	signature:(unsigned short magic_crc, const unsigned char *buffer, unsigned int len)
 crc_itu_t_byte	crc-itu-t.h	/^static inline unsigned short crc_itu_t_byte(unsigned short crc, const unsigned char data)$/;"	f	signature:(unsigned short crc, const unsigned char data)
@@ -75,10 +75,13 @@
 crc_itu_t_table	crc-itu-t.h	/^extern const unsigned short  crc_itu_t_table[256];$/;"	x
 daemonize	proc.c	/^void daemonize(int nochdir, int noclose)$/;"	f	signature:(int nochdir, int noclose)
 daemonize	proc.h	/^extern void daemonize(int nochdir, int noclose);$/;"	p	signature:(int nochdir, int noclose)
-data_len	tlv_sample.c	/^	int                 data_len = 0;$/;"	l
+direntp	ds18b20.c	/^    struct dirent  *direntp;$/;"	l
+dirp	ds18b20.c	/^    DIR            *dirp;$/;"	l
 done	proc.c	/^    int                 done; $/;"	l
-dump_buf	tlv_sample.c	/^void dump_buf(char *data, int len)$/;"	f	signature:(char *data, int len)
-dump_buf	tlv_sample.c	/^void dump_buf(char *data, int len);$/;"	p	file:	signature:(char *data, int len)
+ds18b20_get_temperature	ds18b20.c	/^int ds18b20_get_temperature(uint16_t *temp)$/;"	f	signature:(uint16_t *temp)
+ds18b20_get_temperature	ds18b20.h	/^int ds18b20_get_temperature(uint16_t *temp);$/;"	p	signature:(uint16_t *temp)
+dump_buf	tlv_pack.c	/^void dump_buf(char *data, int len)$/;"	f	signature:(char *data, int len)
+dump_buf	tlv_pack.h	/^void dump_buf(char *data, int len);$/;"	p	signature:(char *data, int len)
 exec_system_cmd	proc.c	/^void exec_system_cmd(const char *format, ...)$/;"	f	signature:(const char *format, ...)
 exec_system_cmd	proc.h	/^extern void exec_system_cmd(const char *format, ...);$/;"	p	signature:(const char *format, ...)
 f	proc.c	/^    FILE *f; $/;"	l
@@ -86,31 +89,36 @@
 fStatBuf	proc.c	/^    struct stat fStatBuf; $/;"	l
 fStatBuf	proc.c	/^    struct stat fStatBuf;$/;"	l
 fclose	proc.c	/^        (void)fclose(f); $/;"	p	file:
+fd	ds18b20.c	/^    int             fd =-1;$/;"	l
 fd	proc.c	/^    int fd = -1; $/;"	l
 fd	proc.c	/^    int retval, fd; $/;"	l
 fgets	proc.c	/^        (void)fgets(pid_ascii, PID_ASCII_SIZE, f); $/;"	p	file:
 file	logger.h	/^    char               file[FILENAME_LEN];$/;"	m	struct:logger_s	access:public
 filemode	logger.c	/^    char *filemode;$/;"	l
 flag	logger.h	/^    unsigned char      flag;$/;"	m	struct:logger_s	access:public
+found	ds18b20.c	/^    int             found = 0;$/;"	l
 fp	logger.h	/^    FILE               *fp;$/;"	m	struct:logger_s	access:public
 g_signal	proc.c	/^proc_signal_t     g_signal={0};$/;"	v
 g_signal	proc.h	/^extern proc_signal_t     g_signal;$/;"	x
 get_daemon_pid	proc.c	/^pid_t get_daemon_pid(const char *pid_file)$/;"	f	signature:(const char *pid_file)
 get_daemon_pid	proc.h	/^extern pid_t get_daemon_pid(const char *pid_file);$/;"	p	signature:(const char *pid_file)
 hc	logger.c	/^    char hc[4];$/;"	l
-hc	tlv_sample.c	/^    char hc[4];$/;"	l
+hc	tlv_pack.c	/^    char hc[4];$/;"	l
 i	crc-itu-t.c	/^    int              i = 0;$/;"	l
 i	crc-itu-t.c	/^    int            i = 0;$/;"	l
 i	proc.c	/^    int i; $/;"	l
 idx	logger.c	/^    int idx;$/;"	l
-idx	tlv_sample.c	/^    int idx;$/;"	l
+idx	tlv_pack.c	/^    int idx;$/;"	l
+install_proc_signal	proc.c	/^void install_proc_signal(void)$/;"	f	signature:(void)
+install_proc_signal	proc.h	/^extern void install_proc_signal(void);$/;"	p	signature:(void)
 ipc_dir	proc.c	/^    char ipc_dir[64] = { 0 }; $/;"	l
 ldx	logger.c	/^        int ldx = idx % CHARS_PER_LINE;$/;"	l
+len	tlv_pack.h	/^    int                    len;$/;"	m	struct:tlv_buf_s	access:public
 level	logger.h	/^    int                level;$/;"	m	struct:logger_s	access:public
 line_done	logger.c	/^    short line_done = 1;$/;"	l
-line_done	tlv_sample.c	/^    short line_done = 1;$/;"	l
+line_done	tlv_pack.c	/^    short line_done = 1;$/;"	l
 lit	logger.c	/^    char lit[CHARS_PER_LINE + 2];$/;"	l
-lit	tlv_sample.c	/^    char lit[CHARS_PER_LINE + 1];$/;"	l
+lit	tlv_pack.c	/^    char lit[CHARS_PER_LINE + 1];$/;"	l
 local	logger.c	/^    struct tm *local;$/;"	l
 log_dbg	logger.h	105;"	d
 log_dbg	logger.h	97;"	d
@@ -160,33 +168,37 @@
 logger_t	logger.h	/^} logger_t;$/;"	t	typeref:struct:logger_s
 logger_term	logger.c	/^void logger_term(void)$/;"	f	signature:(void)
 logger_term	logger.h	/^extern void logger_term(void);$/;"	p	signature:(void)
-main	tlv_sample.c	/^int main(int argc, char **argv)$/;"	f	signature:(int argc, char **argv)
 mode	proc.c	/^    int mode = S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP | S_IRWXU;$/;"	l
 now	logger.c	/^    struct timeval now;$/;"	l
-ofset	tlv_sample.c	/^	int                 ofset = 0; \/* index position for the buf *\/$/;"	l
-pack_len	tlv_sample.c	/^	int                 pack_len = 0;$/;"	l
-pack_len	tlv_sample.c	/^	int                 pack_len = TLV_FIXED_SIZE+1; \/* Only 1 byte data *\/$/;"	l
-packtlv_led	tlv_sample.c	/^int packtlv_led(char *buf, int size, int cmd)$/;"	f	signature:(char *buf, int size, int cmd)
-packtlv_led	tlv_sample.c	/^int packtlv_led(char *buf, int size, int cmd);$/;"	p	file:	signature:(char *buf, int size, int cmd)
-packtlv_logon	tlv_sample.c	/^int packtlv_logon(char *buf, int size, char *pwd)$/;"	f	signature:(char *buf, int size, char *pwd)
-packtlv_logon	tlv_sample.c	/^int packtlv_logon(char *buf, int size, char *pwd);$/;"	p	file:	signature:(char *buf, int size, char *pwd)
+ofset	tlv_pack.c	/^	int                 ofset = 0; \/* index position for the buf *\/$/;"	l
+pack_len	tlv_pack.c	/^	int                 pack_len = 0;$/;"	l
+pack_len	tlv_pack.c	/^	int                 pack_len = TLV_FIXED_SIZE+1; \/* Only 1 byte data *\/$/;"	l
+packtlv_ack	tlv_pack.c	/^int packtlv_ack(char *buf, int size, int ack)$/;"	f	signature:(char *buf, int size, int ack)
+packtlv_ack	tlv_pack.h	/^int packtlv_ack (char *buf, int size, int ack);$/;"	p	signature:(char *buf, int size, int ack)
+packtlv_led	tlv_pack.c	/^int packtlv_led(char *buf, int size, int cmd)$/;"	f	signature:(char *buf, int size, int cmd)
+packtlv_msg	tlv_pack.h	/^int packtlv_msg(tlv_buf_t *tlv, char *sn, uint16_t temp, struct tm *tm);$/;"	p	signature:(tlv_buf_t *tlv, char *sn, uint16_t temp, struct tm *tm)
+packtlv_sn	tlv_pack.h	/^int packtlv_sn  (char *buf, int size, char *sn);$/;"	p	signature:(char *buf, int size, char *sn)
+packtlv_temp	tlv_pack.h	/^int packtlv_temp(char *buf, int size, uint16_t temp);$/;"	p	signature:(char *buf, int size, uint16_t temp)
+packtlv_time	tlv_pack.h	/^int packtlv_time(char *buf, int size, struct tm *tm);$/;"	p	signature:(char *buf, int size, struct tm *tm)
 pid	proc.c	/^        char pid[PID_ASCII_SIZE]; $/;"	l
 pid	proc.c	/^        pid_t pid = -1; $/;"	l
 pid	proc.c	/^    pid_t            pid = -1; $/;"	l
 pid	proc.c	/^    pid_t pid; $/;"	l
 pid_ascii	proc.c	/^        char pid_ascii[PID_ASCII_SIZE]; $/;"	l
 print_char	logger.c	/^static char *print_char =$/;"	v	file:
-print_char	tlv_sample.c	/^static char *print_char =$/;"	v	file:
+print_char	tlv_pack.c	/^static char *print_char =$/;"	v	file:
 prn	logger.c	/^    char prn[LINELEN];$/;"	l
-prn	tlv_sample.c	/^    char prn[LINELEN];$/;"	l
+prn	tlv_pack.c	/^    char prn[LINELEN];$/;"	l
+proc_sighandler	proc.c	/^void proc_sighandler(int sig)$/;"	f	signature:(int sig)
 proc_signal_s	proc.h	/^typedef struct proc_signal_s$/;"	s
 proc_signal_s::signal	proc.h	/^    int       signal;$/;"	m	struct:proc_signal_s	access:public
 proc_signal_s::stop	proc.h	/^    unsigned  stop;     \/* 0: Not term  1: Stop  *\/$/;"	m	struct:proc_signal_s	access:public
 proc_signal_s::threads	proc.h	/^    int       threads;  \/* threads counter *\/$/;"	m	struct:proc_signal_s	access:public
 proc_signal_t	proc.h	/^}  proc_signal_t;$/;"	t	typeref:struct:proc_signal_s
+ptr	ds18b20.c	/^    char           *ptr;$/;"	l
 rc	logger.c	/^    int rc = 0;$/;"	l
 rc	logger.c	/^    int rc;$/;"	l
-rc	tlv_sample.c	/^    int rc;$/;"	l
+rc	tlv_pack.c	/^    int rc;$/;"	l
 record_daemon_pid	proc.c	/^int record_daemon_pid(const char *pid_file)$/;"	f	signature:(const char *pid_file)
 record_daemon_pid	proc.h	/^extern int record_daemon_pid(const char *pid_file);$/;"	p	signature:(const char *pid_file)
 retVal	proc.c	/^    int retVal = -1; $/;"	l
@@ -203,13 +215,19 @@
 stop_daemon_running	proc.c	/^int stop_daemon_running(const char *pid_file)$/;"	f	signature:(const char *pid_file)
 stop_daemon_running	proc.h	/^extern int stop_daemon_running(const char *pid_file);$/;"	p	signature:(const char *pid_file)
 thread_attr	proc.c	/^    pthread_attr_t thread_attr; $/;"	l
-thread_body	proc.h	/^typedef void *(* thread_body) (void *thread_arg);$/;"	t
+thread_body	proc.h	/^typedef void *(* thread_body)(void *thread_arg);$/;"	t
 thread_start	proc.c	/^int thread_start(pthread_t * thread_id, thread_body worker_func, void *thread_arg)$/;"	f	signature:(pthread_t * thread_id, thread_body worker_func, void *thread_arg)
 thread_start	proc.h	/^extern int thread_start(pthread_t * thread_id, thread_body worker_func, void *thread_arg);$/;"	p	signature:(pthread_t * thread_id, thread_body worker_func, void *thread_arg)
 thread_stop	proc.c	/^void thread_stop(char *prompt)$/;"	f	signature:(char *prompt)
 thread_stop	proc.h	/^extern void thread_stop(char *prompt);$/;"	p	signature:(char *prompt)
 threads	proc.h	/^    int       threads;  \/* threads counter *\/$/;"	m	struct:proc_signal_s	access:public
 timestr	logger.c	/^    char timestr[256];$/;"	l
+tlv_buf_s	tlv_pack.h	/^typedef struct tlv_buf_s $/;"	s
+tlv_buf_s::buf	tlv_pack.h	/^    char                   buf[TLV_BUFSIZE];$/;"	m	struct:tlv_buf_s	access:public
+tlv_buf_s::len	tlv_pack.h	/^    int                    len;$/;"	m	struct:tlv_buf_s	access:public
+tlv_buf_t	tlv_pack.h	/^} tlv_buf_t;  $/;"	t	typeref:struct:tlv_buf_s
 ushort_to_bytes	crc-itu-t.c	/^int ushort_to_bytes(unsigned char *bytes, unsigned short val)$/;"	f	signature:(unsigned char *bytes, unsigned short val)
 ushort_to_bytes	crc-itu-t.h	/^extern int ushort_to_bytes(unsigned char *bytes, unsigned short val);$/;"	p	signature:(unsigned char *bytes, unsigned short val)
 val	crc-itu-t.c	/^    unsigned short val = 0;$/;"	l
+value	ds18b20.c	/^    float           value;$/;"	l
+w1_path	ds18b20.c	/^    char            w1_path[50] = "\/sys\/bus\/w1\/devices\/";$/;"	l

--
Gitblit v1.9.1