Top Description Inners Fields Methods
com.sun.jna.platform.mac

public Interface IOKit

extends Library
Imports
com.sun.jna.Library, .Memory, .Native, .Pointer, .PointerType, com.sun.jna.platform.mac.CoreFoundation.CFAllocatorRef, .CoreFoundation.CFArrayRef, .CoreFoundation.CFBooleanRef, .CoreFoundation.CFDataRef, .CoreFoundation.CFDictionaryRef, .CoreFoundation.CFMutableDictionaryRef, .CoreFoundation.CFNumberRef, .CoreFoundation.CFStringRef, .CoreFoundation.CFTypeRef, com.sun.jna.ptr.IntByReference, .LongByReference, .PointerByReference

The I/O Kit framework implements non-kernel access to I/O Kit objects (drivers and nubs) through the device-interface mechanism.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
IOKit.IOConnect

For an application to communicate with a device, the first thing it must do is create a connection between itself and the in-kernel object representing the device.

public static class
IOKit.IOIterator

An IOKit iterator handle.

public static class
IOKit.IOObject

IOKitLib implements non-kernel task access to common IOKit object types - IORegistryEntry, IOService, IOIterator etc. These functions are generic - families may provide API that is more specific.

public static class
IOKit.IORegistryEntry

The base class for all objects in the registry.

public static class
IOKit.IOService

The base class for most I/O Kit families, devices, and drivers.

Field Summary

Modifier and TypeField and Description
public static final IOKit
public static final double
public static final double
public static final int
public static final int
public static final int
kIOReturnNoDevice

Return value when attempting parent or child in registry and they do not exist

Inherited from com.sun.jna.Library:
OPTION_ALLOW_OBJECTSOPTION_CALLING_CONVENTIONOPTION_CLASSLOADEROPTION_FUNCTION_MAPPEROPTION_INVOCATION_MAPPEROPTION_OPEN_FLAGSOPTION_STRING_ENCODINGOPTION_STRUCTURE_ALIGNMENTOPTION_SYMBOL_PROVIDEROPTION_TYPE_MAPPER

Method Summary

Modifier and TypeMethod and Description
public CoreFoundation.CFMutableDictionaryRef

Returns:

The matching dictionary created, is returned on success, or null on failure.

The dictionary is commonly passed to IOServiceGetMatchingServices which will consume a reference, otherwise it should be released with CoreFoundation#CFRelease by the caller.

IOBSDNameMatching
(int
The master port obtained from IOMasterPort.
masterPort
,
int
No options are currently defined.
options
,
String
The BSD name.
bsdName
)

Create a matching dictionary that specifies an IOService match based on BSD device name.

public IOKit.IORegistryEntry

Returns:

If the iterator handle is valid, the next element in the iteration is returned, otherwise zero is returned. The element should be released by the caller when it is finished.
IOIteratorNext
(IOKit.IOIterator
An IOKit iterator handle.
iterator
)

Returns the next object in an iteration.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IOMasterPort
(int
Pass 0 for the default.
bootstrapPort
,
IntByReference
A pointer to the master port is returned. Multiple calls to IOMasterPort will not result in leaking ports (each call to IOMasterPort adds another send right to the port) but it is considered good programming practice to deallocate the port when you are finished with it using SystemB#mach_port_deallocate.
port
)

Returns the mach port used to initiate communication with IOKit.

public boolean

Returns:

If the object handle is valid, and represents an object in the kernel that dynamic casts to the class true is returned, otherwise false.
IOObjectConformsTo
(IOKit.IOObject
An IOKit object.
object
,
String
The name of the class.
className
)

Performs an OSDynamicCast operation on an IOKit object.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IOObjectRelease
(IOKit.IOObject
The IOKit object to release.
object
)

Releases an object handle previously returned by IOKitLib.

public CoreFoundation.CFTypeRef

Returns:

null if errors were encountered, a CFTypeRef otherwise.

Caller must CoreFoundation#CFRelease the return value when done accessing it.

