ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference

 


IOUPSPlugInInterface

Declared In:

Overview

Represents and provides management functions for a UPS device.



Functions

createAsyncEventSource

Used to create an async run loop event source of the plugin.

getCapabilities

Used to obtain the capabilities of the UPS device.

getEvent

Used to poll the current state of the UPS.

getProperties

Used to obtain the properties of the UPS device such as the name and transport.

sendCommand

Send a command to the UPS.

setEventCallback

Set the callback that should be called to handle an event from the UPS.


createAsyncEventSource


Used to create an async run loop event source of the plugin.

IOReturn ( *createAsyncEventSource)(
    void *thisPointer, 
    CFTypeRef *source);  
Parameters
thisPointer

The UPS Interface to use.

source

Pointer to a CFTypeRef. It is expected that this point to either a CFRunLoopSourceRef or a CFRunLoopTimerRef.

Return Value

An IOReturn error code.

Discussion

This is an allocation method. Thus the caller must release the object that is returned.


getCapabilities


Used to obtain the capabilities of the UPS device.

IOReturn ( *getCapabilities)(
    void *thisPointer, 
    CFSetRef *capabilities);  
Parameters
thisPointer

The UPS Interface to use.

capabilities

Pointer to a CFSetRef that contains the capabilities.

Return Value

An IOReturn error code.

Discussion

Keys are defined in IOPSKeys.h and begin with kIOPS. This is not an allocation method. Thus the caller does not release the CFSet that is returned.


getEvent


Used to poll the current state of the UPS.

IOReturn ( *getEvent)(
    void *thisPointer, 
    CFDictionaryRef *event);  
Parameters
thisPointer

The UPS Interface to use.

event

Pointer to a CFDictionaryRef that contains the current event state.

Return Value

An IOReturn error code.

Discussion

Keys are defined in IOPSKeys.h and begin with kIOPS. This is not an allocation method. Thus the caller does not release the CFDictionary that is returned.


getProperties


Used to obtain the properties of the UPS device such as the name and transport.

IOReturn ( *getProperties)(
    void *thisPointer, 
    CFDictionaryRef *properties);  
Parameters
thisPointer

The UPS Interface to use.

properties

Pointer to a CFDictionaryRef that contains the properties.

Return Value

An IOReturn error code.

Discussion

Property keys are defined in IOPSKeys.h. This is not an allocation method. Thus the caller does not release the CFDictionary that is returned.


sendCommand


Send a command to the UPS.

IOReturn ( *sendCommand)(
    void *thisPointer, 
    CFDictionaryRef command);  
Parameters
thisPointer

The UPS Interface to use.

command

CFDictionaryRef that contains the command.

Return Value

An IOReturn error code.

Discussion

Command keys are defined in IOPSKeys.h and begin with kIOPSCommand. An error should be returned if your device does not know how to respond to a command.


setEventCallback


Set the callback that should be called to handle an event from the UPS.

IOReturn ( *setEventCallback)(
    void *thisPointer, 
    IOUPSEventCallbackFunction callback, 
    void *callbackTarget, 
    void *callbackRefcon);  
Parameters
thisPointer

The UPS Interface to use.

callback

A callback handler of type IOUPSEventCallbackFunction.

callbackTarget

The address to be targeted by this callback.

callbackRefcon

A user specified reference value. This will be passed to all callback functions.

Return Value

An IOReturn error code.

Discussion

The provided callback method should be called whenever there is a change of state in the UPS. This should be used in conjunction with createAsyncEventSource.


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2009-02-23