dxd - dynax driver framework 2.1.0d71
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::device Class Reference

generic device interface class More...

#include <dx_device.h>

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

Classes

struct  creator
 

Public Types

typedef ::io_service_t creator
 

Public Member Functions

virtual void conclude ()
 conclude notifacation: device will be removed from tree
 
virtual void conclude () noexcept
 conclude notification: device will be removed from tree
 
auto count () const noexcept
 
void ctl (uint32_t ioctl) const
 
void ctl (unsigned int ioctl) const
 
 device (generic::driver &driver, ::io_service_t io_service)
 the device class constructor
 
 device (generic::driver &driver, const creator &creator)
 the device class constructor
 
 dx_catchall_rethrow () virtual ~device() noexcept
 the device class destructor
 
 dx_catchall_rethrow (, "name: %s, access rights: %x, sharing options:%x", name, access, share)
 
registryerase (const char *key=nullptr)
 
::CFTypeRef get (::CFStringRef key) const
 
template<typename value_t , typename = cf::enable_if_convertible<value_t>>
value_t get (::CFStringRef key) const
 
::CFTypeRef get (::CFStringRef key, ::CFTypeRef dflt) const noexcept
 
template<typename value_t , typename = cf::enable_if_convertible<value_t>>
value_t 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 = cf::enable_if_convertible<key_t>>
::CFTypeRef get (key_t key) const
 
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 rx_t >
rx_t ictl (uint32_t ioctl) const
 member ioctl
 
template<typename rx_t >
size_t ictl (uint32_t ioctl, rx_t &rx) const
 
template<typename rx_t >
rx_t ictl (unsigned int ioctl) const
 Windows: member ioctl.
 
template<typename rx_t >
size_t ictl (unsigned int ioctl, rx_t &rx) const
 
void initialize (const char *name, ::DWORD access=GENERIC_READ|GENERIC_WRITE, ::DWORD share=FILE_SHARE_READ|FILE_SHARE_WRITE) try
 (re-)initialization the underlaying windows API is CreateFile(). for detailed information see http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
 
void initialize (const char *path, ::HKEY root, ::REGSAM rights=KEY_READ, const char *key=nullptr)
 
void initialize (const char *path, ::REGSAM rights=KEY_READ, ::HKEY root=HKEY_CURRENT_USER, const char *key=nullptr)
 
template<typename rx_t , typename tx_t >
rx_t ioctl (uint32_t ioctl, const tx_t &tx) const
 
template<typename rx_t , typename tx_t >
size_t ioctl (uint32_t ioctl, const tx_t &tx, rx_t &rx) const
 
size_t ioctl (uint32_t ioctl, const void *tx=nullptr, size_t tx_size=0, void *rx=nullptr, size_t rx_size=0) const
 
template<typename rx_t , typename tx_t >
rx_t ioctl (unsigned int ioctl, const tx_t &tx) const
 
template<typename tx_t , typename rx_t >
size_t ioctl (unsigned int ioctl, const tx_t &tx, rx_t &rx) const
 
virtual void launch ()
 launch notification: device mounted in tree and ready to use
 
virtual void launch ()
 launch notifacation: device mounted in tree and ready to use
 
template<typename tx_t >
void octl (uint32_t ioctl, const tx_t &tx) const
 
template<typename tx_t >
void octl (unsigned int ioctl, const tx_t &tx) const
 
 operator const io_registry_entry_t & () const noexcept
 auto converter into const 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 std::string () const
 
 operator uint64_t () const
 
template<typename value_t >
 operator value_t () const
 
template<typename value_t >
value_t operator() (value_t dflt) const
 
 operator::CFMutableDictionaryRef () const
 
 operator::CFStringRef () const
 
 operator::HKEY () const noexcept
 
registryoperator= (::CFTypeRef properties)
 
bool operator== (io_registry_entry_t io_object) const noexcept
 
::CFTypeRef operator[] (::CFStringRef key) const
 
registry operator[] (const char *key) const
 
template<typename key_t , typename = cf::enable_if_convertible<key_t>>
::CFTypeRef operator[] (key_t key) const
 
referenceretain ()
 
registryset (::CFStringRef key, ::CFTypeRef value) noexcept
 
template<typename value_t , typename = cf::enable_if_convertible<value_t>>
registryset (::CFStringRef key, value_t value)
 
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.
 