IOPSCopyPowerSourcesInfo
()

Returns a blob of Power Source information in an opaque CFTypeRef.

public CoreFoundation.CFArrayRef

Returns:

null if errors were encountered, otherwise a CFArray of CFTypeRefs.

Caller must CoreFoundation#CFRelease the returned CFArrayRef.

IOPSCopyPowerSourcesList
(CoreFoundation.CFTypeRef
Takes the CFTypeRef returned by IOPSCopyPowerSourcesInfo
blob
)

Returns a CFArray of Power Source handles, each of type CFTypeRef.

public CoreFoundation.CFDictionaryRef

Returns:

null if an error was encountered, otherwise a CFDictionary.

Caller should NOT release the returned CFDictionary - it will be released as part of the CFTypeRef returned by IOPSCopyPowerSourcesInfo.

IOPSGetPowerSourceDescription
(CoreFoundation.CFTypeRef blob, CoreFoundation.CFTypeRef
One of the CFTypeRefs in the CFArray returned by IOPSCopyPowerSourcesList.
ps
)

Returns a CFDictionary with readable information about the specific power source.

public double

Returns:

Returns kIOPSTimeRemainingUnknown if the OS cannot determine the time remaining.

Returns kIOPSTimeRemainingUnlimited if the system has an unlimited power source.

Otherwise returns a positive number indicating the time remaining in seconds until all power sources are depleted.

IOPSGetTimeRemainingEstimate
()

