conn_clear_upd func
FossilOrigin-Name: 4f1b416f4a3dad33336b08d0b13da3677eea01ebf539170c33b8efe947fe2bf4
This commit is contained in:
parent
72902de1d6
commit
da3d6db4a3
@ -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_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 (*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);
|
// 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);
|
int cw_read_from(struct conn * conn);
|
||||||
|
|
||||||
|
|
||||||
|
void conn_clear_upd(struct conn *conn, int merge);
|
||||||
|
|
||||||
#endif /* __CONN_H */
|
#endif /* __CONN_H */
|
||||||
|
30
src/cw/conn_clear_upd.c
Normal file
30
src/cw/conn_clear_upd.c
Normal file
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user