Read element from message (in progress)

FossilOrigin-Name: 6ee8f267da48de9b865abf5b7565097387e6436118a1cc80a198c3a47294fc5c
This commit is contained in:
7u83@mail.ru
2018-03-05 20:42:11 +00:00
parent af03e1c601
commit 8817d54d14
11 changed files with 42 additions and 18 deletions

View File

@ -32,6 +32,8 @@
#include "mod.h"
#include "message_set.h"
#include "cw_types.h"
int conn_send_msg(struct conn *conn, uint8_t * rawmsg);
@ -215,6 +217,17 @@ int cw_in_check_generic(struct conn *conn, struct cw_action_in *a, uint8_t * dat
}
void cw_read_elem(struct cw_ElemHandler * handler, struct conn * conn,
uint8_t * elem_data, int elem_len, struct sockaddr * from){
mavldata_t data, *result;
char str[30];
result = handler->type->get(&data,elem_data,elem_len);
handler->type->to_str(result,str,30);
printf("Read %d-%s: %s %s\n", handler->id, handler->name, handler->key, str);
/*mavl_add(conn->remote_cfg*/
}
static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
struct sockaddr *from)
@ -386,6 +399,9 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
elem_len = cw_get_elem_len(elem);
cw_read_elem(handler, conn, cw_get_elem_data(elem), elem_len, from);
printf ("Would start elem processing now %d - %s\n",handler->id, handler->name);
continue;
exit(0);