Fixed radio_out_generic

FossilOrigin-Name: 4598d7fd166507406cc644a9a91af6cec90f0cd3d33c60c09063cd317cdf7d1c
This commit is contained in:
7u83@mail.ru 2016-04-11 06:37:52 +00:00
parent 0a3ffcf280
commit a746d01823
2 changed files with 29 additions and 6 deletions

View File

@ -10,11 +10,31 @@ int cw_out_radio_generic(struct conn *conn, struct cw_action_out *a, uint8_t * d
int l=0; int l=0;
MAVLITER_DEFINE(it,conn->radios_upd); MAVLITER_DEFINE(it,conn->radios_upd);
mavliter_foreach(&it){ mavliter_foreach(&it){
struct mbag_item *i = mavliter_get(&it); struct mbag_item *radio = mavliter_get(&it);
if ( i->type != MBAG_MBAG ) { if ( radio->type != MBAG_MBAG ) {
continue; continue;
} }
cw_out_generic(conn,a,dst);
/* Size for msg elem header depends on
vendor specific payload */
int start = a->vendor_id ? 10 : 4;
struct mbag_item * item = mbag_get(radio->data,a->item_id);
if (!item){
continue;
}
int len=0;
len += cw_put_byte(dst+start,radio->iid);
len += cw_put_mbag_item(dst + start+1, item);
if (a->vendor_id)
l+= len + cw_put_elem_vendor_hdr(dst, a->vendor_id, a->elem_id, len);
else
l += len + cw_put_elem_hdr(dst, a->elem_id, len);
} }
return l; return l;

View File

@ -382,7 +382,8 @@ static cw_action_in_t actions_in[] = {
.msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST, .msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST,
.elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE, .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE,
.item_id = CW_RADIOITEM_ADMIN_STATE, .item_id = CW_RADIOITEM_ADMIN_STATE,
.start = cw_in_radio_administrative_state, .start = cw_in_radio_generic,
// .start = cw_in_radio_administrative_state,
.mand = 0 .mand = 0
} }
, ,
@ -596,9 +597,11 @@ static cw_action_out_t actions_out[] = {
/* Radio Admin State - Config Status Request */ /* Radio Admin State - Config Status Request */
{ {
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST, .msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
.elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE,
.item_id = CW_RADIOITEM_ADMIN_STATE, .item_id = CW_RADIOITEM_ADMIN_STATE,
.out = cw_out_radio_administrative_states, .out = cw_out_radio_generic,
.get = cw_out_get_config, // .out = cw_out_radio_administrative_states,
// .get = cw_out_get_config,
.mand = 1 .mand = 1
} }
, ,