MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / ProbeOptions

Method ProbeOptions

DSView/pv/prop/binding/probeoptions.cpp:42–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40namespace binding {
41
42ProbeOptions::ProbeOptions(struct sr_channel *probe) :
43 Binding(),
44 _probe(probe)
45{
46 GVariant *gvar_opts;
47 gsize num_opts;
48
49 SigSession *session = AppControl::Instance()->GetSession();
50 _device_agent = session->get_device();
51
52 gvar_opts = _device_agent->get_config_list(NULL, SR_CONF_PROBE_CONFIGS);
53 if (gvar_opts == NULL){
54 /* Driver supports no device instance options. */
55 return;
56 }
57
58 const int *const options = (const int32_t *)g_variant_get_fixed_array(
59 gvar_opts, &num_opts, sizeof(int32_t));
60
61 for (unsigned int i = 0; i < num_opts; i++)
62 {
63 const struct sr_config_info *const info =
64 _device_agent->get_config_info(options[i]);
65
66 if (!info)
67 continue;
68
69 const int key = info->key;
70
71 GVariant *gvar_list = _device_agent->get_config_list(NULL, key);
72
73 const QString name(info->name);
74 const char *label_char = LangResource::Instance()->get_lang_text(STR_PAGE_DSL, info->name, info->name);
75 const QString label(label_char);
76
77 switch(key)
78 {
79 case SR_CONF_PROBE_VDIV:
80 bind_vdiv(name, label, gvar_list);
81 break;
82
83 case SR_CONF_PROBE_MAP_MIN:
84 case SR_CONF_PROBE_MAP_MAX:
85 bind_double(name, label, key, "",
86 pair<double, double>(-999999.99, 999999.99), 2, 0.01);
87 break;
88
89 case SR_CONF_PROBE_COUPLING:
90 bind_coupling(name, label, gvar_list);
91 break;
92
93 case SR_CONF_PROBE_MAP_UNIT:
94 bind_enum(name, label, key, gvar_list);
95 break;
96
97 case SR_CONF_PROBE_MAP_DEFAULT:
98 bind_bool(name, label, key);
99 break;

Callers

nothing calls this directly

Calls 5

GetSessionMethod · 0.80
get_deviceMethod · 0.80
get_config_listMethod · 0.80
get_config_infoMethod · 0.80
get_lang_textMethod · 0.80

Tested by

no test coverage detected