|
|
How to do notification when the iSight Iris Unit state ?
|
|
|
|
Fresh-Faced Recruit
Join Date: Oct 2004
Status:
Offline
|
|
Hi all,
I build one application to capture video from iSight . Now ,want make notification when the iSight device turn on ,turn off and the open iris ,close iris . now ,i can get the message when the iSight plug on and off . but not iris open and close . anybody can show one demo to notify the isght's iris open and close . Follow is my code piece .
Code:
===source code ====
/*** add matching notification for FireWireunit for first publish ***/
io_iterator_t iterator = MACH_PORT_NULL;
IOMasterPort(MACH_PORT_NULL, &masterPort);
gNotifyPort = IONotificationPortCreate ( kIOMasterPortDefault );
// Add it to the runloop
CFRunLoopAddSource ( CFRunLoopGetCurrent ( ),
IONotificationPortGetRunLoopSource ( gNotifyPort ),
kCFRunLoopCommonModes );
CFMutableDictionaryRef matchingDictionary = IOServiceMatching ("IOFireWireUnit");
// Add matching notifications for optical devices
IOServiceAddMatchingNotification ( gNotifyPort,
kIOFirstPublishNotification,
matchingDictionary,
&ServiceMatched,
NULL,
&iterator );
/*** add matching notification for FireWireunit for first publish ***/
io_service_t service = MACH_PORT_NULL;
io_iterator_t ignored = MACH_PORT_NULL;
kern_return_t kr;
IOCFPlugInInterface** plugInInterface=NULL;
SInt32 score;
while ( ( service = IOIteratorNext ( iterator ) ) != MACH_PORT_NULL )
{
io_name_t deviceName;
CFStringRef deviceNameAsCFString;
UInt32 locationID;
kr = IOCreatePlugInInterfaceForService(service, kIOFireWireLibTypeID,
kIOCFPlugInInterfaceID, &plugInInterface, &score);
(*plugInInterface)->Release(plugInInterface); // Attach a general interest notification to this object
IOServiceAddInterestNotification ( gNotifyPort,
service,
kIOBusyInterest,
ServiceInterest,
NULL,
&ignored );
}
/*** ServiceInterest is the callback , when notification apply***/
====
(
Last edited by yesea; Apr 5, 2006 at 02:03 AM.
)
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Oct 2004
Status:
Offline
|
|
, the code piece is so ugly that my post .
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
Use the [ code ] [/ code ] tags
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
You probably want to read the iSight Programming Guide from Apple. You can register for updates through a kIOMessagePropertiesChanged notification as mentioned in Iris Unit section of the documentation.
- proton
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|