Returns the estimated seconds remaining until all power sources (battery and/or UPS's) are empty.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IORegistryEntryCreateCFProperties
(IOKit.IORegistryEntry
The registry entry handle whose property table to copy.
entry
,
PointerByReference
A CFDictionary is created and returned the caller on success. The caller should release with CFRelease.
properties
,
CoreFoundation.CFAllocatorRef
The CF allocator to use when creating the CF containers.
allocator
,
int
No options are currently defined.
options
)

Create a CF dictionary representation of a registry entry's property table.

public CoreFoundation.CFTypeRef

Returns:

A CF container is created and returned the caller on success.

The caller should release with CoreFoundation#CFRelease.

IORegistryEntryCreateCFProperty
(IOKit.IORegistryEntry
The registry entry handle whose property to copy.
entry
,
CoreFoundation.CFStringRef
A CFString specifying the property name.
key
,
CoreFoundation.CFAllocatorRef
The CF allocator to use when creating the CF container.
allocator
,
int
No options are currently defined.
options
)

Create a CF representation of a registry entry's property.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IORegistryEntryGetChildEntry
(IOKit.IORegistryEntry
The registry entry whose child to look up.
entry
,
String
The name of an existing registry plane. Plane names are defined in IOKitKeys.h, for example, kIOServicePlane.
plane
,
PointerByReference
The first child of the registry entry, on success. The child must be released by the caller.
child
)

Returns the first child of a registry entry in a plane.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IORegistryEntryGetChildIterator
(IOKit.IORegistryEntry
The registry entry whose children to iterate over.
entry
,
String
The name of an existing registry plane. Plane names are defined in IOKitKeys.h, for example, kIOServicePlane.
plane
,
PointerByReference
The created iterator over the children of the entry, on success. The iterator must be released when the iteration is finished.
iter
)

Returns an iterator over a registry entry’s child entries in a plane.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IORegistryEntryGetName
(IOKit.IORegistryEntry
The registry entry handle whose name to look up.
entry
,
Pointer
The caller's buffer to receive the name. This must be a 128-byte buffer.
name
)

Returns a name assigned to a registry entry.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IORegistryEntryGetParentEntry
(IOKit.IORegistryEntry
The registry entry whose parent to look up.
entry
,
String
The name of an existing registry plane. Plane names are defined in IOKitKeys.h, for example, kIOServicePlane.
plane
,
PointerByReference
The first parent of the registry entry, on success. The parent must be released by the caller.
parent
)

Returns the first parent of a registry entry in a plane.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IORegistryEntryGetRegistryEntryID
(IOKit.IORegistryEntry
The registry entry handle whose ID to look up.
entry
,
LongByReference
The resulting ID.
id
)

Returns an ID for the registry entry that is global to all tasks.

public CoreFoundation.CFTypeRef

Returns:

A CF container is created and returned the caller on success. The caller should release with CFRelease.
IORegistryEntrySearchCFProperty
(IOKit.IORegistryEntry
The registry entry at which to start the search.
entry
,
String
The name of an existing registry plane. Plane names are defined in IOKitKeys.h, for example, kIOServicePlane.
plane
,
CoreFoundation.CFStringRef
A CFString specifying the property name.
key
,
CoreFoundation.CFAllocatorRef
The CF allocator to use when creating the CF container.
allocator
,
int
kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard IORegistryEntryCreateCFProperty call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
options
)

Create a CF representation of a registry entry's property.

public IOKit.IORegistryEntry

Returns:

A handle to the IORegistryEntry root instance, to be released with IOObjectRelease by the caller, or 0 on failure.
IORegistryGetRootEntry
(int
The master port obtained from IOMasterPort.
masterPort
)

Return a handle to the registry root.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IOServiceClose
(IOKit.IOConnect
The connect handle created by IOServiceOpen. It will be destroyed by this function, and should not be released with IOObjectRelease.
connect
)

Close a connection to an IOService and destroy the connect handle.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IOServiceGetBusyState
(IOKit.IOService
The IOService whose busyState to return.
service
,
IntByReference
The busyState count is returned.
busyState
)

Returns the busyState of an IOService.

public IOKit.IOService

Returns:

The first service matched is returned on success.

The service must be released by the caller.

IOServiceGetMatchingService
(int
The master port obtained from IOMasterPort.
masterPort
,
CoreFoundation.CFDictionaryRef
A CF dictionary containing matching information, of which one reference is always consumed by this function. IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, and IOBSDNameMatching.
matchingDictionary
)

Look up a registered IOService object that matches a matching dictionary.

public int

Returns:

0 if successful, otherwise a kern_return_t error code.
IOServiceGetMatchingServices
(int
The master port obtained from IOMasterPort.
masterPort
,
CoreFoundation.CFDictionaryRef
A CF dictionary containing matching information, of which one reference is always consumed by this function. IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, and IOBSDNameMatching.
matchingDictionary
,
PointerByReference
An iterator handle is returned on success, and should be released by the caller when the iteration is finished.
iterator
)

Look up registered IOService objects that match a matching dictionary.

public CoreFoundation.CFMutableDictionaryRef

Returns:

The matching dictionary created, is returned on success, or null on failure.

The dictionary is commonly passed to IOServiceGetMatchingServices which will consume a reference, otherwise it should be released with CoreFoundation#CFRelease by the caller.

IOServiceMatching
(String
The class name. Class matching is successful on IOServices of this class or any subclass.
name
)

Create a matching dictionary that specifies an IOService class match.

public CoreFoundation.CFMutableDictionaryRef

Returns:

The matching dictionary created, is returned on success, or null on failure.

The dictionary is commonly passed to IOServiceGetMatchingServices which will consume a reference, otherwise it should be released with CoreFoundation#CFRelease by the caller.

IOServiceNameMatching
(String
The IOService name.
name
)

Create a matching dictionary that specifies an IOService name match.

public int

Returns:

A return code generated by IOService::newUserClient.
IOServiceOpen
(IOKit.IOService
The IOService object to open a connection to, usually obtained via the IOServiceGetMatchingServices API.
service
,
int
The mach task requesting the connection.
owningTask
,
int
A constant specifying the type of connection to be created, interpreted only by the IOService's family.
type
,
PointerByReference
An io_connect_t handle is returned on success, to be used with the IOConnectXXX APIs. It should be destroyed with IOServiceClose.
connect
)

A request to create a connection to an IOService.