2016-03-20 15:56:29 +01:00
|
|
|
/*
|
|
|
|
This file is part of actube.
|
|
|
|
|
|
|
|
actube is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
libcapwap is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Implementation of cw_put_radio_operational_states
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cw.h"
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2016-03-20 15:56:29 +01:00
|
|
|
#include "radio.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put all radio operational states
|
|
|
|
*/
|
2018-03-17 17:29:09 +01:00
|
|
|
//int xxcw_put_radio_operational_states(struct xaaa * radios, uint8_t * dst, int *nerror, int d7mode)
|
|
|
|
//{/
|
|
|
|
//uint8_t *d=dst;
|
2016-03-20 15:56:29 +01:00
|
|
|
|
|
|
|
/* Iterate through all radios and send the CW_RADIO_OPER_STATE item if found.
|
|
|
|
We assume, that any other processes, dealing with setting the
|
|
|
|
the Radio Admin state, adds a CW_RADIO_OPER_STATE item to the radio,
|
|
|
|
depending on results. */
|
|
|
|
|
|
|
|
// int nerror=0;
|
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
// *nerror=0;
|
2016-03-20 15:56:29 +01:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
// MAVLITER_DEFINE(it,radios);
|
|
|
|
// mavliter_foreach(&it){
|
2016-03-20 15:56:29 +01:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
// mbag_item_t * radioitem = mavliter_get(&it);
|
|
|
|
// mbag_item_t *ositem = mbag_get(radioitem->u2.data,CW_RADIOITEM_OPER_STATE);
|
|
|
|
//if (!ositem){
|
|
|
|
// (*nerror)++;
|
|
|
|
// continue;//
|
|
|
|
// }//
|
2016-03-20 15:56:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Put the radio ID */
|
2018-03-17 17:29:09 +01:00
|
|
|
// cw_put_byte(d+4,radioitem->u1.iid);
|
2016-03-20 15:56:29 +01:00
|
|
|
|
|
|
|
/* Get the operational state and cause */
|
2018-03-17 17:29:09 +01:00
|
|
|
// uint16_t os = ositem->u2.word;
|
2016-03-20 15:56:29 +01:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
// if ( d7mode ){//
|
|
|
|
// Isolate Oper Sate from cause
|
|
|
|
// uint8_t o=os>>8;
|
2016-03-20 15:56:29 +01:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
// /* Invert oper state for Cisco, if oper state is 2 or 1 */
|
|
|
|
// if (o!=0 && o<=2) {
|
|
|
|
// /* 2 becomes 1 and 1 becomes 2 */
|
|
|
|
// os = (os & 0x00ff ) | ((3-o)<<8);
|
|
|
|
// }
|
|
|
|
// }
|
2016-03-20 15:56:29 +01:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
// /* Put oper state */
|
|
|
|
// cw_put_word(d+5,os);
|
|
|
|
// d+=3+cw_put_elem_hdr(d,CW_ELEM_RADIO_OPERATIONAL_STATE,3);
|
2016-03-20 15:56:29 +01:00
|
|
|
|
|
|
|
/* delete the operational state item, so it won't be
|
|
|
|
sent again, until it is set by a change through
|
|
|
|
Set Radio Admin State */
|
2018-03-17 17:29:09 +01:00
|
|
|
// mbag_del(radioitem->u2.data,CW_RADIOITEM_OPER_STATE);
|
2016-03-20 15:56:29 +01:00
|
|
|
|
2018-03-17 17:29:09 +01:00
|
|
|
// }
|
2016-03-20 15:56:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
2018-03-17 17:29:09 +01:00
|
|
|
// return d-dst;
|
|
|
|
//}
|
2016-03-20 15:56:29 +01:00
|
|
|
|
|
|
|
|