diff --git a/src/cw/conn.h b/src/cw/conn.h index f45b6a7a..4a1c9fda 100644 --- a/src/cw/conn.h +++ b/src/cw/conn.h @@ -216,6 +216,7 @@ struct conn { int (*msg_start)(struct conn *conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from); int (*msg_end)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from); + int (*elem_end)(struct conn *conn,struct cw_action_in *a,int afrc,uint8_t*elem,int len,struct sockaddr *from); // void (*actions_registered)(struct conn *conn); @@ -289,5 +290,6 @@ int conn_send_msg(struct conn * conn, uint8_t *rawmsg); int cw_read_from(struct conn * conn); +void conn_clear_upd(struct conn *conn, int merge); #endif /* __CONN_H */ diff --git a/src/cw/conn_clear_upd.c b/src/cw/conn_clear_upd.c new file mode 100644 index 00000000..9979957f --- /dev/null +++ b/src/cw/conn_clear_upd.c @@ -0,0 +1,30 @@ + +#include "conn.h" + +#include "mavl.h" + + +void conn_clear_upd(struct conn *conn, int merge) +{ + if (merge){ + mavl_merge(conn->config, conn->config_upd); + + MAVLITER_DEFINE (it,conn->radios_upd); + + mavliter_foreach(&it){ + struct mbag_item * ruitem = mavliter_get(&it); + mavl_t radio_upd = ruitem->data; + + mbag_t radio = mbag_i_get_mbag(conn->radios,ruitem->iid,NULL); + if (radio){ + mavl_merge(radio,radio_upd); + } + + } + + } + mavl_del_all(conn->config_upd); + mavl_del_all(conn->radios_upd); + +} +