diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/network_server/common.c | 3 | ||||
-rw-r--r-- | examples/simple/rules.mk | 24 | ||||
-rw-r--r-- | examples/simple/simple.pb.c | 19 | ||||
-rw-r--r-- | examples/simple/simple.pb.h | 51 |
4 files changed, 3 insertions, 94 deletions
diff --git a/examples/network_server/common.c b/examples/network_server/common.c index 04a5aa8..05048f6 100644 --- a/examples/network_server/common.c +++ b/examples/network_server/common.c @@ -19,6 +19,9 @@ static bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count) int fd = (intptr_t)stream->state; int result; + if (count == 0) + return true; + result = recv(fd, buf, count, MSG_WAITALL); if (result == 0) diff --git a/examples/simple/rules.mk b/examples/simple/rules.mk deleted file mode 100644 index 1e4221d..0000000 --- a/examples/simple/rules.mk +++ /dev/null @@ -1,24 +0,0 @@ -NANOPB_DIR := external/nanopb-0.3.9.1-linux-x86 - -LOCAL_DIR := $(GET_LOCAL_DIR) - -MODULE := $(LOCAL_DIR) - -MODULE_SRCS += \ - $(LOCAL_DIR)/simple.c \ - $(LOCAL_DIR)/simple.pb.c \ - $(NANOPB_DIR)/pb_encode.c \ - $(NANOPB_DIR)/pb_decode.c \ - $(NANOPB_DIR)/pb_common.c - -MODULE_CPPFLAGS += -std=c++11 - -MODULE_INCLUDES += \ - $(NANOPB_DIR) - -$(LOCAL_DIR)/simple.pb.c: $(LOCAL_DIR)/simple.proto - $(PROTOC) $(PROTOC_OPTS) --nanopb_out=$(LOCAL_DIR) $(LOCAL_DIR)/simple.proto - -include $(NANOPB_DIR)/extra/nanopb.mk -include make/module.mk - diff --git a/examples/simple/simple.pb.c b/examples/simple/simple.pb.c deleted file mode 100644 index 481aa7d..0000000 --- a/examples/simple/simple.pb.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.9.1 at Fri May 25 16:28:54 2018. */ - -#include "simple.pb.h" - -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - -const pb_field_t SimpleMessage_fields[2] = { - PB_FIELD( 1, INT32 , REQUIRED, STATIC , FIRST, SimpleMessage, lucky_number, lucky_number, 0), - PB_LAST_FIELD -}; - - -/* @@protoc_insertion_point(eof) */ diff --git a/examples/simple/simple.pb.h b/examples/simple/simple.pb.h deleted file mode 100644 index f4614db..0000000 --- a/examples/simple/simple.pb.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.9.1 at Fri May 25 16:28:54 2018. */ - -#ifndef PB_SIMPLE_PB_H_INCLUDED -#define PB_SIMPLE_PB_H_INCLUDED -#include <pb.h> - -/* @@protoc_insertion_point(includes) */ -#if PB_PROTO_HEADER_VERSION != 30 -#error Regenerate this file with the current version of nanopb generator. -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Struct definitions */ -typedef struct _SimpleMessage { - int32_t lucky_number; -/* @@protoc_insertion_point(struct:SimpleMessage) */ -} SimpleMessage; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define SimpleMessage_init_default {0} -#define SimpleMessage_init_zero {0} - -/* Field tags (for use in manual encoding/decoding) */ -#define SimpleMessage_lucky_number_tag 1 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t SimpleMessage_fields[2]; - -/* Maximum encoded size of messages (where known) */ -#define SimpleMessage_size 11 - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define SIMPLE_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif |