dxd - dynax driver framework 3.0.2
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::service::client::_device< desc_t, preference_t, stream_t, group_t > Class Template Reference

service client streaming device interface class: the device the service hosts under <product id>/<puuid>, its settings the service's - mirrored as a kernel driver's values are (dx::proxy::promoted) over the connection More...

#include <dx_service_client_device.h>

Inheritance diagram for dx::service::client::_device< desc_t, preference_t, stream_t, group_t >:
Collaboration diagram for dx::service::client::_device< desc_t, preference_t, stream_t, group_t >:

Classes

struct  mirror
 the transport settings' mirror (dx::stream::settings, a hosted device's): the setting mapped to the service's IOCTL More...

Public Types

typedef desc_t desc_t
typedef shared::event event_t
typedef promoted<uint32_t>::template preference<decltype(super_device_t::preference)> source_t
typedef dx::device<std::string, preference_t> super_device_t
 the device this streaming device sits on: its own operations of a name this class takes for itself (a USB device's configuration()) are reached through it

Public Member Functions

virtual desc_t::configuration align(const typename desc_t::configuration& value, const typename desc_t::configuration &)
 a configuration the device can run: every stream's index within its configurations, one past them the stream off - a bus device narrows it to what its bus carries, the streams value leaves as current has them standing
void attach(void** io[dx::stream::direction::directions][2], const std::vector<bool>(& channel_map)[2], const dx::stream::format(& format)[2])
 the consumer's planar channel buffers in the format each direction's buffers carry
virtual uint64_t budget(const typename desc_t::configuration &)
 the periodic bus time the configuration takes, in ns - a bus device with a periodic budget states it
void conclude() noexcept override
 conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy.
void exception(const dx::exception& exception, bool filtered= false) const noexcept override
 notification exception handler
virtual uint64_t frame() const
void hw_clock(abstract::event *event, uint32_t iosize) override
 registers a consumer with the device's clock: it is signalled every iosize samples of the clock's own advance. A bus whose driver owns the clock hands the registration on instead
virtual bool hw_clock() const noexcept
void launch() override
 launch notification: object mounted and ready to use. Called only through try_launch() - never call this directly from outside the class hierarchy.
std::shared_ptr<stream_t> open(const typename desc_t::stream::desc& descdesc, bool client= false)
 the desc's stream: the registered one, else created, registered and launched - a host's client takes a data driven stream alone, its ring has one writer and one reader
const struct desc_t::stream::config& operator ()(const struct desc_t::stream& stream)
 the stream configuration the device runs the stream in: the stream is one of the desc's
virtual device& operator >>(std::ostream &) const
 the device's own diagnostics, beyond its operator <<
group_t& operator [](const typename desc_t::stream::desc& stream)
 the stream's group, created on first use
_device& reset()
void setting(dx::stream::setting setting, uint32_t index, f_t&& f)
 the setting a host keeps for its clients handed to f as its promoted: the transport settings the sync reference's group's, the source the one of the stream whose target index is index
virtual void sleep()
 notify system will sleep stub
virtual std::pair<source_t &, bool> source(const struct desc_t::stream& stream)
 the stream's source selector, created on first use: the preference by stream target, the value an index into the stream's sources
std::string string(uint32_t idx)
bool try_conclude() noexcept
 atomically conclude()s if currently launched; returns whether this call did it
bool try_launch()
 atomically launch()es if not already launched; returns whether this call did it. A launch() that throws is concluded before the exception leaves: the object never claims a launch it did not finish
void wake() override
 ~_device() override

Public Attributes

dx::promoted<typename super::client_map> clients
proxy::promoted<service::connection, uint32_t> clocksource{connection, dx::ioctl::service::clocksource}
proxy::promoted<service::connection, typename desc_t::configuration> configuration{connection, dx::ioctl::service::configuration}
proxy::promoted<service::connection, desc_t> desc{connection, dx::ioctl::service::desc}
 the service's desc, asked at launch()
dx::driver<decltype(id), preference_t>& driver
std::map<decltype(desc_t::stream::group), group_t> group
struct dx::stream::device:: { ... }  hw
promoted<std::string>::preference<decltype(super::preference)> icon
const std::string id
promoted<uint32_t>::preference<decltype(super::preference)> iosize
std::atomic<bool> launched
dx::stream::device::monitor monitor
preference_t preference
std::string puid
 persistent UID - system unique - could change with location
std::string puuid
 persistent universal UID - universally unique ID (i.e. serial number)
dx::shared::reference reference
 this process' crash-safe hold on the puuid's client-local preference store
proxy::promoted<service::connection, uint32_t> samplerate{connection, dx::ioctl::service::samplerate}
 < the service's device settings, mirrored: nothing of them persists here
std::map<decltype(desc_t::stream::target.idx()), source_t> sources
promoted<structdesc_t::stream *>::template preference<decltype(super::preference), uint32_t> sync_reference
dx::stream::device::monitor version

Static Public Attributes

static constexpr bool hosted{true}

Protected Member Functions

virtual void grouped(group_t &)
 operator[](): a group just came into existence, a host wires its per-group transports here

Protected Attributes

service::connection connection{std::string{this->driver.product_id}+ "/"+ this->id}

Friends

template<typename>
class client::group
 the app wraps this bus's own group, so friendship has to name it, not just the device's group_t ////////////////////////////////////////////////////////////////////////////

Detailed Description

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
class dx::service::client::_device< desc_t, preference_t, stream_t, group_t >

service client streaming device interface class: the device the service hosts under <product id>/<puuid>, its settings the service's - mirrored as a kernel driver's values are (dx::proxy::promoted) over the connection

Exceptions
Incase of an error returned by the underlaying API the device class throws a dx::exception.

Member Typedef Documentation

◆ desc_t

typedef desc_t dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::desc_t
inherited

◆ event_t

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
typedef shared::event dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::event_t

◆ source_t

typedef promoted<uint32_t>::template preference<decltype(super_device_t::preference)> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::source_t
inherited

◆ super_device_t

typedef dx::device<std::string, preference_t> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::super_device_t
inherited

the device this streaming device sits on: its own operations of a name this class takes for itself (a USB device's configuration()) are reached through it

Constructor & Destructor Documentation

◆ ~_device()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::~_device()
inlineoverride

Member Function Documentation

◆ align()

virtual desc_t::configuration dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::align(const typename desc_t::configuration& value, const typename desc_t::configuration&)
inlinevirtualinherited

a configuration the device can run: every stream's index within its configurations, one past them the stream off - a bus device narrows it to what its bus carries, the streams value leaves as current has them standing

◆ attach()

void dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::attach(void** io[dx::stream::direction::directions][2], const std::vector<bool>(&) channel_map[2], const dx::stream::format(&) format[2])
inlineinherited

the consumer's planar channel buffers in the format each direction's buffers carry

◆ budget()

virtual uint64_t dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::budget(const typename desc_t::configuration&)
inlinevirtualinherited

the periodic bus time the configuration takes, in ns - a bus device with a periodic budget states it

◆ conclude()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::conclude()
inlineoverridevirtualnoexcept

conclude notification: object will be removed. If you overwrite conclude() you also need to overwrite destructor and check if its needed to be called from there. Called only through try_conclude() - never call this directly from outside the class hierarchy.

Reimplemented from dx::object.

◆ exception()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::exception(const dx::exception& exception, bool filtered= false) const
inlineoverridevirtualnoexcept

notification exception handler

Reimplemented from dx::device< std::string, preference_t >.

◆ frame()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
virtual uint64_t dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::frame() const
inlinevirtual

◆ grouped()

virtual void dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::grouped(group_t&)
inlineprotectedvirtualinherited

operator[](): a group just came into existence, a host wires its per-group transports here

◆ hw_clock() [1/2]

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::hw_clock(abstract::event* hw_clock, uint32_t iosize)
inlineoverridevirtual

registers a consumer with the device's clock: it is signalled every iosize samples of the clock's own advance. A bus whose driver owns the clock hands the registration on instead

Reimplemented from dx::stream::device< dx::device< std::string, preference_t >, desc_t, stream_t, group_t >.

◆ hw_clock() [2/2]

virtual bool dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::hw_clock() const
inlinevirtualnoexceptinherited
Here is the caller graph for this function:

◆ launch()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
void dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::launch()
inlineoverridevirtual

launch notification: object mounted and ready to use. Called only through try_launch() - never call this directly from outside the class hierarchy.

Reimplemented from dx::object.

◆ open()

std::shared_ptr<stream_t> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::open(const typename desc_t::stream::desc& desc, bool client= false)
inlineinherited

the desc's stream: the registered one, else created, registered and launched - a host's client takes a data driven stream alone, its ring has one writer and one reader

◆ operator ()()

const struct desc_t::stream::config& dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::operator ()(const struct desc_t::stream& stream)
inlineinherited

the stream configuration the device runs the stream in: the stream is one of the desc's

◆ operator >>()

virtual device& dx::device<std::string, preference_t>::operator >>(std::ostream&) const
inlinevirtualinherited

the device's own diagnostics, beyond its operator <<

◆ operator []()

group_t& dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::operator [](const typename desc_t::stream::desc& stream)
inlineinherited

the stream's group, created on first use

◆ reset()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
_device& dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::reset()
inline

◆ setting()

void dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::setting(dx::stream::setting setting, uint32_t index, f_t&& f)
inlineinherited

the setting a host keeps for its clients handed to f as its promoted: the transport settings the sync reference's group's, the source the one of the stream whose target index is index

Here is the caller graph for this function:

◆ sleep()

virtual void dx::device<std::string, preference_t>::sleep()
inlinevirtualinherited

notify system will sleep stub

◆ source()

virtual std::pair<source_t &, bool> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::source(const struct desc_t::stream& stream)
inlinevirtualinherited

the stream's source selector, created on first use: the preference by stream target, the value an index into the stream's sources

◆ string()

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
std::string dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::string(uint32_t idx)
inline

◆ try_conclude()

bool dx::object::try_conclude()
inlinenoexceptinherited

atomically conclude()s if currently launched; returns whether this call did it

◆ try_launch()

bool dx::object::try_launch()
inlineinherited

atomically launch()es if not already launched; returns whether this call did it. A launch() that throws is concluded before the exception leaves: the object never claims a launch it did not finish

◆ wake()

void dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::wake()
inlineoverridevirtualinherited

◆ client::group

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
template<typename>
friend class client::group
friend

the app wraps this bus's own group, so friendship has to name it, not just the device's group_t ////////////////////////////////////////////////////////////////////////////

Member Data Documentation

◆ clients

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::promoted<typename super::client_map> dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::clients
Initial value:
{
[this](dx::promoted<typename super::client_map>::lock_t&& lock, const typename super::client_map& value, const typename super::client_map&){
dx::promoted<uint32_t>::lock_t tmp(std::move(lock));
if(clients.transient)
clients.commit(std::move(tmp), value);
else if(!clients.initialized)
clients.initialized= true;
}}
std::unique_lock< mutex_t > lock_t
Definition dx_value.h:75
dx::promoted< typename super::client_map > clients
Definition dx_service_client_device.h:157

◆ clocksource

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
proxy::promoted<service::connection, uint32_t> dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::clocksource{connection, dx::ioctl::service::clocksource}

◆ configuration

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
proxy::promoted<service::connection, typename desc_t::configuration> dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::configuration{connection, dx::ioctl::service::configuration}

the service runs the configuration: its streams' rings are the service's

◆ connection

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
service::connection dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::connection{std::string{this->driver.product_id}+ "/"+ this->id}
protected

◆ desc

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
proxy::promoted<service::connection, desc_t> dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::desc{connection, dx::ioctl::service::desc}

the service's desc, asked at launch()

◆ driver

dx::driver<decltype(id), preference_t>& dx::device<std::string, preference_t>::driver
inherited

◆ group

std::map<decltype(desc_t::stream::group), group_t> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::group
inherited

streaming groups by desc::stream::group id: every stream of this device is registered with its group - behind the settings its groups listen to, so they go first

◆ hosted

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
bool dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::hosted{true}
staticconstexpr

◆ hw

struct { ... } dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::hw

◆ icon

promoted<std::string>::preference<decltype(super::preference)> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::icon
inherited

◆ id

const std::string dx::device<std::string, preference_t>::id
inherited

◆ iosize

promoted<uint32_t>::preference<decltype(super::preference)> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::iosize
inherited

◆ launched

std::atomic<bool> dx::object::launched
inherited

◆ monitor

dx::stream::device::monitor dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::monitor
inherited

◆ preference

preference_t dx::device<std::string, preference_t>::preference
inherited

◆ puid

std::string dx::device<std::string, preference_t>::puid
inherited

persistent UID - system unique - could change with location

◆ puuid

std::string dx::device<std::string, preference_t>::puuid
inherited

persistent universal UID - universally unique ID (i.e. serial number)

◆ reference

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
dx::shared::reference dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::reference
Initial value:
{
std::string puuid
Definition dx_device.h:52
const char * product_id
Definition dx_driver.h:151
the service's device tree as a client sees it: its devices the service's (dx::ioctl::service::devices...
Definition dx_service_client_driver.h:48
inline ::pid_t pid() noexcept
Definition macOS/dx_sync.h:356
std::string name(::pid_t pid=::getpid())
Definition macOS/dx_sync.h:357
static constexpr auto bus
Definition dx_service_client_driver.h:90

this process' crash-safe hold on the puuid's client-local preference store

dx::device::preference (driver.preference[puuid]) is this client process' own settings cache for the device - distinct from the service's own copy. The preference path is namespaced per connecting application (the driver's constructor, process::name()): several instances of the same application share it, so conclude() erases it only where this instance was its last holder - reference is that hold, released by the OS at the process' end even on a crash (dx_shared_reference.h); release() runs the erase where this was the last holder.

◆ samplerate

template<typename desc_t, typename preference_t, typename stream_t, typename group_t>
proxy::promoted<service::connection, uint32_t> dx::service::client::_device<desc_t, preference_t, stream_t, group_t>::samplerate{connection, dx::ioctl::service::samplerate}

< the service's device settings, mirrored: nothing of them persists here

◆ sources

std::map<decltype(desc_t::stream::target.idx()), source_t> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::sources
inherited

source selectors by stream target: a stream with sources gets its own on first use

◆ sync_reference

promoted<structdesc_t::stream*>::template preference<decltype(super::preference), uint32_t> dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::sync_reference
inherited

◆ version

dx::stream::device::monitor dx::stream::device<dx::device<std::string, preference_t>, desc_t, stream_t, group_t>::version
inherited

The documentation for this class was generated from the following file: