47 void getKnobs(GNURadio::KnobMap&,
const GNURadio::KnobIDList&);
48 void getRe(GNURadio::KnobMap&,
const GNURadio::KnobIDList&);
49 void properties(GNURadio::KnobPropMap&,
const GNURadio::KnobIDList& knobs);
76 const std::string& port,
77 const std::string& msg);
85 std::mutex d_callback_map_lock;
87 typedef std::map<std::string, configureCallback_t> ConfigureCallbackMap_t;
88 ConfigureCallbackMap_t d_setcallbackmap;
90 typedef std::map<std::string, queryCallback_t> QueryCallbackMap_t;
91 QueryCallbackMap_t d_getcallbackmap;
93 typedef std::map<std::string, handlerCallback_t> HandlerCallbackMap_t;
94 HandlerCallbackMap_t d_handlercallbackmap;
105 _handlerCallback.callback->post(port, msg);
107 std::ostringstream msg;
109 <<
" requires PRIVLVL <= " << _handlerCallback.
priv
110 <<
" to set, currently at: " <<
cur_priv;
116 template <
typename T,
typename TMap>
117 struct set_f :
public std::function<void(T)> {
118 set_f(TMap& _setcallbackmap,
const priv_lvl_t& _cur_priv)
119 : d_setcallbackmap(_setcallbackmap), cur_priv(_cur_priv)
124 void operator()(
const T& p)
126 ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(p.first));
127 if (iter != d_setcallbackmap.end()) {
129 (*iter->second.callback)
132 std::ostringstream
msg;
133 msg <<
"Key " << p.first
134 <<
" requires PRIVLVL <= " << iter->second.priv
135 <<
" to set, currently at: " << cur_priv;
139 throw apache::thrift::TApplicationException(__FILE__
" " S__LINE__);
143 TMap& d_setcallbackmap;
147 template <
typename T,
typename TMap>
148 struct get_f :
public std::function<void(T)> {
149 get_f(TMap& _getcallbackmap,
151 GNURadio::KnobMap& _outknobs)
152 : d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
156 void operator()(
const T& p)
158 QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(p));
159 if (iter != d_getcallbackmap.end()) {
164 std::ostringstream
msg;
165 msg <<
"Key " << iter->first
166 <<
" requires PRIVLVL: <= " << iter->second.priv
167 <<
" to get, currently at: " << cur_priv;
171 std::ostringstream smsgs;
172 smsgs <<
"Ctrlport Key called with unregistered key (" << p <<
")\n";
174 throw apache::thrift::TApplicationException(__FILE__
" " S__LINE__);
178 TMap& d_getcallbackmap;
180 GNURadio::KnobMap& outknobs;
183 template <
typename T,
typename TMap,
typename TKnobMap>
184 struct get_all_f :
public std::function<void(T)> {
185 get_all_f(TMap& _getcallbackmap,
const priv_lvl_t& _cur_priv, TKnobMap& _outknobs)
186 : d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
191 void operator()(
const T& p)
193 if (cur_priv <= p.second.priv) {
197 std::ostringstream
msg;
198 msg <<
"Key " << p.first <<
" requires PRIVLVL: <= " << p.second.priv
199 <<
" to get, currently at: " << cur_priv;
204 TMap& d_getcallbackmap;
209 template <
typename T,
typename TMap,
typename TKnobMap>
210 struct properties_all_f :
public std::function<void(T)> {
211 properties_all_f(QueryCallbackMap_t& _getcallbackmap,
213 GNURadio::KnobPropMap& _outknobs)
214 : d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
219 void operator()(
const T& p)
221 if (cur_priv <= p.second.priv) {
222 GNURadio::KnobProp prop;
223 prop.type = GNURadio::KnobType::KNOBDOUBLE;
224 prop.units = p.second.units;
225 prop.description = p.second.description;
228 prop.display =
static_cast<uint32_t
>(p.second.display);
229 outknobs[p.first] = prop;
231 std::ostringstream
msg;
232 msg <<
"Key " << p.first <<
" requires PRIVLVL: <= " << p.second.priv
233 <<
" to get, currently at: " << cur_priv;
238 TMap& d_getcallbackmap;
243 template <
class T,
typename TMap,
typename TKnobMap>
244 struct properties_f :
public std::function<void(T)> {
245 properties_f(TMap& _getcallbackmap,
248 : d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs)
253 void operator()(
const T& p)
255 typename TMap::const_iterator iter(d_getcallbackmap.find(p));
256 if (iter != d_getcallbackmap.end()) {
258 GNURadio::KnobProp prop;
259 prop.type = GNURadio::KnobType::KNOBDOUBLE;
260 prop.units = iter->second.units;
261 prop.description = iter->second.description;
264 prop.display =
static_cast<uint32_t
>(iter->second.display);
267 std::ostringstream
msg;
268 msg <<
"Key " << iter->first
269 <<
" requires PRIVLVL: <= " << iter->second.priv
270 <<
" to get, currently at: " << cur_priv;
274 throw apache::thrift::TApplicationException(__FILE__
" " S__LINE__);
278 TMap& d_getcallbackmap;