dxd - dynax driver framework 3.0.1d223
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::service::device< preference_t > Class Template Reference

the registry entry behind a device: its class, the bundle that provides it and every property it publishes More...

#include <dx_service_device.h>

Inheritance diagram for dx::service::device< preference_t >:
Collaboration diagram for dx::service::device< preference_t >:

Classes

class  promoted
 service::device::chain handle request to/from device::promoted and pipe More...
class  user_client
 user client connection The each user_client holds a shared device reference. More...

Public Types

typedef shared::event event_t

Public Member Functions

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.
auto count () const noexcept
 device (decltype(super::driver)&driver, ::io_service_t id)
 the device class constructor
void exception (const dx::exception &exception, bool filtered=false) const noexcept override
 notification exception handler
template<typename value_t, typename = cf::enable_if_convertible<value_t>>
value_t get (::CFStringRef key) const
::CFTypeRef get (::CFStringRef key) const
template<typename value_t, typename = cf::enable_if_convertible<value_t>>
value_t get (::CFStringRef key, ::CFTypeRef dflt) const noexcept
::CFTypeRef get (::CFStringRef key, ::CFTypeRef dflt) const noexcept
template<typename value_t, typename = cf::enable_if_convertible<value_t>>
value_t get (::CFStringRef key, value_t dflt) const noexcept
template<typename key_t, typename value_t, typename = cf::enable_if_convertible<key_t>, typename = cf::enable_if_convertible<value_t>>
value_t get (key_t key) const
template<typename key_t, typename = cf::enable_if_convertible<key_t>>
::CFTypeRef get (key_t key) const
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.
 operator const ::io_registry_entry_t & () const noexcept
 auto converter into const io_object
 operator const ::io_registry_entry_t & () const noexcept
 auto converter into const io_object
 operator uint64_t () const
 operator::CFMutableDictionaryRef () const
 operator::CFStringRef () const
 operator::io_registry_entry_t & () noexcept
 auto converter into io_object
 operator::io_registry_entry_t & () noexcept
 auto converter into io_object
 operator::io_registry_entry_t * () noexcept
 auto converter into io_object pointer
 operator::io_registry_entry_t * () noexcept
 auto converter into io_object pointer
bool operator== (::io_registry_entry_t io_object) const noexcept
virtual device & operator>> (std::ostream &) const
 the device's own diagnostics, beyond its operator <<
::CFTypeRef operator[] (::CFStringRef key) const
template<typename key_t, typename = cf::enable_if_convertible<key_t>>
::CFTypeRef operator[] (key_t key) const
registry parent () const
reference & retain ()
registry & set (::CFStringRef key, ::CFTypeRef value)
template<typename value_t, typename = cf::enable_if_convertible<value_t>>
registry & set (::CFStringRef key, value_t value)
registry & set (::CFTypeRef properties)
 Setting properties in a registry entry is not generally supported, it is more common to support setting of properties of the connection based property setting of dx::device.
template<typename key_t, typename = cf::enable_if_convertible<key_t>>
registry & set (key_t key, ::CFTypeRef value)
template<typename key_t, typename value_t, typename = cf::enable_if_convertible<key_t>, typename = cf::enable_if_convertible<value_t>>
registry & set (key_t key, value_t value)
virtual void sleep ()
 notify system will sleep stub
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
virtual void wake ()
 notify system wake completed stub

Public Attributes

dx::driver< decltype(id), preference_t > & driver
const ::io_service_t id
std::atomic< bool > launched
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)

Protected Types

typedef service::request< service::stream::data< typename super_device_t::desc_t > > request
typedef pipe< request >::template server< user_client, std::weak_ptr< device > > server
 pipe::server connecting user_clients The pipe holds a std::weak_ptr<device> as a temporary by the pipe::server::args variadic tuple to create shared device references for the user_client. At time of device construction there is not yet a std::shared_ptr<device>, therefore the pipe::server::args weak_ptr assignment happens at service::device::launch().

Protected Member Functions

void grouped (typename super::group_t &group) override

Protected Attributes

class dx::service::device::promoted clocksource
class dx::service::device::promoted configuration
std::list< promoted > group_server
 per-group chains, wired as each group comes into existence (grouped())
struct dx::service::device:: { ... }  kernel
class dx::service::device::promoted pipe
server pipe
class dx::service::device::promoted samplerate

Friends

std::ostream & operator<< (std::ostream &os, device &device)

Detailed Description

template<typename preference_t>
class dx::service::device< preference_t >

the registry entry behind a device: its class, the bundle that provides it and every property it publishes

device - hosts a per-device pipe::server, keyed by puuid, separate from the driver-level control pipe Each connected client is represented by a user_client instance holding a std::shared_ptr<device>, so the device stays alive for as long as any client stays connected to it. conclude() stops that pipe before calling super::conclude(); since pipe::server::stop() unconditionally joins every instance - connected or not - this releases every user_client's device reference synchronously, within the same call. A caller holding the last other std::shared_ptr<device> (e.g. map::driver::remove()) is therefore guaranteed to reach a zero refcount, and run the device's destructor, before conclude() returns - independent of any further pipe activity. This is what lets a deferred cleanup step tied to the device's own destruction (e.g. the Windows registry preference's schedule_erase, dx_registry.h) complete within the same remove() call instead of depending on a future connection.

