Revision 98ba0cc0
| b/host/include/uhd/utils/props.hpp | ||
|---|---|---|
| 21 | 21 |
#include <uhd/config.hpp> |
| 22 | 22 |
#include <uhd/wax.hpp> |
| 23 | 23 |
#include <uhd/utils/exception.hpp> |
| 24 |
#include <boost/tuple/tuple.hpp> |
|
| 25 | 24 |
#include <stdexcept> |
| 26 | 25 |
#include <vector> |
| 27 | 26 |
#include <string> |
| ... | ... | |
| 36 | 35 |
* Allows properties to be sub-sectioned by name. |
| 37 | 36 |
*/ |
| 38 | 37 |
struct UHD_API named_prop_t{
|
| 39 |
wax::obj key; |
|
| 40 |
std::string name; |
|
| 38 |
const wax::obj key; |
|
| 39 |
const std::string name; |
|
| 40 |
|
|
| 41 |
//! Convert the key to the specified type |
|
| 42 |
template<typename T> inline T as(void){
|
|
| 43 |
return key.as<T>(); |
|
| 44 |
} |
|
| 45 |
|
|
| 46 |
/*! |
|
| 47 |
* Utility function to convert generic key into a named prop. |
|
| 48 |
* If the key was already a named prop, the prop will be split. |
|
| 49 |
* Otherwise, the key will be the key, and the name will be used. |
|
| 50 |
* \param key a reference to the prop object |
|
| 51 |
* \param name a reference to the name object |
|
| 52 |
* \return a named property struct with key and name |
|
| 53 |
*/ |
|
| 54 |
static named_prop_t extract( |
|
| 55 |
const wax::obj &key, const std::string &name = "" |
|
| 56 |
); |
|
| 41 | 57 |
|
| 42 | 58 |
/*! |
| 43 | 59 |
* Create a new named prop from key and name. |
| ... | ... | |
| 48 | 64 |
}; |
| 49 | 65 |
|
| 50 | 66 |
/*! |
| 51 |
* Utility function to separate a named property into its components. |
|
| 52 |
* \param key a reference to the prop object |
|
| 53 |
* \param name a reference to the name object |
|
| 54 |
* \return a tuple that can be used with boost::tie |
|
| 55 |
*/ |
|
| 56 |
UHD_API boost::tuple<wax::obj, std::string> extract_named_prop( |
|
| 57 |
const wax::obj &key, |
|
| 58 |
const std::string &name = "" |
|
| 59 |
); |
|
| 60 |
|
|
| 61 |
/*! |
|
| 62 | 67 |
* Throw when getting a not-implemented or write-only property. |
| 63 | 68 |
* Throw-site information will be included with this error. |
| 64 | 69 |
*/ |
| b/host/lib/usrp/dboard/db_basic_and_lf.cpp | ||
|---|---|---|
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 | 97 |
void basic_rx::rx_get(const wax::obj &key_, wax::obj &val){
|
| 98 |
wax::obj key; std::string name; |
|
| 99 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 98 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 100 | 99 |
|
| 101 | 100 |
//handle the get request conditioned on the key |
| 102 | 101 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 161 | 160 |
} |
| 162 | 161 |
|
| 163 | 162 |
void basic_rx::rx_set(const wax::obj &key_, const wax::obj &val){
|
| 164 |
wax::obj key; std::string name; |
|
| 165 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 163 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 166 | 164 |
|
| 167 | 165 |
//handle the get request conditioned on the key |
| 168 | 166 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 194 | 192 |
} |
| 195 | 193 |
|
| 196 | 194 |
void basic_tx::tx_get(const wax::obj &key_, wax::obj &val){
|
| 197 |
wax::obj key; std::string name; |
|
| 198 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 195 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 199 | 196 |
|
| 200 | 197 |
//handle the get request conditioned on the key |
| 201 | 198 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 252 | 249 |
} |
| 253 | 250 |
|
| 254 | 251 |
void basic_tx::tx_set(const wax::obj &key_, const wax::obj &val){
|
| 255 |
wax::obj key; std::string name; |
|
| 256 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 252 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 257 | 253 |
|
| 258 | 254 |
//handle the get request conditioned on the key |
| 259 | 255 |
switch(key.as<subdev_prop_t>()){
|
| b/host/lib/usrp/dboard/db_dbsrx.cpp | ||
|---|---|---|
| 500 | 500 |
* RX Get and Set |
| 501 | 501 |
**********************************************************************/ |
| 502 | 502 |
void dbsrx::rx_get(const wax::obj &key_, wax::obj &val){
|
| 503 |
wax::obj key; std::string name; |
|
| 504 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 503 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 505 | 504 |
|
| 506 | 505 |
//handle the get request conditioned on the key |
| 507 | 506 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 514 | 513 |
return; |
| 515 | 514 |
|
| 516 | 515 |
case SUBDEV_PROP_GAIN: |
| 517 |
assert_has(_gains.keys(), name, "dbsrx gain name"); |
|
| 518 |
val = _gains[name]; |
|
| 516 |
assert_has(_gains.keys(), key.name, "dbsrx gain name");
|
|
| 517 |
val = _gains[key.name];
|
|
| 519 | 518 |
return; |
| 520 | 519 |
|
| 521 | 520 |
case SUBDEV_PROP_GAIN_RANGE: |
| 522 |
assert_has(dbsrx_gain_ranges.keys(), name, "dbsrx gain name"); |
|
| 523 |
val = dbsrx_gain_ranges[name]; |
|
| 521 |
assert_has(dbsrx_gain_ranges.keys(), key.name, "dbsrx gain name");
|
|
| 522 |
val = dbsrx_gain_ranges[key.name];
|
|
| 524 | 523 |
return; |
| 525 | 524 |
|
| 526 | 525 |
case SUBDEV_PROP_GAIN_NAMES: |
| ... | ... | |
| 543 | 542 |
val = dbsrx_antennas; |
| 544 | 543 |
return; |
| 545 | 544 |
|
| 546 |
/* |
|
| 547 |
case SUBDEV_PROP_QUADRATURE: |
|
| 548 |
val = true; |
|
| 549 |
return; |
|
| 550 |
|
|
| 551 |
case SUBDEV_PROP_IQ_SWAPPED: |
|
| 552 |
val = false; |
|
| 553 |
return; |
|
| 554 |
|
|
| 555 |
case SUBDEV_PROP_SPECTRUM_INVERTED: |
|
| 556 |
val = false; |
|
| 557 |
return; |
|
| 558 |
*/ |
|
| 559 | 545 |
case SUBDEV_PROP_CONNECTION: |
| 560 | 546 |
val = SUBDEV_CONN_COMPLEX_IQ; |
| 561 | 547 |
return; |
| ... | ... | |
| 583 | 569 |
} |
| 584 | 570 |
|
| 585 | 571 |
void dbsrx::rx_set(const wax::obj &key_, const wax::obj &val){
|
| 586 |
wax::obj key; std::string name; |
|
| 587 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 572 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 588 | 573 |
|
| 589 | 574 |
//handle the get request conditioned on the key |
| 590 | 575 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 594 | 579 |
return; |
| 595 | 580 |
|
| 596 | 581 |
case SUBDEV_PROP_GAIN: |
| 597 |
this->set_gain(val.as<float>(), name); |
|
| 582 |
this->set_gain(val.as<float>(), key.name);
|
|
| 598 | 583 |
return; |
| 599 | 584 |
|
| 600 | 585 |
case SUBDEV_PROP_BANDWIDTH: |
| b/host/lib/usrp/dboard/db_rfx.cpp | ||
|---|---|---|
| 398 | 398 |
* RX Get and Set |
| 399 | 399 |
**********************************************************************/ |
| 400 | 400 |
void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
|
| 401 |
wax::obj key; std::string name; |
|
| 402 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 401 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 403 | 402 |
|
| 404 | 403 |
//handle the get request conditioned on the key |
| 405 | 404 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 412 | 411 |
return; |
| 413 | 412 |
|
| 414 | 413 |
case SUBDEV_PROP_GAIN: |
| 415 |
assert_has(_rx_gains.keys(), name, "rfx rx gain name"); |
|
| 416 |
val = _rx_gains[name]; |
|
| 414 |
assert_has(_rx_gains.keys(), key.name, "rfx rx gain name");
|
|
| 415 |
val = _rx_gains[key.name];
|
|
| 417 | 416 |
return; |
| 418 | 417 |
|
| 419 | 418 |
case SUBDEV_PROP_GAIN_RANGE: |
| 420 |
assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name"); |
|
| 421 |
val = _rx_gain_ranges[name]; |
|
| 419 |
assert_has(_rx_gain_ranges.keys(), key.name, "rfx rx gain name");
|
|
| 420 |
val = _rx_gain_ranges[key.name];
|
|
| 422 | 421 |
return; |
| 423 | 422 |
|
| 424 | 423 |
case SUBDEV_PROP_GAIN_NAMES: |
| ... | ... | |
| 458 | 457 |
} |
| 459 | 458 |
|
| 460 | 459 |
void rfx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
|
| 461 |
wax::obj key; std::string name; |
|
| 462 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 460 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 463 | 461 |
|
| 464 | 462 |
//handle the get request conditioned on the key |
| 465 | 463 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 469 | 467 |
return; |
| 470 | 468 |
|
| 471 | 469 |
case SUBDEV_PROP_GAIN: |
| 472 |
this->set_rx_gain(val.as<float>(), name); |
|
| 470 |
this->set_rx_gain(val.as<float>(), key.name);
|
|
| 473 | 471 |
return; |
| 474 | 472 |
|
| 475 | 473 |
case SUBDEV_PROP_ANTENNA: |
| ... | ... | |
| 484 | 482 |
* TX Get and Set |
| 485 | 483 |
**********************************************************************/ |
| 486 | 484 |
void rfx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
|
| 487 |
wax::obj key; std::string name; |
|
| 488 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 485 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 489 | 486 |
|
| 490 | 487 |
//handle the get request conditioned on the key |
| 491 | 488 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 499 | 496 |
|
| 500 | 497 |
case SUBDEV_PROP_GAIN: |
| 501 | 498 |
case SUBDEV_PROP_GAIN_RANGE: |
| 502 |
assert_has(rfx_tx_gain_ranges.keys(), name, "rfx tx gain name"); |
|
| 499 |
assert_has(rfx_tx_gain_ranges.keys(), key.name, "rfx tx gain name");
|
|
| 503 | 500 |
//no controllable tx gains, will not get here |
| 504 | 501 |
return; |
| 505 | 502 |
|
| ... | ... | |
| 540 | 537 |
} |
| 541 | 538 |
|
| 542 | 539 |
void rfx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
|
| 543 |
wax::obj key; std::string name; |
|
| 544 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 540 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 545 | 541 |
|
| 546 | 542 |
//handle the get request conditioned on the key |
| 547 | 543 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 551 | 547 |
return; |
| 552 | 548 |
|
| 553 | 549 |
case SUBDEV_PROP_GAIN: |
| 554 |
this->set_tx_gain(val.as<float>(), name); |
|
| 550 |
this->set_tx_gain(val.as<float>(), key.name);
|
|
| 555 | 551 |
return; |
| 556 | 552 |
|
| 557 | 553 |
case SUBDEV_PROP_ANTENNA: |
| b/host/lib/usrp/dboard/db_unknown.cpp | ||
|---|---|---|
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
void unknown_rx::rx_get(const wax::obj &key_, wax::obj &val){
|
| 81 |
wax::obj key; std::string name; |
|
| 82 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 81 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 83 | 82 |
|
| 84 | 83 |
//handle the get request conditioned on the key |
| 85 | 84 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 136 | 135 |
} |
| 137 | 136 |
|
| 138 | 137 |
void unknown_rx::rx_set(const wax::obj &key_, const wax::obj &val){
|
| 139 |
wax::obj key; std::string name; |
|
| 140 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 138 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 141 | 139 |
|
| 142 | 140 |
//handle the get request conditioned on the key |
| 143 | 141 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 169 | 167 |
} |
| 170 | 168 |
|
| 171 | 169 |
void unknown_tx::tx_get(const wax::obj &key_, wax::obj &val){
|
| 172 |
wax::obj key; std::string name; |
|
| 173 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 170 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 174 | 171 |
|
| 175 | 172 |
//handle the get request conditioned on the key |
| 176 | 173 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 227 | 224 |
} |
| 228 | 225 |
|
| 229 | 226 |
void unknown_tx::tx_set(const wax::obj &key_, const wax::obj &val){
|
| 230 |
wax::obj key; std::string name; |
|
| 231 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 227 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 232 | 228 |
|
| 233 | 229 |
//handle the get request conditioned on the key |
| 234 | 230 |
switch(key.as<subdev_prop_t>()){
|
| b/host/lib/usrp/dboard/db_wbx.cpp | ||
|---|---|---|
| 467 | 467 |
* RX Get and Set |
| 468 | 468 |
**********************************************************************/ |
| 469 | 469 |
void wbx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){
|
| 470 |
wax::obj key; std::string name; |
|
| 471 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 470 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 472 | 471 |
|
| 473 | 472 |
//handle the get request conditioned on the key |
| 474 | 473 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 481 | 480 |
return; |
| 482 | 481 |
|
| 483 | 482 |
case SUBDEV_PROP_GAIN: |
| 484 |
assert_has(_rx_gains.keys(), name, "wbx rx gain name"); |
|
| 485 |
val = _rx_gains[name]; |
|
| 483 |
assert_has(_rx_gains.keys(), key.name, "wbx rx gain name");
|
|
| 484 |
val = _rx_gains[key.name];
|
|
| 486 | 485 |
return; |
| 487 | 486 |
|
| 488 | 487 |
case SUBDEV_PROP_GAIN_RANGE: |
| 489 |
assert_has(wbx_rx_gain_ranges.keys(), name, "wbx rx gain name"); |
|
| 490 |
val = wbx_rx_gain_ranges[name]; |
|
| 488 |
assert_has(wbx_rx_gain_ranges.keys(), key.name, "wbx rx gain name");
|
|
| 489 |
val = wbx_rx_gain_ranges[key.name];
|
|
| 491 | 490 |
return; |
| 492 | 491 |
|
| 493 | 492 |
case SUBDEV_PROP_GAIN_NAMES: |
| ... | ... | |
| 527 | 526 |
} |
| 528 | 527 |
|
| 529 | 528 |
void wbx_xcvr::rx_set(const wax::obj &key_, const wax::obj &val){
|
| 530 |
wax::obj key; std::string name; |
|
| 531 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 529 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 532 | 530 |
|
| 533 | 531 |
//handle the get request conditioned on the key |
| 534 | 532 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 538 | 536 |
return; |
| 539 | 537 |
|
| 540 | 538 |
case SUBDEV_PROP_GAIN: |
| 541 |
this->set_rx_gain(val.as<float>(), name); |
|
| 539 |
this->set_rx_gain(val.as<float>(), key.name);
|
|
| 542 | 540 |
return; |
| 543 | 541 |
|
| 544 | 542 |
case SUBDEV_PROP_ANTENNA: |
| ... | ... | |
| 553 | 551 |
* TX Get and Set |
| 554 | 552 |
**********************************************************************/ |
| 555 | 553 |
void wbx_xcvr::tx_get(const wax::obj &key_, wax::obj &val){
|
| 556 |
wax::obj key; std::string name; |
|
| 557 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 554 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 558 | 555 |
|
| 559 | 556 |
//handle the get request conditioned on the key |
| 560 | 557 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 567 | 564 |
return; |
| 568 | 565 |
|
| 569 | 566 |
case SUBDEV_PROP_GAIN: |
| 570 |
assert_has(_tx_gains.keys(), name, "wbx tx gain name"); |
|
| 571 |
val = _tx_gains[name]; |
|
| 567 |
assert_has(_tx_gains.keys(), key.name, "wbx tx gain name");
|
|
| 568 |
val = _tx_gains[key.name];
|
|
| 572 | 569 |
return; |
| 573 | 570 |
|
| 574 | 571 |
case SUBDEV_PROP_GAIN_RANGE: |
| 575 |
assert_has(wbx_tx_gain_ranges.keys(), name, "wbx tx gain name"); |
|
| 576 |
val = wbx_tx_gain_ranges[name]; |
|
| 572 |
assert_has(wbx_tx_gain_ranges.keys(), key.name, "wbx tx gain name");
|
|
| 573 |
val = wbx_tx_gain_ranges[key.name];
|
|
| 577 | 574 |
return; |
| 578 | 575 |
|
| 579 | 576 |
case SUBDEV_PROP_GAIN_NAMES: |
| ... | ... | |
| 613 | 610 |
} |
| 614 | 611 |
|
| 615 | 612 |
void wbx_xcvr::tx_set(const wax::obj &key_, const wax::obj &val){
|
| 616 |
wax::obj key; std::string name; |
|
| 617 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 613 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 618 | 614 |
|
| 619 | 615 |
//handle the get request conditioned on the key |
| 620 | 616 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 624 | 620 |
return; |
| 625 | 621 |
|
| 626 | 622 |
case SUBDEV_PROP_GAIN: |
| 627 |
this->set_tx_gain(val.as<float>(), name); |
|
| 623 |
this->set_tx_gain(val.as<float>(), key.name);
|
|
| 628 | 624 |
return; |
| 629 | 625 |
|
| 630 | 626 |
case SUBDEV_PROP_ANTENNA: |
| b/host/lib/usrp/dboard/db_xcvr2450.cpp | ||
|---|---|---|
| 438 | 438 |
* RX Get and Set |
| 439 | 439 |
**********************************************************************/ |
| 440 | 440 |
void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){
|
| 441 |
wax::obj key; std::string name; |
|
| 442 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 441 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 443 | 442 |
|
| 444 | 443 |
//handle the get request conditioned on the key |
| 445 | 444 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 452 | 451 |
return; |
| 453 | 452 |
|
| 454 | 453 |
case SUBDEV_PROP_GAIN: |
| 455 |
assert_has(_rx_gains.keys(), name, "xcvr rx gain name"); |
|
| 456 |
val = _rx_gains[name]; |
|
| 454 |
assert_has(_rx_gains.keys(), key.name, "xcvr rx gain name");
|
|
| 455 |
val = _rx_gains[key.name];
|
|
| 457 | 456 |
return; |
| 458 | 457 |
|
| 459 | 458 |
case SUBDEV_PROP_GAIN_RANGE: |
| 460 |
assert_has(xcvr_rx_gain_ranges.keys(), name, "xcvr rx gain name"); |
|
| 461 |
val = xcvr_rx_gain_ranges[name]; |
|
| 459 |
assert_has(xcvr_rx_gain_ranges.keys(), key.name, "xcvr rx gain name");
|
|
| 460 |
val = xcvr_rx_gain_ranges[key.name];
|
|
| 462 | 461 |
return; |
| 463 | 462 |
|
| 464 | 463 |
case SUBDEV_PROP_GAIN_NAMES: |
| ... | ... | |
| 502 | 501 |
} |
| 503 | 502 |
|
| 504 | 503 |
void xcvr2450::rx_set(const wax::obj &key_, const wax::obj &val){
|
| 505 |
wax::obj key; std::string name; |
|
| 506 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 504 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 507 | 505 |
|
| 508 | 506 |
//handle the get request conditioned on the key |
| 509 | 507 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 513 | 511 |
return; |
| 514 | 512 |
|
| 515 | 513 |
case SUBDEV_PROP_GAIN: |
| 516 |
this->set_rx_gain(val.as<float>(), name); |
|
| 514 |
this->set_rx_gain(val.as<float>(), key.name);
|
|
| 517 | 515 |
return; |
| 518 | 516 |
|
| 519 | 517 |
case SUBDEV_PROP_ANTENNA: |
| ... | ... | |
| 528 | 526 |
* TX Get and Set |
| 529 | 527 |
**********************************************************************/ |
| 530 | 528 |
void xcvr2450::tx_get(const wax::obj &key_, wax::obj &val){
|
| 531 |
wax::obj key; std::string name; |
|
| 532 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 529 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 533 | 530 |
|
| 534 | 531 |
//handle the get request conditioned on the key |
| 535 | 532 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 542 | 539 |
return; |
| 543 | 540 |
|
| 544 | 541 |
case SUBDEV_PROP_GAIN: |
| 545 |
assert_has(_tx_gains.keys(), name, "xcvr tx gain name"); |
|
| 546 |
val = _tx_gains[name]; |
|
| 542 |
assert_has(_tx_gains.keys(), key.name, "xcvr tx gain name");
|
|
| 543 |
val = _tx_gains[key.name];
|
|
| 547 | 544 |
return; |
| 548 | 545 |
|
| 549 | 546 |
case SUBDEV_PROP_GAIN_RANGE: |
| 550 |
assert_has(xcvr_tx_gain_ranges.keys(), name, "xcvr tx gain name"); |
|
| 551 |
val = xcvr_tx_gain_ranges[name]; |
|
| 547 |
assert_has(xcvr_tx_gain_ranges.keys(), key.name, "xcvr tx gain name");
|
|
| 548 |
val = xcvr_tx_gain_ranges[key.name];
|
|
| 552 | 549 |
return; |
| 553 | 550 |
|
| 554 | 551 |
case SUBDEV_PROP_GAIN_NAMES: |
| ... | ... | |
| 588 | 585 |
} |
| 589 | 586 |
|
| 590 | 587 |
void xcvr2450::tx_set(const wax::obj &key_, const wax::obj &val){
|
| 591 |
wax::obj key; std::string name; |
|
| 592 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 588 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 593 | 589 |
|
| 594 | 590 |
//handle the get request conditioned on the key |
| 595 | 591 |
switch(key.as<subdev_prop_t>()){
|
| ... | ... | |
| 599 | 595 |
return; |
| 600 | 596 |
|
| 601 | 597 |
case SUBDEV_PROP_GAIN: |
| 602 |
this->set_tx_gain(val.as<float>(), name); |
|
| 598 |
this->set_tx_gain(val.as<float>(), key.name);
|
|
| 603 | 599 |
return; |
| 604 | 600 |
|
| 605 | 601 |
case SUBDEV_PROP_ANTENNA: |
| b/host/lib/usrp/usrp2/codec_impl.cpp | ||
|---|---|---|
| 40 | 40 |
/*********************************************************************** |
| 41 | 41 |
* RX Codec Properties |
| 42 | 42 |
**********************************************************************/ |
| 43 |
void usrp2_mboard_impl::rx_codec_get(const wax::obj &key_, wax::obj &val){
|
|
| 44 |
wax::obj key; std::string name; |
|
| 45 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 43 |
void usrp2_mboard_impl::rx_codec_get(const wax::obj &key, wax::obj &val){
|
|
| 46 | 44 |
|
| 47 | 45 |
//handle the get request conditioned on the key |
| 48 | 46 |
switch(key.as<codec_prop_t>()){
|
| ... | ... | |
| 69 | 67 |
/*********************************************************************** |
| 70 | 68 |
* TX Codec Properties |
| 71 | 69 |
**********************************************************************/ |
| 72 |
void usrp2_mboard_impl::tx_codec_get(const wax::obj &key_, wax::obj &val){
|
|
| 73 |
wax::obj key; std::string name; |
|
| 74 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 70 |
void usrp2_mboard_impl::tx_codec_get(const wax::obj &key, wax::obj &val){
|
|
| 75 | 71 |
|
| 76 | 72 |
//handle the get request conditioned on the key |
| 77 | 73 |
switch(key.as<codec_prop_t>()){
|
| b/host/lib/usrp/usrp2/dboard_impl.cpp | ||
|---|---|---|
| 59 | 59 |
* RX DBoard Properties |
| 60 | 60 |
**********************************************************************/ |
| 61 | 61 |
void usrp2_mboard_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
|
| 62 |
wax::obj key; std::string name; |
|
| 63 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 62 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 64 | 63 |
|
| 65 | 64 |
//handle the get request conditioned on the key |
| 66 | 65 |
switch(key.as<dboard_prop_t>()){
|
| ... | ... | |
| 69 | 68 |
return; |
| 70 | 69 |
|
| 71 | 70 |
case DBOARD_PROP_SUBDEV: |
| 72 |
val = _dboard_manager->get_rx_subdev(name); |
|
| 71 |
val = _dboard_manager->get_rx_subdev(key.name);
|
|
| 73 | 72 |
return; |
| 74 | 73 |
|
| 75 | 74 |
case DBOARD_PROP_SUBDEV_NAMES: |
| ... | ... | |
| 90 | 89 |
|
| 91 | 90 |
case DBOARD_PROP_GAIN_GROUP: |
| 92 | 91 |
val = make_gain_group( |
| 93 |
_dboard_manager->get_rx_subdev(name), _rx_codec_proxy->get_link() |
|
| 92 |
_dboard_manager->get_rx_subdev(key.name), _rx_codec_proxy->get_link()
|
|
| 94 | 93 |
); |
| 95 | 94 |
return; |
| 96 | 95 |
|
| ... | ... | |
| 114 | 113 |
* TX DBoard Properties |
| 115 | 114 |
**********************************************************************/ |
| 116 | 115 |
void usrp2_mboard_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
|
| 117 |
wax::obj key; std::string name; |
|
| 118 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 116 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 119 | 117 |
|
| 120 | 118 |
//handle the get request conditioned on the key |
| 121 | 119 |
switch(key.as<dboard_prop_t>()){
|
| ... | ... | |
| 124 | 122 |
return; |
| 125 | 123 |
|
| 126 | 124 |
case DBOARD_PROP_SUBDEV: |
| 127 |
val = _dboard_manager->get_tx_subdev(name); |
|
| 125 |
val = _dboard_manager->get_tx_subdev(key.name);
|
|
| 128 | 126 |
return; |
| 129 | 127 |
|
| 130 | 128 |
case DBOARD_PROP_SUBDEV_NAMES: |
| ... | ... | |
| 145 | 143 |
|
| 146 | 144 |
case DBOARD_PROP_GAIN_GROUP: |
| 147 | 145 |
val = make_gain_group( |
| 148 |
_dboard_manager->get_tx_subdev(name), _tx_codec_proxy->get_link() |
|
| 146 |
_dboard_manager->get_tx_subdev(key.name), _tx_codec_proxy->get_link()
|
|
| 149 | 147 |
); |
| 150 | 148 |
return; |
| 151 | 149 |
|
| b/host/lib/usrp/usrp2/mboard_impl.cpp | ||
|---|---|---|
| 189 | 189 |
static const std::string dboard_name = "0"; |
| 190 | 190 |
|
| 191 | 191 |
void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
|
| 192 |
wax::obj key; std::string name; |
|
| 193 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 192 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 194 | 193 |
|
| 195 | 194 |
//handle the other props |
| 196 |
if (key.type() == typeid(std::string)){
|
|
| 195 |
if (key_.type() == typeid(std::string)){
|
|
| 197 | 196 |
if (key.as<std::string>() == "mac-addr"){
|
| 198 | 197 |
byte_vector_t bytes = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, 6); |
| 199 | 198 |
val = mac_addr_t::from_bytes(bytes).to_string(); |
| ... | ... | |
| 224 | 223 |
return; |
| 225 | 224 |
|
| 226 | 225 |
case MBOARD_PROP_RX_DBOARD: |
| 227 |
UHD_ASSERT_THROW(name == dboard_name); |
|
| 226 |
UHD_ASSERT_THROW(key.name == dboard_name);
|
|
| 228 | 227 |
val = _rx_dboard_proxy->get_link(); |
| 229 | 228 |
return; |
| 230 | 229 |
|
| ... | ... | |
| 233 | 232 |
return; |
| 234 | 233 |
|
| 235 | 234 |
case MBOARD_PROP_TX_DBOARD: |
| 236 |
UHD_ASSERT_THROW(name == dboard_name); |
|
| 235 |
UHD_ASSERT_THROW(key.name == dboard_name);
|
|
| 237 | 236 |
val = _tx_dboard_proxy->get_link(); |
| 238 | 237 |
return; |
| 239 | 238 |
|
| ... | ... | |
| 242 | 241 |
return; |
| 243 | 242 |
|
| 244 | 243 |
case MBOARD_PROP_RX_DSP: |
| 245 |
UHD_ASSERT_THROW(name == ""); |
|
| 244 |
UHD_ASSERT_THROW(key.name == "");
|
|
| 246 | 245 |
val = _rx_dsp_proxy->get_link(); |
| 247 | 246 |
return; |
| 248 | 247 |
|
| ... | ... | |
| 251 | 250 |
return; |
| 252 | 251 |
|
| 253 | 252 |
case MBOARD_PROP_TX_DSP: |
| 254 |
UHD_ASSERT_THROW(name == ""); |
|
| 253 |
UHD_ASSERT_THROW(key.name == "");
|
|
| 255 | 254 |
val = _tx_dsp_proxy->get_link(); |
| 256 | 255 |
return; |
| 257 | 256 |
|
| b/host/lib/usrp/usrp2/usrp2_impl.cpp | ||
|---|---|---|
| 201 | 201 |
* Device Properties |
| 202 | 202 |
**********************************************************************/ |
| 203 | 203 |
void usrp2_impl::get(const wax::obj &key_, wax::obj &val){
|
| 204 |
wax::obj key; std::string name; |
|
| 205 |
boost::tie(key, name) = extract_named_prop(key_); |
|
| 204 |
named_prop_t key = named_prop_t::extract(key_); |
|
| 206 | 205 |
|
| 207 | 206 |
//handle the get request conditioned on the key |
| 208 | 207 |
switch(key.as<device_prop_t>()){
|
| ... | ... | |
| 212 | 211 |
return; |
| 213 | 212 |
|
| 214 | 213 |
case DEVICE_PROP_MBOARD: |
| 215 |
val = _mboard_dict[name]->get_link(); |
|
| 214 |
val = _mboard_dict[key.name]->get_link();
|
|
| 216 | 215 |
return; |
| 217 | 216 |
|
| 218 | 217 |
case DEVICE_PROP_MBOARD_NAMES: |
| b/host/lib/utils/props.cpp | ||
|---|---|---|
| 29 | 29 |
/* NOP */ |
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 |
typedef boost::tuple<wax::obj, std::string> named_prop_tuple; |
|
| 33 |
|
|
| 34 |
named_prop_tuple uhd::extract_named_prop( |
|
| 32 |
named_prop_t named_prop_t::extract( |
|
| 35 | 33 |
const wax::obj &key, |
| 36 | 34 |
const std::string &name |
| 37 | 35 |
){
|
| 38 | 36 |
if (key.type() == typeid(named_prop_t)){
|
| 39 |
named_prop_t np = key.as<named_prop_t>(); |
|
| 40 |
return named_prop_tuple(np.key, np.name); |
|
| 37 |
return key.as<named_prop_t>(); |
|
| 41 | 38 |
} |
| 42 |
return named_prop_tuple(key, name);
|
|
| 39 |
return named_prop_t(key, name); |
|
| 43 | 40 |
} |
Also available in: Unified diff