Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > How to do notification when the iSight Iris Unit state ?

How to do notification when the iSight Iris Unit state ?
Thread Tools
yesea
Fresh-Faced Recruit
Join Date: Oct 2004
Status: Offline
Reply With Quote
Apr 4, 2006, 10:35 PM
 
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. )
     
yesea  (op)
Fresh-Faced Recruit
Join Date: Oct 2004
Status: Offline
Reply With Quote
Apr 4, 2006, 10:37 PM
 
, the code piece is so ugly that my post .
     
Catfish_Man
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Apr 5, 2006, 12:04 AM
 
Use the [ code ] [/ code ] tags
     
proton
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Apr 23, 2006, 02:55 AM
 
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
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:24 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,