template<typename key_t , typename = cf::enable_if_convertible<key_t>>
registryset (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>>
registryset (key_t key, value_t value)
 
virtual ~device () noexcept
 

Public Attributes

generic::driverdriver
 
bool launched = false
 
cf::preference preference
 
registry preference
 

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 int32_t from an IOCTL served by the driver
}
catch (const dx::exception& exception) {
std::cerr<< exception<< std::endl;
}
}
generic device interface class
Definition macOS/dx_device.h:66
rx_t ictl(uint32_t ioctl) const
member ioctl
Definition macOS/dx_device.h:172
size_t ioctl(uint32_t ioctl, const tx_t &tx, rx_t &rx) const
Definition macOS/dx_device.h:195
generic::driver & driver
Definition macOS/dx_device.h:81
Definition macOS/dx_driver.h:230
Definition dx_exception.h:134
::GUID match
Definition windows/dx_driver.h:43
int int32_t
Definition wdk/dxd_base.h:109
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
// 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
}
catch(dx::os_result error) {
std::cerr << "OS aborted operation with error #" << error << std::endl;
}
}
::mach_error_t os_result
Definition macOS/dx_platform.h:159
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.

Member Typedef Documentation

◆ creator

typedef ::io_service_t dx::device::creator

Constructor & Destructor Documentation

◆ device() [1/2]

dx::device::device ( generic::driver & driver,
::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

Constructs and open device,

connects notification port

Parameters
io_servicethe IOService object to open the device connection for. This will be retained during device class lifetime
+ Here is the call graph for this function:

◆ device() [2/2]

dx::device::device ( generic::driver & driver,
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
+ Here is the call graph for this function:

◆ ~device()

virtual dx::device::~device ( )
inlinevirtualnoexcept

Reimplemented in dx::usb::platform::device.

+ Here is the call graph for this function:

Member Function Documentation

◆ conclude() [1/2]

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

conclude notifacation: device will be removed from tree

◆ conclude() [2/2]

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

conclude notification: device will be removed from tree

+ Here is the caller graph for this function:

◆ count()

auto dx::io::reference< io_registry_entry_t >::count ( ) const
inlinenoexceptinherited

◆ ctl() [1/2]

void dx::device::ctl ( uint32_t ioctl) const
inline

◆ ctl() [2/2]

void dx::device::ctl ( unsigned int ioctl) const
inline
+ Here is the call graph for this function:

◆ dx_catchall_rethrow() [1/2]

dx::device::dx_catchall_rethrow ( )
inlinenoexcept

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_catchall_rethrow() [2/2]

dx::file::dx_catchall_rethrow ( "name: % s,
access rights:% x,
sharing options:%x" ,
name ,
access ,
share  )
inherited

◆ erase()

registry & dx::registry::erase ( const char * key = nullptr)
inlineinherited
Todo
registry::erase(): investigate why it's not working

◆ get() [1/7]

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

◆ get() [2/7]

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

◆ get() [3/7]

::CFTypeRef dx::io::registry::get ( ::CFStringRef key,
::CFTypeRef dflt ) const
inlinenoexceptinherited

◆ get() [4/7]

template<typename value_t , typename = cf::enable_if_convertible<value_t>>
value_t dx::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 dx::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 = cf::enable_if_convertible<key_t>>
::CFTypeRef dx::io::registry::get ( key_t key) const
inlineinherited
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get() [7/7]

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

◆ ictl() [1/4]

template<typename rx_t >
rx_t dx::device::ictl ( uint32_t ioctl) const
inline

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.

+ Here is the caller graph for this function:

◆ ictl() [2/4]

template<typename rx_t >
size_t dx::device::ictl ( uint32_t ioctl,
rx_t & rx ) const
inline

◆ ictl() [3/4]

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 call graph for this function:

◆ ictl() [4/4]

template<typename rx_t >
size_t dx::device::ictl ( unsigned int ioctl,
rx_t & rx ) const
inline
+ Here is the call graph for this function:

◆ initialize() [1/3]

void dx::file::initialize ( const char * name,
::DWORD access = GENERIC_READ| GENERIC_WRITE,
::DWORD share = FILE_SHARE_READ| FILE_SHARE_WRITE )
inlineinherited

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

Exceptions
n/amicrosoft does not give information about what possible errors values are provided by its OS
+ Here is the caller graph for this function:

◆ initialize() [2/3]

void dx::registry::initialize ( const char * path,
::HKEY root,
::REGSAM rights = KEY_READ,
const char * key = nullptr )
inlineinherited
+ Here is the caller graph for this function:

◆ initialize() [3/3]

void dx::registry::initialize ( const char * path,
::REGSAM rights = KEY_READ,
::HKEY root = HKEY_CURRENT_USER,
const char * key = nullptr )
inlineinherited

◆ ioctl() [1/5]

template<typename rx_t , typename tx_t >
rx_t dx::device::ioctl ( uint32_t ioctl,
const tx_t & tx ) const
inline

◆ ioctl() [2/5]

template<typename rx_t , typename tx_t >
size_t dx::device::ioctl ( uint32_t ioctl,
const tx_t & tx,
rx_t & rx ) const
inline
+ Here is the caller graph for this function:

◆ ioctl() [3/5]

size_t dx::device::ioctl ( uint32_t ioctl,
const void * tx = nullptr,
size_t tx_size = 0,
void * rx = nullptr,
size_t rx_size = 0 ) const
inline

◆ ioctl() [4/5]

template<typename rx_t , typename tx_t >
rx_t dx::device::ioctl ( unsigned int ioctl,
const tx_t & tx ) const
inline
+ Here is the call graph for this function:

◆ ioctl() [5/5]

template<typename tx_t , typename rx_t >
size_t dx::device::ioctl ( unsigned int ioctl,
const tx_t & tx,
rx_t & rx ) const
inline
+ Here is the call graph for this function:

◆ launch() [1/2]

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

launch notification: device mounted in tree and ready to use

Reimplemented in dx::usb::stream::device< desc_t >.

◆ launch() [2/2]

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

launch notifacation: device mounted in tree and ready to use

Reimplemented in dx::usb::stream::device< desc_t >.

◆ octl() [1/2]

template<typename tx_t >
void dx::device::octl ( uint32_t ioctl,
const tx_t & tx ) const
inline
+ Here is the caller graph for this function:

◆ octl() [2/2]

template<typename tx_t >
void dx::device::octl ( unsigned int ioctl,
const tx_t & tx ) const
inline
+ Here is the call graph for this function:

◆ operator const io_registry_entry_t &()

auto converter into const io_object

◆ operator io_registry_entry_t &()

auto converter into io_object

◆ operator io_registry_entry_t *()

auto converter into io_object pointer

◆ operator std::string()

dx::registry::operator std::string ( ) const
inlineinherited

◆ operator uint64_t()

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

◆ operator value_t()

template<typename value_t >
dx::registry::operator value_t ( ) const
inlineinherited

◆ operator()()

template<typename value_t >
value_t dx::registry::operator() ( value_t dflt) const
inlineinherited

◆ operator::CFMutableDictionaryRef()

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

◆ operator::CFStringRef()

dx::io::registry::operator::CFStringRef ( ) const
inlineexplicitinherited

◆ operator::HKEY()

dx::registry::operator::HKEY ( ) const
inlinenoexceptinherited

◆ operator=()

registry & dx::device::operator= ( ::CFTypeRef properties)
inline

◆ operator==()

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

◆ operator[]() [1/3]

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

◆ operator[]() [2/3]

registry dx::registry::operator[] ( const char * key) const
inlineinherited
+ Here is the call graph for this function:

◆ operator[]() [3/3]

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

◆ retain()

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

◆ set() [1/5]

registry & dx::device::set ( ::CFStringRef key,
::CFTypeRef value )
inlinenoexcept

◆ set() [2/5]

template<typename value_t , typename = cf::enable_if_convertible<value_t>>
registry & dx::device::set ( ::CFStringRef key,
value_t value )
inline

◆ set() [3/5]

registry & dx::device::set ( ::CFTypeRef properties)
inline

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.

◆ set() [4/5]

template<typename key_t , typename = cf::enable_if_convertible<key_t>>
registry & dx::device::set ( key_t key,
::CFTypeRef value )
inline

◆ 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 & dx::device::set ( key_t key,
value_t value )
inline

Member Data Documentation

◆ bundle_id

cf::type<const char*> dx::device::bundle_id

◆ class_name

cf::type<const char*> dx::device::class_name

◆ driver

generic::driver & dx::device::driver

◆ [struct]

struct { ... } dx::device::kernel

◆ launched

bool dx::device::launched = false

◆ port

io::port dx::device::port
protected

◆ preference [1/2]

cf::preference dx::device::preference

◆ preference [2/2]

registry dx::device::preference

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

(c) copyright 2009 dynamic acoustics e.U. generated on Thu Jun 6 2024

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.