From 47579e3790b1ee5a1ad2ce35ea6028cd9ddf6ea0 Mon Sep 17 00:00:00 2001 From: GuoWenxue <“guowenxue@gmail.com”> Date: Fri, 29 Apr 2022 09:23:27 +0800 Subject: [PATCH] update client_main.c to use packet_segmented_pack --- apue/project_socket/src/packet.h | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/apue/project_socket/src/packet.h b/apue/project_socket/src/packet.h index 1c18b84..e70147d 100644 --- a/apue/project_socket/src/packet.h +++ b/apue/project_socket/src/packet.h @@ -54,6 +54,17 @@ * $size : packet output buffer size * return value: <0: failure >0: packet bytes */ -extern int packet_string_pack(pack_info_t *pack_info, char *pack_buf, int size); +extern int packet_segmented_pack(pack_info_t *pack_info, char *pack_buf, int size); + + +/* description: package a json string packet: {"devid":"xxx", "time":"xxx", "temperature":"xxx"} + * input args: + * $pack_info: packet data contains devid, time and temperature + * $pack_buf : packet output buffer + * $size : packet output buffer size + * return value: <0: failure >0: packet bytes + */ +extern int packet_json_pack(pack_info_t *pack_info, char *pack_buf, int size); + #endif /* ----- #ifndef _PACKET_H_ ----- */ -- Gitblit v1.9.1