Hello (Petteri),
I am trying to make a simple project that sends an int to the server and the server does an operation on that int (ex: the modulo 2 [%2]) and returns the answer as an int.
I am basically trying to make something in between the simple example and the network example.
The issue I am having is that the simple example doesn't have a server and client and the network example add some extra features (looking into directories, getting paths etc) which makes it harder to break down, also I can't find when the ListFilesResponse_callback is called.
Once I manage it I would be happy to publish it (and maybe even add it to your project if you find it useful).
Environment :
Raspberry 3 model B+
OS Raspbian 10.2.1-6+rpi1
Gcc 10.2.1
Cmake 3.18.4
nanopb nanopb-0.4.7
What I have tried :
Create a my own "simple" example sending various types of data. Done
Create my own server-client example (network example). Failed
Break down the functions of the network example. Failed
Figure out when and where is the ListFilesResponse_callback called. Failed. You commented that it is called in the client when receiving a filename from the server and in the server during encoding.
Also, it is defined as NULL in the fileproto.pb.h, defined once in the client.c and defined once again in the server.c
I read the common.h, there is a write_callback function and a read one but I can't see them called in the client or server files either.
I commented out the ListFilesResponse_callback functions and tried to do "make", I got this in the terminal:
../../generator/protoc --nanopb_out=. fileproto.proto
cc -ansi -Wall -Werror -g -O0 -I../.. -o server server.c common.c fileproto.pb.c ../../pb_encode.c ../../pb_decode.c ../../pb_common.c
/usr/bin/ld: /tmp/ccD7pSxp.o:(.rodata+0x84): undefined reference to `ListFilesResponse_callback'
collect2: error: ld returned 1 exit status
make: *** [Makefile:16: server] Error 1
rm fileproto.pb.c
I get /usr/bin/ld: /tmp/ccD7pSxp.o:(.rodata+0x84): undefined reference to ListFilesResponse_callback' which I think means my linker doesn't find the definition for the function (can't it just be defined as NULL like in the .pb.c file).
The second interesting thing is make: *** [Makefile:16: server] Error 1 and line 16 of the makefile is $(CC) $(CFLAGS) -o $@ $^ $(NANOPB_CORE)
l have tried to find other examples or projects in nanopb but got no luck.
Questions / How to help me :
Where is called the ListFilesResponse_callback function ?
How can I make a simple server-client project sending just an int ?
Do you know online projects that I could use to learn ?
Is there issues on github or questions in this group that could help me ? (I don't want to take too much of your time.)
Thanks for your work.
Regards