Commit f05bd7de authored by Frédéric Leroy's avatar Frédéric Leroy

UE/API/USER: move _user_api_*_buffer to user_api_id_t

parent 80d7d842
This diff is collapsed.
......@@ -67,11 +67,11 @@ int user_api_get_fd(user_api_id_t *user_api_id);
const void* user_api_get_data(user_at_commands_t *commands, int index);
int user_api_read_data(user_api_id_t *user_api_id, int fd);
int user_api_set_data(char *message);
int user_api_set_data(user_api_id_t *user_api_id, char *message);
int user_api_send_data(user_api_id_t *user_api_id, int fd, int length);
void user_api_close(user_api_id_t *user_api_id, int fd);
int user_api_decode_data(user_api_id_t *user_api_id, user_at_commands_t *commands, int length);
int user_api_encode_data(const void* data, int add_success_code);
int user_api_encode_data(user_api_id_t *user_api_id, const void* data, int add_success_code);
#endif /* __USER_API_H__ */
......@@ -8,12 +8,15 @@
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
#define USER_API_RECV_BUFFER_SIZE 4096
#define USER_API_SEND_BUFFER_SIZE USER_API_RECV_BUFFER_SIZE
#define USER_DATA_MAX 10
/*
* The decoded data received from the user application layer
*/
typedef struct {
int n_cmd; /* number of user data to be processed */
#define USER_DATA_MAX 10
at_command_t cmd[USER_DATA_MAX]; /* user data to be processed */
} user_at_commands_t;
......@@ -39,6 +42,8 @@ typedef struct {
ssize_t (*recv) (void*, char*, size_t);
ssize_t (*send) (const void*, const char*, size_t);
void (*close)(void*);
char recv_buffer[USER_API_RECV_BUFFER_SIZE];
char send_buffer[USER_API_SEND_BUFFER_SIZE];
} user_api_id_t;
......
......@@ -220,7 +220,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
if (message != NULL) {
/* Set the message in receive buffer (Use to simulate reception of data from UserProcess) */
bytes = user_api_set_data(message);
bytes = user_api_set_data(user_api_id, message);
} else {
/* Read the user data message */
bytes = user_api_read_data (user_api_id, user->fd);
......@@ -270,7 +270,7 @@ int nas_user_receive_and_process(nas_user_t *user, char *message)
/* Send response to UserProcess (If not in simulated reception) */
if (message == NULL) {
/* Encode the user data message */
bytes = user_api_encode_data (nas_user_get_data (user), i == nb_command - 1);
bytes = user_api_encode_data (user->user_api_id, nas_user_get_data (user), i == nb_command - 1);
if (bytes == RETURNerror) {
/* Failed to encode the user data message;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment