Wrap device name and size in a struct

As a benefit, this avoids to take care of the device name length on the
caller side.
This commit is contained in:
Romain Vimont
2021-10-30 19:07:35 +02:00
parent 58ea238fb2
commit 676fa73d2c
3 changed files with 23 additions and 24 deletions

View File

@@ -14,6 +14,12 @@
#include "util/net.h"
#include "util/thread.h"
#define DEVICE_NAME_FIELD_LENGTH 64
struct server_info {
char device_name[DEVICE_NAME_FIELD_LENGTH];
struct sc_size frame_size;
};
struct server {
char *serial;
process_t process;
@@ -58,12 +64,9 @@ server_init(struct server *server);
bool
server_start(struct server *server, const struct server_params *params);
#define DEVICE_NAME_FIELD_LENGTH 64
// block until the communication with the server is established
// device_name must point to a buffer of at least DEVICE_NAME_FIELD_LENGTH bytes
bool
server_connect_to(struct server *server, char *device_name,
struct sc_size *size);
server_connect_to(struct server *server, struct server_info *info);
// disconnect and kill the server process
void