Throws an error message if the element is mandatory and ca't be set.
FossilOrigin-Name: c6ebc9257f3096e1145257eaedf4ef261e5e899ecf1898cf1c2df3d0f6f00b4b
This commit is contained in:
		| @ -15,12 +15,16 @@ int cw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a, | |||||||
| 	   the Radio Admin state, adds a CW_RADIO_OPER_STATE item to the radio,  | 	   the Radio Admin state, adds a CW_RADIO_OPER_STATE item to the radio,  | ||||||
| 	   depending on results. */ | 	   depending on results. */ | ||||||
|  |  | ||||||
|  | 	int nerror=0; | ||||||
|  | 	 | ||||||
| 	MAVLITER_DEFINE(it,conn->radios); | 	MAVLITER_DEFINE(it,conn->radios); | ||||||
| 	mavliter_foreach(&it){ | 	mavliter_foreach(&it){ | ||||||
| 		mbag_item_t * radioitem = mavliter_get(&it); | 		mbag_item_t * radioitem = mavliter_get(&it); | ||||||
| 		mbag_item_t *ositem = mbag_get(radioitem->data,CW_RADIO_OPER_STATE); | 		mbag_item_t *ositem = mbag_get(radioitem->data,CW_RADIO_OPER_STATE); | ||||||
| 		if (!ositem) | 		if (!ositem){ | ||||||
|  | 			nerror++; | ||||||
| 			continue; | 			continue; | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		/* Put the radio ID */ | 		/* Put the radio ID */ | ||||||
| 		cw_put_byte(d+4,radioitem->id); | 		cw_put_byte(d+4,radioitem->id); | ||||||
| @ -50,6 +54,14 @@ int cw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a, | |||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if (nerror) { | ||||||
|  | 		if (a->mand) { | ||||||
|  | 			cw_log(LOG_ERROR,"Could not send Radio Operational State for all radios. Sent %d out of %d.", | ||||||
|  | 				conn->radios->count-nerror,conn->radios->count); | ||||||
|  |  | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	return d-dst; | 	return d-dst; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user