projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Settings: Change view settings shortcuts
[pulseview.git]
/
pv
/
binding
/
device.cpp
diff --git
a/pv/binding/device.cpp
b/pv/binding/device.cpp
index 77c772c088b07dabcbba1ed782339560527dae09..8ef05f05bcfa20baaf608e9975a6beeadaa666cc 100644
(file)
--- a/
pv/binding/device.cpp
+++ b/
pv/binding/device.cpp
@@
-14,11
+14,10
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
*/
-#include <
stdint.h
>
+#include <
cstdint
>
#include <QDebug>
#include <QDebug>
@@
-56,17
+55,12
@@
namespace binding {
Device::Device(shared_ptr<sigrok::Configurable> configurable) :
configurable_(configurable)
{
Device::Device(shared_ptr<sigrok::Configurable> configurable) :
configurable_(configurable)
{
- std::map< const ConfigKey*, std::set<Capability> > keys;
- try {
- keys = configurable->config_keys(ConfigKey::DEVICE_OPTIONS);
- } catch (const Error) {
- return;
- }
+ auto keys = configurable->config_keys();
- for (auto
entr
y : keys) {
- auto key = entry.first;
- auto capabilities =
entry.second
;
+ for (auto
ke
y : keys) {
+
+ auto capabilities =
configurable->config_capabilities(key)
;
if (!capabilities.count(Capability::GET) ||
!capabilities.count(Capability::SET))
if (!capabilities.count(Capability::GET) ||
!capabilities.count(Capability::SET))
@@
-103,12
+97,12
@@
Device::Device(shared_ptr<sigrok::Configurable> configurable) :
case SR_CONF_BUFFERSIZE:
case SR_CONF_TRIGGER_SOURCE:
case SR_CONF_TRIGGER_SLOPE:
case SR_CONF_BUFFERSIZE:
case SR_CONF_TRIGGER_SOURCE:
case SR_CONF_TRIGGER_SLOPE:
- case SR_CONF_FILTER:
case SR_CONF_COUPLING:
case SR_CONF_CLOCK_EDGE:
bind_enum(name, key, capabilities, get, set);
break;
case SR_CONF_COUPLING:
case SR_CONF_CLOCK_EDGE:
bind_enum(name, key, capabilities, get, set);
break;
+ case SR_CONF_FILTER:
case SR_CONF_EXTERNAL_CLOCK:
case SR_CONF_RLE:
case SR_CONF_POWER_OFF:
case SR_CONF_EXTERNAL_CLOCK:
case SR_CONF_RLE:
case SR_CONF_POWER_OFF:
@@
-128,7
+122,10
@@
Device::Device(shared_ptr<sigrok::Configurable> configurable) :
break;
case SR_CONF_PROBE_FACTOR:
break;
case SR_CONF_PROBE_FACTOR:
- bind_int(name, "", pair<int64_t, int64_t>(1, 500), get, set);
+ if (capabilities.count(Capability::LIST))
+ bind_enum(name, key, capabilities, get, set, print_probe_factor);
+ else
+ bind_int(name, "", pair<int64_t, int64_t>(1, 500), get, set);
break;
default:
break;
default:
@@
-146,7
+143,7
@@
void Device::bind_bool(const QString &name,
}
void Device::bind_enum(const QString &name,
}
void Device::bind_enum(const QString &name,
- const ConfigKey *key, std::set<
Capability
> capabilities,
+ const ConfigKey *key, std::set<
const Capability *
> capabilities,
Property::Getter getter,
Property::Setter setter, function<QString (Glib::VariantBase)> printer)
{
Property::Getter getter,
Property::Setter setter, function<QString (Glib::VariantBase)> printer)
{
@@
-180,7
+177,7
@@
QString Device::print_timebase(Glib::VariantBase gvar)
{
uint64_t p, q;
g_variant_get(gvar.gobj(), "(tt)", &p, &q);
{
uint64_t p, q;
g_variant_get(gvar.gobj(), "(tt)", &p, &q);
- return QString::fromUtf8(sr_period_string(p
*
q));
+ return QString::fromUtf8(sr_period_string(p
,
q));
}
QString Device::print_vdiv(Glib::VariantBase gvar)
}
QString Device::print_vdiv(Glib::VariantBase gvar)
@@
-197,5
+194,12
@@
QString Device::print_voltage_threshold(Glib::VariantBase gvar)
return QString("L<%1V H>%2V").arg(lo, 0, 'f', 1).arg(hi, 0, 'f', 1);
}
return QString("L<%1V H>%2V").arg(lo, 0, 'f', 1).arg(hi, 0, 'f', 1);
}
+QString Device::print_probe_factor(Glib::VariantBase gvar)
+{
+ uint64_t factor;
+ factor = g_variant_get_uint64(gvar.gobj());
+ return QString("%1x").arg(factor);
+}
+
} // binding
} // pv
} // binding
} // pv