dxd - dynax driver framework  2981
cross platform open source driver development framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dx::device Class Reference

generic device interface class More...

#include <dx_device.h>

+ Inheritance diagram for dx::device:
+ Collaboration diagram for dx::device:

Classes

class  creator
 

Public Member Functions

virtual void conclude () noexcept
 conclude notification: device will be removed from tree More...
 
virtual void conclude ()
 conclude notifacation: device will be removed from tree More...
 
void ctl (unsigned int ioctl) const
 
 device (::io_service_t io_service)
 the device class constructor More...
 
 device (const creator &creator)
 the device class constructor More...
 
::CFTypeRef get (::CFStringRef key) const
 
::CFTypeRef get (::CFStringRef key,::CFTypeRef dflt) const noexcept
 
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
value_t get (::CFStringRef key) const
 
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
value_t get (::CFStringRef key,::CFTypeRef dflt) const noexcept
 
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
value_t get (::CFStringRef key, value_t dflt) const noexcept
 
template<typename key_t , typename = typename cf::enable_if_convertible<key_t>::type>
::CFTypeRef get (key_t key) const
 
template<typename key_t , typename value_t , typename = typename cf::enable_if_convertible<key_t>::type, typename = typename cf::enable_if_convertible<value_t>::type>
value_t get (key_t key) const
 
template<typename rx_t >
rx_t ictl (unsigned int ioctl) const
 Windows: member ioctl. More...
 
template<typename rx_t >
size_t ictl (unsigned int ioctl, rx_t &rx) const
 
tx_t size_t ioctl (unsigned int ioctl, const tx_t &tx, rx_t &rx) const
 
template<typename rx_t , typename tx_t >
rx_t ioctl (unsigned int ioctl, const tx_t &tx) const
 
size_t ioctl (unsigned int ioctl, const void *tx=nullptr, size_t tx_size=0, void *rx=nullptr, size_t rx_size=0) const
 
template<typename tx_t , typename rx_t >
size_t ioctl (unsigned int ioctl, const tx_t &tx, rx_t &rx) const
 
template<typename rx_t , typename tx_t >
rx_t ioctl (unsigned int ioctl, const tx_t &tx) const
 
virtual void launch ()
 launch notification: device mounted in tree and ready to use More...
 
virtual void launch ()
 launch notifacation: device mounted in tree and ready to use More...
 
template<typename tx_t >
void octl (unsigned int ioctl, const tx_t &tx) const
 
 operator const io_registry_entry_t & () const
 auto converter into const object More...
 
 operator io_registry_entry_t & ()
 auto converter into object More...
 
 operator uint64_t () const
 
 operator::CFMutableDictionaryRef () const
 
 operator::HANDLE () const
 
bool operator== (io_registry_entry_tobject) const noexcept
 
::CFTypeRef operator[] (::CFStringRef key) const
 
template<typename key_t , typename = typename std::enable_if<std::is_pod<key_t>::value>>
::CFTypeRef operator[] (key_t key) const
 
registryset (::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. More...
 
registryset (::CFStringRef key,::CFTypeRef value) noexcept
 
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
registryset (::CFStringRef key, value_t value)
 
template<typename key_t , typename = typename cf::enable_if_convertible<key_t>::type>
registryset (key_t key,::CFTypeRef value)
 
template<typename key_t , typename value_t , typename = typename cf::enable_if_convertible<key_t>::type, typename = typename cf::enable_if_convertible<value_t>::type>
registryset (key_t key, value_t value)
 
virtual ~device ()
 

Public Attributes

typedef::io_service_t creator
 
bool removed =false
 
 typename
 
 value_t
 
cf::type< const char * > bundle_id
 
cf::type< const char * > class_name
 

Protected Member Functions

virtual ~device () noexcept
 the device class destructor More...
 

Protected Attributes

struct {
   cf::type< const char * >   bundle_id
 
   cf::type< const char * >   class_name
 
kernel
 
io::port port
 

Detailed Description

generic device interface class

generic device class

This is the generic device interface class. This class is used for a platform independent way of accessing devices. The device class uses the driver interface helper class to construct the device object and to bind the device to the driver identified by the GUID.

example:

try() { // guard the block
// choose a driver
// enumerate devices
std::cout<< driver.size()<<" device(s) found:"<< std::endl;
// go thru all devices; you have to lock the driver if this multi-threaded
for (auto device: driver){
// return an int from an IOCTL served by the driver
int my_data= device.ioctl<int>(kMyIoctl);
}
catch (const dx::exception& exception) {
std::cerr<< exception<< std::endl;
}
}
Exceptions
Incase of an error returned by the underlaying API the device class throws a dx::exception.

this is the generic device class. the template parameter defines the exception class to be thrown. the device class uses the driver interface helper class to construct the device object and to bind the device to the driver identified by the GUID.

example:

try{ // guard the block
// choose a driver
dx::driver<>driver(GUID_MYDEVICE);
// enumerate devices
std::cout<<driver.size()<<" device(s) found:"<<std::endl;
// go thru all devices; you have to lock the driver if this multi-threaded
for (dx::driver<>::iterator i=driver.begin();i!=driver.end();i++){
// select a device
dx::reference<dx::device<> >device=*i;
// return an int from an IOCTL served by the driver
int my_data=device->ioctl<int>(kMyIoctl);
}
catch(dx::os_result error) {
std::cerr << "OS aborted operation with error #" << error << std::endl;
}
}
Exceptions
incase of an error returned by the underlaying API the device class throws an exception converted from dx::os_result. with the default exception_t=dx::os_result template parameter the dx::os_result itself will be thrown.

Constructor & Destructor Documentation

virtual dx::device::~device ( )
inlineprotectedvirtualnoexcept

the device class destructor

the underlaying IOKit API is IOServiceClose().

remark: The io_service reference itself is managed by inherited io::reference

for detailed information see

Disconnect notification port,

closes the connection to the IOService object

dx::device::device ( ::io_service_t  io_service)
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
io_servicethe IOService object to open the device connection for. This will be hold (but not retained) during device class lifetime
dx::device::device ( const creator creator)
inline

the device class constructor

the underlaying windows API is RegisterDeviceNotification(). for detailed information see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363431(v=vs.85).aspx

Exceptions
n/amicrosoft does not give information about what possible errors values are provided by its OS
virtual dx::device::~device ( )
inline

Member Function Documentation

virtual void dx::device::conclude ( )
inlinevirtualnoexcept

conclude notification: device will be removed from tree

Reimplemented in dx::coreaudio::device< io_t, bus_t, desc_t >, and dx::coremidi::device< io_t, bus_t, desc_t >.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void dx::device::conclude ( )
inlinevirtual

conclude notifacation: device will be removed from tree

Reimplemented in dx::coreaudio::device< io_t, bus_t, desc_t >, and dx::coremidi::device< io_t, bus_t, desc_t >.

void dx::device::ctl ( unsigned int  ioctl) const
inline
::CFTypeRef dx::io::registry::get ( ::CFStringRef  key) const
inlineinherited
::CFTypeRef dx::io::registry::get ( ::CFStringRef  key,
::CFTypeRef  dflt 
) const
inlinenoexceptinherited
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
value_t dx::io::registry::get ( ::CFStringRef  key) const
inlineinherited
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
value_t dx::io::registry::get ( ::CFStringRef  key,
::CFTypeRef  dflt 
) const
inlinenoexceptinherited
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
value_t dx::io::registry::get ( ::CFStringRef  key,
value_t  dflt 
) const
inlinenoexceptinherited
template<typename key_t , typename = typename cf::enable_if_convertible<key_t>::type>
::CFTypeRef dx::io::registry::get ( key_t  key) const
inlineinherited
template<typename key_t , typename value_t , typename = typename cf::enable_if_convertible<key_t>::type, typename = typename cf::enable_if_convertible<value_t>::type>
value_t dx::io::registry::get ( key_t  key) const
inlineinherited
template<typename rx_t >
rx_t dx::device::ictl ( unsigned int  ioctl) const
inline

Windows: member ioctl.

this member retreives data from the device by providing an IOCTL code. the template argument defines the type of data to be retreived. this member is intended as a convinient way to retreive only small amounts of data since there is an intermediate stack copy involved in returning the data.

the underlaying windows API is DeviceIoControl(). for detailed information see http://msdn.microsoft.com/en-us/library/aa363216(VS.85).aspx

Exceptions
n/amicrosoft does not give information about what possible errors values are provided by its OS other than
ERROR_INSUFFICIENT_BUFFERif the output buffer is too small to receive any data

+ Here is the caller graph for this function:

template<typename rx_t >
size_t dx::device::ictl ( unsigned int  ioctl,
rx_t &  rx 
) const
inline
tx_t size_t dx::device::ioctl ( unsigned int  ioctl,
const tx_t &  tx,
rx_t &  rx 
) const
inline
template<typename rx_t , typename tx_t >
rx_t dx::device::ioctl ( unsigned int  ioctl,
const tx_t &  tx 
) const
inline
size_t dx::device::ioctl ( unsigned int  ioctl,
const void *  tx = nullptr,
size_t  tx_size = 0,
void *  rx = nullptr,
size_t  rx_size = 0 
) const
inline
template<typename tx_t , typename rx_t >
size_t dx::device::ioctl ( unsigned int  ioctl,
const tx_t &  tx,
rx_t &  rx 
) const
inline
template<typename rx_t , typename tx_t >
rx_t dx::device::ioctl ( unsigned int  ioctl,
const tx_t &  tx 
) const
inline
virtual void dx::device::launch ( )
inlinevirtual

launch notification: device mounted in tree and ready to use

Reimplemented in dx::coreaudio::device< io_t, bus_t, desc_t >, and dx::coremidi::device< io_t, bus_t, desc_t >.

+ Here is the caller graph for this function:

virtual void dx::device::launch ( )
inlinevirtual

launch notifacation: device mounted in tree and ready to use

Reimplemented in dx::coreaudio::device< io_t, bus_t, desc_t >, and dx::coremidi::device< io_t, bus_t, desc_t >.

template<typename tx_t >
void dx::device::octl ( unsigned int  ioctl,
const tx_t &  tx 
) const
inline
dx::io::reference< io_registry_entry_t >::operator const io_registry_entry_t & ( ) const
inlineinherited

auto converter into const object

dx::io::reference< io_registry_entry_t >::operator io_registry_entry_t & ( )
inlineinherited

auto converter into object

dx::io::registry::operator uint64_t ( ) const
inlineinherited
dx::io::registry::operator::CFMutableDictionaryRef ( ) const
inlineinherited
dx::device::operator::HANDLE ( ) const
inline

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool dx::io::reference< io_registry_entry_t >::operator== ( io_registry_entry_t  object) const
inlinenoexceptinherited
::CFTypeRef dx::io::registry::operator[] ( ::CFStringRef  key) const
inlineinherited
template<typename key_t , typename = typename std::enable_if<std::is_pod<key_t>::value>>
::CFTypeRef dx::io::registry::operator[] ( key_t  key) const
inlineinherited
registry& dx::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 caller graph for this function:

registry& dx::io::registry::set ( ::CFStringRef  key,
::CFTypeRef  value 
)
inlinenoexceptinherited
template<typename value_t , typename = typename cf::enable_if_convertible<value_t>::type>
registry& dx::io::registry::set ( ::CFStringRef  key,
value_t  value 
)
inlineinherited

+ Here is the call graph for this function:

template<typename key_t , typename = typename cf::enable_if_convertible<key_t>::type>
registry& dx::io::registry::set ( key_t  key,
::CFTypeRef  value 
)
inlineinherited

+ Here is the call graph for this function:

template<typename key_t , typename value_t , typename = typename cf::enable_if_convertible<key_t>::type, typename = typename cf::enable_if_convertible<value_t>::type>
registry& dx::io::registry::set ( key_t  key,
value_t  value 
)
inlineinherited

+ Here is the call graph for this function:

Member Data Documentation

cf::type<const char*> dx::device::bundle_id
cf::type<const char*> dx::device::class_name
typedef::io_service_t dx::device::creator
struct { ... } dx::device::kernel
io::port dx::device::port
protected
bool dx::device::removed =false
dx::device::typename
Initial value:
= typename cf::enable_if_convertible<value_t>::type>
registry& set (::CFStringRef key, value_t value) {
return set (key, cf::type<value_t>(value));
}
template<typename key_t
dx::device::value_t

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

(c) copyright 2009 dynamic acoustics e.U. generated on Tue Nov 19 2019

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.