OS X - Apps and Games Discussion of applications and games available for Mac OS X.

how to access notifications


Post Reply New Thread Subscribe

 
Thread Tools
kiran269

 
Member Since: Dec 28, 2009
Posts: 5
kiran269 is on a distinguished road

kiran269 is offline
Hi all,

i am developing an application , my application is to show when i plug my usb device it has to give a message that new hardware found and when i unplug it , it has to show device is removed,
can any one give examples applications
my code is:


result = IOMasterPort(MACH_PORT_NULL, &masterPort);
printf("iomasterport %d\n",result);
if(result != KERN_SUCCESS)
{
printf("IOMasterPort Error\n");
return 0;
}
classToMatch = IOServiceMatching("moschipNHCI");

printf("Classtomatch %d\n",classToMatch);
if(classToMatch == NULL)
{
printf("IOServiceMatching() Error\n");
return 0;
}
result = IOServiceGetMatchingServices(masterPort,classToMat ch,&iterator);
printf("ioserviceresult %d\n",result);
if(result != KERN_SUCCESS)
{
printf("IOServiceGetMatchingServices() Error\n");
return 0;
}
else
{
NSRunAlertPanel(@"Alert",@"find new hardware1",@"ok",@"",nil);
printf("IOServiceGetMatchingServices success1234\n");
}
serviceObject = IOIteratorNext(iterator);
IOObjectRelease(iterator);
if(serviceObject)
{
result = IOServiceOpen(serviceObject ,mach_task_self() ,0 ,&dataPort );
if(!serviceObject)
{
printf("IOServiceGetMatchingServices() Error\n");
return 0;
}
else
{
printf("IOServiceOpen Succes\n");
// sleep(5);
}
}
IOObjectRelease(serviceObject);
result = IOConnectMethodScalarIScalarO(dataPort, kMyUserClientOpen, 0, 0);
printf("ioconnectresult %d\n",result);
if(result != KERN_SUCCESS)
{
printf("kMyUserClientOpen Error\n");
IOServiceClose(dataPort);
return 0;
}
else
{
printf("kMyUserClientOpen Success\n");
}
// int resultNumber;
// result = IOConnectMethodScalarIScalarO(dataPort, kMyScalarIScalarOmethod, 2, 1, 5, 40, &resultNumber);
// printf("result = %d\n", resultNumber);

// result = IOConnectMethodStructureIStructureO(dataPort,kMySt ructIStructOmethod,reqStructSize,&retStructSize,&r eqStruct,&retStruct);
// printf("int1 ->%d int2->%d string ->%s\n", retStruct.int16, (int)retStruct.int32, retStruct.string);

return TRUE;




Regards,
kiran
QUOTE Thanks

Post Reply New Thread Subscribe


« iPhoto issue: Upgrade iPhoto, can't use 'old' Library | Univ Class Schedule Software »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting 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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Using MAC access controls for ethernet access swampthing Internet, Networking, and Wireless 2 11-25-2009 01:12 PM
Wireless Bridge and Access Points joe.morgan Internet, Networking, and Wireless 2 09-21-2009 06:31 PM
Keep losing web access but still have internet jmullenberg Internet, Networking, and Wireless 1 04-13-2009 01:25 PM
Safari 'Please enter keychain password'...really annoying! HELP! jetpilot_aust OS X - Operating System 7 04-17-2007 06:48 AM
virtual pc, access, office, Mac JaminJanet Apple Desktops 2 04-01-2007 08:49 PM

All times are GMT -4. The time now is 10:41 PM.

Powered by vBulletin
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?