Device::Device(struct sr_dev_inst *structure) :
Configurable(structure->driver, structure, NULL),
- StructureWrapper<Context, struct sr_dev_inst>(structure)
+ structure(structure)
{
for (GSList *entry = structure->channels; entry; entry = entry->next)
{
}
HardwareDevice::HardwareDevice(Driver *driver, struct sr_dev_inst *structure) :
+ StructureWrapper(structure),
Device(structure),
driver(driver)
{
return valid_string(sr_input_description_get(structure));
}
+map<string, shared_ptr<Option>> InputFormat::get_options()
+{
+ const struct sr_option **options = sr_input_options_get(structure);
+ auto option_array = shared_ptr<const struct sr_option *>(
+ options, sr_input_options_free);
+ map<string, shared_ptr<Option>> result;
+ for (int i = 0; options[i]; i++)
+ result[options[i]->id] = shared_ptr<Option>(
+ new Option(options[i], option_array), Option::Deleter());
+ return result;
+}
+
shared_ptr<Input> InputFormat::create_input(
map<string, Glib::VariantBase> options)
{
}
return static_pointer_cast<InputDevice>(
- device->get_shared_pointer(context->shared_from_this()));
+ device->get_shared_pointer(shared_from_this()));
}
void Input::send(string data)
check(sr_input_free(structure));
}
-InputDevice::InputDevice(shared_ptr<Input> input, struct sr_dev_inst *sdi) :
- Device(sdi),
+InputDevice::InputDevice(shared_ptr<Input> input,
+ struct sr_dev_inst *structure) :
+ StructureWrapper(structure),
+ Device(structure),
input(input)
{
}