Member Typedef Documentation

◆ event_t

template<typename preference_t>
typedef shared::event dx::service::device< preference_t >::event_t

◆ request

template<typename preference_t>
typedef service::request<service::stream::data<typename super_device_t::desc_t> > dx::service::device< preference_t >::request
protected

◆ server

template<typename preference_t>
typedef pipe<request>::template server<user_client, std::weak_ptr<device> > dx::service::device< preference_t >::server
protected

pipe::server connecting user_clients The pipe holds a std::weak_ptr<device> as a temporary by the pipe::server::args variadic tuple to create shared device references for the user_client. At time of device construction there is not yet a std::shared_ptr<device>, therefore the pipe::server::args weak_ptr assignment happens at service::device::launch().

Constructor & Destructor Documentation

◆ device()

template<typename preference_t>
dx::service::device< preference_t >::device ( decltype(super::driver)& driver,
::io_service_t id )
inline

the device class constructor

Exceptions
kIOReturnNoMemory means that the system couldn't allocate the class defined in the drivers plist, or nub which ever its trying connecting to
Parameters
driverdevice tree hosting dx::driver
idthe IOService object to open the device connection for. This will be retained during device class lifetime

Member Function Documentation

◆ conclude()

template<typename preference_t>
void dx::service::device< preference_t >::conclude ( )
inlineoverridevirtualnoexcept

◆ count()

auto io::reference< ::io_registry_entry_t >::count ( ) const
inlinenoexceptinherited
Here is the caller graph for this function:

◆ exception()

template<typename preference_t>
void dx::service::device< preference_t >::exception ( const dx::exception & exception,
bool filtered = false ) const
inlineoverridevirtualnoexcept

notification exception handler

Reimplemented from dx::device<::io_service_t, preference_t >.

Reimplemented in 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 >, and dx::usb::platform::device< preference_t >.

Here is the caller graph for this function:

◆ get() [1/7]

template<typename value_t, typename = cf::enable_if_convertible<value_t>>
value_t io::registry::get ( ::CFStringRef key) const
inlineinherited
Here is the call graph for this function:

◆ get() [2/7]

::CFTypeRef io::registry::get ( ::CFStringRef key) const
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [3/7]

template<typename value_t, typename = cf::enable_if_convertible<value_t>>
value_t io::registry::get ( ::CFStringRef key,
::CFTypeRef dflt ) const
inlinenoexceptinherited
Here is the call graph for this function:

◆ get() [4/7]

::CFTypeRef io::registry::get ( ::CFStringRef key,
::CFTypeRef dflt ) const
inlinenoexceptinherited
Here is the call graph for this function:

◆ get() [5/7]

template<typename value_t, typename = cf::enable_if_convertible<value_t>>
value_t io::registry::get ( ::CFStringRef key,
value_t dflt ) const
inlinenoexceptinherited
Here is the call graph for this function:

◆ get() [6/7]

template<typename key_t, typename value_t, typename = cf::enable_if_convertible<key_t>, typename = cf::enable_if_convertible<value_t>>
value_t io::registry::get ( key_t key) const
inlineinherited
Here is the call graph for this function:

◆ get() [7/7]

template<typename key_t, typename = cf::enable_if_convertible<key_t>>
::CFTypeRef io::registry::get ( key_t key) const
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ grouped()

template<typename preference_t>
void dx::service::device< preference_t >::grouped ( typename super::group_t & group)
inlineoverrideprotected

◆ launch()

◆ operator const ::io_registry_entry_t &() [1/2]

io::reference< ::io_registry_entry_t >::operator const ::io_registry_entry_t & ( ) const
inlinenoexceptinherited

auto converter into const io_object

◆ operator const ::io_registry_entry_t &() [2/2]

io::reference< ::io_registry_entry_t >::operator const ::io_registry_entry_t & ( ) const
inlinenoexceptinherited

auto converter into const io_object

◆ operator uint64_t()

io::registry::operator uint64_t ( ) const
inlineexplicitinherited

◆ operator::CFMutableDictionaryRef()

io::registry::operator::CFMutableDictionaryRef ( ) const
inlineexplicitinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator::CFStringRef()

io::registry::operator::CFStringRef ( ) const
inlineexplicitinherited
Here is the caller graph for this function:

◆ operator::io_registry_entry_t &() [1/2]

io::reference< ::io_registry_entry_t >::operator ::io_registry_entry_t & ( )
inlinenoexceptinherited

auto converter into io_object

◆ operator::io_registry_entry_t &() [2/2]

io::reference< ::io_registry_entry_t >::operator ::io_registry_entry_t & ( )
inlinenoexceptinherited

auto converter into io_object

◆ operator::io_registry_entry_t *() [1/2]

io::reference< ::io_registry_entry_t >::operator ::io_registry_entry_t * ( )
inlinenoexceptinherited

auto converter into io_object pointer

◆ operator::io_registry_entry_t *() [2/2]

io::reference< ::io_registry_entry_t >::operator ::io_registry_entry_t * ( )
inlinenoexceptinherited

auto converter into io_object pointer

◆ operator==()

bool io::reference< ::io_registry_entry_t >::operator== ( ::io_registry_entry_t io_object) const
inlinenoexceptinherited

◆ operator>>()

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

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

Here is the call graph for this function:

◆ operator[]() [1/2]

::CFTypeRef io::registry::operator[] ( ::CFStringRef key) const
inlineinherited
Here is the call graph for this function:

◆ operator[]() [2/2]

template<typename key_t, typename = cf::enable_if_convertible<key_t>>
::CFTypeRef io::registry::operator[] ( key_t key) const
inlineinherited
Here is the call graph for this function:

◆ parent()

registry io::registry::parent ( ) const
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retain()

reference & io::reference< ::io_registry_entry_t >::retain ( )
inlineinherited
Here is the caller graph for this function:

◆ set() [1/5]

registry & io::registry::set ( ::CFStringRef key,
::CFTypeRef value )
inlineinherited
Here is the call graph for this function:

◆ set() [2/5]

template<typename value_t, typename = cf::enable_if_convertible<value_t>>
registry & io::registry::set ( ::CFStringRef key,
value_t value )
inlineinherited
Here is the call graph for this function:

◆ set() [3/5]

registry & io::registry::set ( ::CFTypeRef properties)
inlineinherited

Setting properties in a registry entry is not generally supported, it is more common to support setting of properties of the connection based property setting of dx::device.

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

◆ set() [4/5]

template<typename key_t, typename = cf::enable_if_convertible<key_t>>
registry & io::registry::set ( key_t key,
::CFTypeRef value )
inlineinherited
Here is the call graph for this function:

◆ set() [5/5]

template<typename key_t, typename value_t, typename = cf::enable_if_convertible<key_t>, typename = cf::enable_if_convertible<value_t>>
registry & io::registry::set ( key_t key,
value_t value )
inlineinherited
Here is the call graph for this function:

◆ sleep()

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

notify system will sleep stub

◆ 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()

virtual void dx::device< ::io_service_t, preference_t >::wake ( )
inlinevirtualinherited

notify system wake completed stub

◆ operator<<

template<typename preference_t>
std::ostream & operator<< ( std::ostream & os,
device< preference_t > & device )
friend

Member Data Documentation

◆ clocksource

template<typename preference_t>
class dx::service::device::promoted dx::service::device< preference_t >::clocksource
protected

◆ configuration

template<typename preference_t>
class dx::service::device::promoted dx::service::device< preference_t >::configuration
protected

◆ driver

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

◆ group_server

template<typename preference_t>
std::list<promoted> dx::service::device< preference_t >::group_server
protected

per-group chains, wired as each group comes into existence (grouped())

◆ id

const ::io_service_t dx::device< ::io_service_t, preference_t >::id
inherited

◆ kernel

struct { ... } dx::service::device< preference_t >::kernel

◆ launched

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

◆ pipe [1/2]

template<typename preference_t>
class dx::service::device::promoted dx::service::device< preference_t >::pipe
protected

◆ pipe [2/2]

template<typename preference_t>
class dx::service::device::promoted dx::service::device< preference_t >::pipe
protected
Initial value:
{
std::string{this->driver.product_id}+ "/"+ this->puuid,
{[this](class server::instance& instance, const request& request){
{
if(this->driver.log.bus.setup>= dx::log::level::debug)
std::clog<< class_name<< "<"<< this->puuid<< ">::pipe::listen: "<< request<< std::endl;
switch(request.id){
if constexpr(requires{std::declval<device>().desc;})
this->desc= std::get<super::desc_t>(*request.data);
break;
}
instance<< device::request{.id= request.id, .data= static_cast<typename super::desc_t>(*this)};
break;
}
}
}},{}}
dx::driver< decltype(id), preference_t > & driver
Definition dx_device.h:54
std::string puuid
Definition dx_device.h:52
const char * product_id
Definition dx_driver.h:149
dx::log log
cached local log level, mirrors settings::log
Definition dx_driver.h:153
service::request< service::stream::data< typename super_device_t::desc_t > > request
Definition dx_service_device.h:66
one message on the service's pipe: what is asked, what came back and the value it carries....
Definition dx_service_request.h:34
@ desc
Definition dx_service_request.h:44
data_t data
Definition dx_service_request.h:63
@ debug
Definition dx_log.h:54

◆ preference

preference_t dx::device< ::io_service_t, preference_t >::preference
inherited

◆ puid

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

persistent UID - system unique - could change with location

◆ puuid

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

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

◆ samplerate

template<typename preference_t>
class dx::service::device::promoted dx::service::device< preference_t >::samplerate
protected

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

(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.