X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fbinding%2Fdevice.cpp;h=3ebc9f9f41839b67d0d6fac1b8cb4d26f7b5ff33;hb=56853c982046f78abe433f4f096f9305f8bcf806;hp=026ca16c6b49354f5e51cbbe89b59a1c09f5bf86;hpb=7bb0fbf4d3809dbbd0fe5b35fc7e475b1065ae20;p=pulseview.git
diff --git a/pv/binding/device.cpp b/pv/binding/device.cpp
index 026ca16..3ebc9f9 100644
--- a/pv/binding/device.cpp
+++ b/pv/binding/device.cpp
@@ -14,27 +14,27 @@
* 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 .
*/
-#include
+#include
#include
#include "device.hpp"
#include
-#include
#include
#include
#include
using boost::optional;
+
using std::function;
using std::make_pair;
using std::pair;
+using std::set;
using std::shared_ptr;
using std::string;
using std::vector;
@@ -45,7 +45,6 @@ using sigrok::ConfigKey;
using sigrok::Error;
using pv::prop::Bool;
-using pv::prop::Double;
using pv::prop::Enum;
using pv::prop::Int;
using pv::prop::Property;
@@ -98,12 +97,12 @@ Device::Device(shared_ptr configurable) :
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_FILTER:
case SR_CONF_EXTERNAL_CLOCK:
case SR_CONF_RLE:
case SR_CONF_POWER_OFF:
@@ -123,7 +122,10 @@ Device::Device(shared_ptr configurable) :
break;
case SR_CONF_PROBE_FACTOR:
- bind_int(name, "", pair(1, 500), get, set);
+ if (capabilities.count(Capability::LIST))
+ bind_enum(name, key, capabilities, get, set, print_probe_factor);
+ else
+ bind_int(name, "", pair(1, 500), get, set);
break;
default:
@@ -141,7 +143,7 @@ void Device::bind_bool(const QString &name,
}
void Device::bind_enum(const QString &name,
- const ConfigKey *key, std::set capabilities,
+ const ConfigKey *key, set capabilities,
Property::Getter getter,
Property::Setter setter, function printer)
{
@@ -162,7 +164,7 @@ void Device::bind_enum(const QString &name,
}
void Device::bind_int(const QString &name, QString suffix,
- optional< std::pair > range,
+ optional< pair > range,
Property::Getter getter, Property::Setter setter)
{
assert(configurable_);
@@ -175,7 +177,7 @@ QString Device::print_timebase(Glib::VariantBase gvar)
{
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)
@@ -192,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);
}
-} // binding
-} // pv
+QString Device::print_probe_factor(Glib::VariantBase gvar)
+{
+ uint64_t factor;
+ factor = g_variant_get_uint64(gvar.gobj());
+ return QString("%1x").arg(factor);
+}
+
+} // namespace binding
+} // namespace pv