dxd - dynax driver framework 3.0.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::service::client::driver< device_t > Class Template Referenceabstract

service client driver interface class More...

#include <dx_service_client_driver.h>

Inheritance diagram for dx::service::client::driver< device_t >:
Collaboration diagram for dx::service::client::driver< device_t >:

Classes

struct  property

Public Types

typedef std::conditional_t< held, typename view::template iterator< typename holders::const_iterator >, typename holders::const_iterator > const_iterator
typedef std::conditional_t< held, typename view::template iterator< typename holders::iterator >, typename holders::iterator > iterator
typedef driver map
typedef decltype(matching_idsmatch
typedef driver_settings< dx::promoted< dx::log >::preference< preference_t > > settings
typedef std::conditional_t< held, typename view::value_type, typename holders::value_type > value_type

Public Member Functions

const_iterator begin () const noexcept
iterator begin () noexcept
virtual bool boot ()
void close () noexcept
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.
bool contains (const std::string &id) noexcept
supercreate (const std::string &id, const typename device_t::desc_t &desc) override
virtual drivercreate (const std::string &id, const typename super::device_t::desc_t &)
superdestroy (const std::string &id) override
 driver (const match &matching_ids, const char *product_id, const decltype(super::preference)&preference, dx::log log={})
 the service client driver interface class constructor
 driver (const match &matching_ids, const char *product_id, dx::log log={})
const_iterator end () const noexcept
iterator end () noexcept
void exception (const class exception &exception, bool filtered=false) const noexcept override
 notification exception handler
virtual void exception (const exception &exception, bool filtered=false) const noexcept=0
 notification exception handler
iterator find (const device_id_t &device_id)
const_iterator find (const device_id_t &device_id) const
void info (std::ostream &os) noexcept override
 log object class information
void initialize (const std::string &id="", const ::DWORD(&access)[2]={SC_MANAGER_ALL_ACCESS, SERVICE_ALL_ACCESS}, const std::string desc="", const std::string &path="")
void install (const std::string &name)
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.
void open ()
virtual operator bool () const noexcept
 operator std::unique_ptr<::QUERY_SERVICE_CONFIGA > ()
 operator std::unique_ptr<::SERVICE_DESCRIPTION > ()
 operator::SERVICE_STATUS_PROCESS ()
virtual driveroperator<< (const char *file)
virtual driveroperator<< (std::ifstream &)
 restores device settings
virtual driveroperator>> (const char *file) const
virtual driveroperator>> (std::ostream &ostream) const
 saves device tree
void remove ()
virtual bool shutdown ()
 client driver::shutdown/boot(): override to shutdown/boot host driver
void start (parser::args &args)
void stop ()
dx::service::manager::enumerate promoted this (::DWORD value)
dx::service::manager::status promoted this (promoted::lock_t &&lock, const ::DWORD &value, const ::DWORD &)
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
std::shared_ptr< typename super::device_twait (const std::string &id) noexcept
bool warmup (std::chrono::milliseconds timeout=250ms)
 waits for the initial asynchronous device arrival scan to complete

Public Attributes

dx::promoted< bool > connection_id {false}
elements
 STL member.
keys
 STL member.
std::atomic< bool > launched {}
dx::log log {}
 cached local log level, mirrors settings::log
preference_t preference
const char * product_id
promoted< os_resultstatus {driver_not_connected}
dx::service::manager::enumeratethis
dx::service::manager::statusthis
uint32_t version {DX_VERSION32}

Protected Types

typedef decltype(device_t::id) device_id_t
typedef device_t device_t
typedef std::map< device_id_t, std::shared_ptr< device_t > > holders
typedef service::request< service::stream::data< typename device_t::desc_t > > request

Protected Member Functions

virtual void add (const device_id_t &)=0
 adds a new device to the device list
void add (const device_id_t &device_id) override
 adds a new device to the device list
virtual void arrived ()
 notify device arrivals completed stub
void arrived (super::device_t &device) override
virtual void clear () noexcept
 replaces std::map::clear to call virtual notification methods
virtual void remove (const device_id_t &)=0
 finds and removes a device from the device list
void remove (const device_id_t &device_id) override
 finds and removes a device from the device list
virtual void removed () noexcept
 notify device removals completed stub
virtual void removed (device_t &) noexcept
 notify specific device removal stub
void sleep () override
 < notify system will sleep
void wake () override

Protected Attributes

::DWORD access {}
event< userarrival
std::string desc
::SC_HANDLE handle {}
dx::driver_settings< client::promoted< dx::log, request, uint32_t > > host {pipe, request::id::log}
 the host's settings mirrored, asked over the pipe
std::string id
std::set< dx::guidmatching_ids
std::string path
pipe< requestpipe
::SC_HANDLE service {}

Detailed Description

template<class device_t>
class dx::service::client::driver< device_t >

service client driver interface class

This is the interface to a service client driver identified by a set of matching IDs. The driver class is a helper to create device objects and to bind the device to the driver identified by the set of matching dictionaries.

device arrival/removal is initiated by launch/conclude at driver start/end and as registry notification. Therefor manipulating the device std::deque needs to be locked.

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

Member Typedef Documentation

◆ const_iterator

typedef std::conditional_t<held, typename view::template iterator<typename holders::const_iterator>, typename holders::const_iterator> dx::map::driver< device_t, device_t >::const_iterator
inherited

◆ device_id_t

typedef decltype(device_t::id) dx::map::driver< device_t, device_t >::device_id_t
protectedinherited

◆ device_t

typedef device_t dx::map::driver< device_t, device_t >::device_t
protectedinherited

◆ holders

typedef std::map<device_id_t, std::shared_ptr<device_t> > dx::map::driver< device_t, device_t >::holders
protectedinherited

◆ iterator

typedef std::conditional_t<held, typename view::template iterator<typename holders::iterator>, typename holders::iterator> dx::map::driver< device_t, device_t >::iterator
inherited

◆ map

typedef driver dx::map::driver< device_t, device_t >::map
inherited

◆ match

template<class device_t>
typedef decltype(matching_ids) dx::service::client::driver< device_t >::match

◆ request

template<class device_t>
typedef service::request<service::stream::data<typename device_t::desc_t> > dx::service::client::driver< device_t >::request
protected

◆ settings

template<typename device_id_t, typename preference_t>
typedef driver_settings<dx::promoted<dx::log>::preference<preference_t> > dx::driver< device_id_t, preference_t >::settings
inherited

the driver's own settings: the log a promoted::preference on the store's dx::log::id node, resolved like a stream desc (dx::log's DX_TREE_SERIALIZE), the constructor's log its default - stored as no entry, reloaded on the store's change

◆ value_type

typedef std::conditional_t<held, typename view::value_type, typename holders::value_type> dx::map::driver< device_t, device_t >::value_type
inherited

Constructor & Destructor Documentation

◆ driver() [1/2]

template<class device_t>
dx::service::client::driver< device_t >::driver ( const match & matching_ids,
const char * product_id,
const decltype(super::preference)& preference,
dx::log log = {} )
inline

the service client driver interface class constructor

Parameters
matching_idsthe matching ASIO client driver IDs identifying the driver interface
product_idservice client driver ID
preferencepreference
loglog settings

◆ driver() [2/2]

template<class device_t>
dx::service::client::driver< device_t >::driver ( const match & matching_ids,
const char * product_id,
dx::log log = {} )
inline

Member Function Documentation

◆ add() [1/2]

template<typename device_id_t, typename preference_t>
virtual void dx::driver< device_id_t, preference_t >::add ( const device_id_t & )
protectedpure virtualinherited

adds a new device to the device list

Exceptions
dx::exception

◆ add() [2/2]

void dx::map::driver< device_t, device_t >::add ( const device_id_t & device_id)
inlineoverrideprotectedinherited

adds a new device to the device list

Exceptions
dx::exception
Here is the call graph for this function:
Here is the caller graph for this function:

◆ arrived() [1/2]

( )
protectedvirtualinherited

notify device arrivals completed stub

Reimplemented from dx::driver< device_id_t, preference_t >.

Here is the caller graph for this function:

◆ arrived() [2/2]

void dx::stream::driver< map::driver< device_t > >::arrived ( super::device_t & )
inlineoverrideprotectedvirtualinherited

Reimplemented from dx::map::driver< device_t >.

Here is the caller graph for this function:

◆ begin() [1/2]

const_iterator dx::map::driver< device_t, device_t >::begin ( ) const
inlinenoexceptinherited

◆ begin() [2/2]

iterator dx::map::driver< device_t, device_t >::begin ( )
inlinenoexceptinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ boot()

template<typename device_id_t, typename preference_t>
virtual bool dx::driver< device_id_t, preference_t >::boot ( )
inlinevirtualinherited

Reimplemented in dx::coreaudio::driver< device_t >.

Here is the caller graph for this function:

◆ clear()

virtual void dx::map::driver< device_t, device_t >::clear ( )
inlineprotectedvirtualnoexceptinherited

replaces std::map::clear to call virtual notification methods

Here is the call graph for this function:
Here is the caller graph for this function:

◆ close()

void dx::service::manager::close ( )
inlinenoexceptinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ conclude()

template<class device_t>
void dx::service::client::driver< device_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::map::driver< device_t >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ contains()

bool dx::stream::driver< map::driver< device_t > >::contains ( const std::string & id)
inlinenoexceptinherited

◆ create() [1/2]

template<class device_t>
super & dx::service::client::driver< device_t >::create ( const std::string & id,
const typename device_t::desc_t & desc )
inlineoverride

◆ create() [2/2]

virtual driver & dx::stream::driver< map::driver< device_t > >::create ( const std::string & id,
const typename super::device_t::desc_t &  )
inlinevirtualinherited

◆ destroy()

template<class device_t>
super & dx::service::client::driver< device_t >::destroy ( const std::string & id)
inlineoverridevirtual

Reimplemented from dx::stream::driver< map::driver< device_t > >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end() [1/2]

const_iterator dx::map::driver< device_t, device_t >::end ( ) const
inlinenoexceptinherited

◆ end() [2/2]

iterator dx::map::driver< device_t, device_t >::end ( )
inlinenoexceptinherited
Here is the caller graph for this function:

◆ exception() [1/2]

template<typename device_id_t, typename preference_t>
void dx::driver< device_id_t, preference_t >::exception ( const class exception & exception,
bool filtered = false ) const
inlineoverridenoexceptinherited

notification exception handler

Here is the caller graph for this function:

◆ exception() [2/2]

virtual void dx::object::exception ( const exception & exception,
bool filtered = false ) const
pure virtualnoexceptinherited

notification exception handler

Implemented in dx::asio::client::_device< desc_t, preference_t, stream_t, group_t >, dx::asio::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >, dx::asio::client::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, dx::device< id_t, preference_t >, dx::device< dx::guid, preference >, dx::device< std::string, dx::preference >, dx::device< std::string, preference >, dx::device< std::string, preference_t >, dx::device<::AudioObjectID, cf::preference >, dx::device<::io_service_t, dx::preference >, dx::device<::io_service_t, preference_t >, dx::device<::MIDIDeviceRef, cf::preference >, dx::device<>, dx::proxy::device< preference_t >, dx::proxy::device< preference_t >, dx::proxy::device< dx::preference >, dx::proxy::device<>, dx::service::app, dx::service::client::_device< desc_t, preference_t, stream_t, group_t >, dx::service::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >, dx::service::client::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, dx::service::device< preference_t >, dx::service::device< dx::preference >, dx::service::device< super_device_t >, dx::stream::object< _device_t >, dx::stream::object< device<> >, dx::stream::pin< device_t, _circular_t >, dx::usb::device< preference_t >, dx::usb::device< dx::preference >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< dx::preference >, dx::usb::platform::device< preference_t >, dx::usb::platform::device< preference_t >, dx::usb::stream::pipe< device_t, circular_t, stream_t >, dx::virtuel::stream::_device< desc_t, preference_t, stream_t, group_t >, dx::virtuel::stream::_device< desc, dx::preference, dx::stream::shared::stream< device< desc, dx::preference, dx::stream::shared::stream, group > >, group< device< desc, dx::preference, dx::stream::shared::stream, group > > >, dx::virtuel::stream::_device< desc_t, preference_t, stream_t< device< desc_t, preference_t, stream_t, group_t > >, group_t< device< desc_t, preference_t, stream_t, group_t > > >, and dx::wasapi::client::_device< desc, preference, stream< device< desc, preference, stream, group > >, group< device< desc, preference, stream, group > > >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find() [1/2]

iterator dx::map::driver< device_t, device_t >::find ( const device_id_t & device_id)
inlineinherited
Here is the caller graph for this function:

◆ find() [2/2]

const_iterator dx::map::driver< device_t, device_t >::find ( const device_id_t & device_id) const
inlineinherited

◆ info()

template<class device_t>
void dx::service::client::driver< device_t >::info ( std::ostream & os)
inlineoverridevirtualnoexcept

log object class information

Reimplemented from dx::map::driver< device_t >.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize()

void dx::service::manager::initialize ( const std::string & id = "",
const ::DWORD(&) access[2] = {SC_MANAGER_ALL_ACCESS, SERVICE_ALL_ACCESS},
const std::string desc = "",
const std::string & path = "" )
inlineinherited

◆ install()

void dx::service::manager::install ( const std::string & name)
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ launch()

template<class device_t>
void dx::service::client::driver< device_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::map::driver< device_t >.

Here is the call graph for this function:

◆ open()

void dx::service::manager::open ( )
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool()

template<class device_t>
virtual dx::service::client::driver< device_t >::operator bool ( ) const
inlinevirtualnoexcept

◆ operator std::unique_ptr<::QUERY_SERVICE_CONFIGA >()

dx::service::manager::operator std::unique_ptr<::QUERY_SERVICE_CONFIGA > ( )
inlineinherited
Here is the call graph for this function:

◆ operator std::unique_ptr<::SERVICE_DESCRIPTION >()

dx::service::manager::operator std::unique_ptr<::SERVICE_DESCRIPTION > ( )
inlineinherited
Here is the call graph for this function:

◆ operator::SERVICE_STATUS_PROCESS()

dx::service::manager::operator::SERVICE_STATUS_PROCESS ( )
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<<() [1/2]

virtual driver & dx::map::driver< device_t, device_t >::operator<< ( const char * file)
inlinevirtualinherited

Reimplemented in dx::coreaudio::driver< device_t >.

Here is the call graph for this function:

◆ operator<<() [2/2]

virtual driver & dx::map::driver< device_t, device_t >::operator<< ( std::ifstream & )
inlinevirtualinherited

restores device settings

Reimplemented in dx::coreaudio::driver< device_t >, and dx::coremidi::driver< device_t >.

◆ operator>>() [1/2]

virtual driver & dx::map::driver< device_t, device_t >::operator>> ( const char * file) const
inlinevirtualinherited

◆ operator>>() [2/2]

virtual driver & dx::map::driver< device_t, device_t >::operator>> ( std::ostream & ostream) const
inlinevirtualinherited

saves device tree

Reimplemented in dx::coreaudio::driver< device_t >.

◆ remove() [1/3]

template<typename device_id_t, typename preference_t>
virtual void dx::driver< device_id_t, preference_t >::remove ( const device_id_t & )
protectedpure virtualinherited

finds and removes a device from the device list

◆ remove() [2/3]

void dx::map::driver< device_t, device_t >::remove ( const device_id_t & device_id)
inlineoverrideprotectedinherited

finds and removes a device from the device list

Exceptions
dx::exception
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove() [3/3]

void dx::service::manager::remove ( )
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removed() [1/2]

( )
protectedvirtualinherited

notify device removals completed stub

Reimplemented from dx::driver< device_id_t, preference_t >.

Here is the caller graph for this function:

◆ removed() [2/2]

virtual void dx::map::driver< device_t, device_t >::removed ( device_t & )
inlineprotectedvirtualnoexceptinherited

notify specific device removal stub

Here is the caller graph for this function:

◆ shutdown()

template<typename device_id_t, typename preference_t>
virtual bool dx::driver< device_id_t, preference_t >::shutdown ( )
inlinevirtualinherited

client driver::shutdown/boot(): override to shutdown/boot host driver

Reimplemented in dx::coreaudio::driver< device_t >.

Here is the caller graph for this function:

◆ sleep()

void dx::map::driver< device_t, device_t >::sleep ( )
inlineoverrideprotectedinherited

< notify system will sleep

notify system wake completed stub

◆ start()

void dx::service::manager::start ( parser::args & args)
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void dx::service::manager::stop ( )
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ this() [1/2]

dx::service::manager::enumerate promoted dx::service::manager::this ( ::DWORD value)
inlineinherited

◆ this() [2/2]

dx::service::manager::status promoted dx::service::manager::this ( promoted::lock_t && lock,
const ::DWORD & value,
const ::DWORD &  )
inlineinherited

◆ try_conclude()

bool dx::object::try_conclude ( )
inlinenoexceptinherited

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ try_launch()

bool dx::object::try_launch ( )
inlineinherited

atomically launch()es if not already launched; returns whether this call did it

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait()

std::shared_ptr< typename super::device_t > dx::stream::driver< map::driver< device_t > >::wait ( const std::string & id)
inlinenoexceptinherited

◆ wake()

void dx::map::driver< device_t, device_t >::wake ( )
inlineoverrideprotectedinherited

◆ warmup()

template<class device_t>
bool dx::service::client::driver< device_t >::warmup ( std::chrono::milliseconds timeout = 250ms)
inline

waits for the initial asynchronous device arrival scan to complete

Member Data Documentation

◆ access

::DWORD dx::service::manager::access {}
protectedinherited

◆ arrival

template<class device_t>
event<user> dx::service::client::driver< device_t >::arrival
protected

◆ connection_id

template<class device_t>
dx::promoted<bool> dx::service::client::driver< device_t >::connection_id {false}

◆ desc

std::string dx::service::manager::desc
protectedinherited

◆ elements

T std::map< K, T >::elements
inherited

STL member.

◆ handle

::SC_HANDLE dx::service::manager::handle {}
protectedinherited

◆ host

the host's settings mirrored, asked over the pipe

◆ id

std::string dx::service::manager::id
protectedinherited

◆ keys

K std::map< K, T >::keys
inherited

STL member.

◆ launched

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

◆ log

template<typename device_id_t, typename preference_t>
dx::log dx::driver< device_id_t, preference_t >::log {}
inherited

cached local log level, mirrors settings::log

◆ matching_ids

template<class device_t>
std::set<dx::guid> dx::service::client::driver< device_t >::matching_ids
protected

◆ path

std::string dx::service::manager::path
protectedinherited

◆ pipe

template<class device_t>
pipe<request> dx::service::client::driver< device_t >::pipe
protected
Initial value:
{id, {[this](const request& request){
if(this->log.interface.setup>= dx::log::level::debug){
std::lock_guard lock{io_mutex};
std::clog<< class_name<< "::pipe::listen: "<< request<< std::endl;
}
switch(request.id){
auto id{std::get<dx::string>(*request.data)};
if(!this->matching_ids.size()||
std::find(matching_ids.begin(), matching_ids.end(), id)!=matching_ids.end())
this->add(super::device_id_t(std::get<dx::string>(*request.data)));
}else{
{std::lock_guard lock{*this};
this->arrived();}
this->arrival.signal();
}
break;
break;
}
}}}
virtual void remove(const device_id_t &)=0
finds and removes a device from the device list
dx::log log
Definition dx_driver.h:148
decltype(device_t::id) device_id_t
Definition dx_driver.h:292
service client driver interface class
Definition dx_service_client_driver.h:99
service::request< service::stream::data< typename device_t::desc_t > > request
Definition dx_service_client_driver.h:111
event< user > arrival
Definition dx_service_client_driver.h:110
std::string id
Definition dx_service.h:187
std::recursive_mutex io_mutex
Definition dx_common.cpp:42
Definition dx_service_request.h:33
id
Definition dx_service_request.h:34
@ arrived
Definition dx_service_request.h:39
data_t data
Definition dx_service_request.h:61
@ debug
Definition dx_log.h:48

◆ preference

template<typename device_id_t, typename preference_t>
preference_t dx::driver< device_id_t, preference_t >::preference
inherited

◆ product_id

template<typename device_id_t, typename preference_t>
const char* dx::driver< device_id_t, preference_t >::product_id
inherited

◆ service

::SC_HANDLE dx::service::manager::service {}
protectedinherited

◆ status

template<typename device_id_t, typename preference_t>
promoted<os_result> dx::driver< device_id_t, preference_t >::status {driver_not_connected}
inherited

◆ this [1/2]

dx::service::manager::enumerate* dx::service::manager::this
inherited
Initial value:
{[this](::DWORD value){
switch(value){
case SERVICE_NOTIFY_DELETE_PENDING:
close();
break;
}}}}
void close() noexcept
Definition dx_service.h:375

◆ this [2/2]

dx::service::manager::status* dx::service::manager::this
inherited

◆ version

template<typename device_id_t, typename preference_t>
uint32_t dx::driver< device_id_t, preference_t >::version {DX_VERSION32}
inherited

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

(c) copyright 2009 dynamic acoustics e.U. generated on

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.