Click here to Skip to main content
15,881,172 members

Comments by bhawna.gopalka (Top 3 by date)

bhawna.gopalka 20-Oct-10 9:38am View    
i want to send the event of the mouse to the server..



void Mouse3D::deviceValueCallback( void * inContext, IOReturn inResult, void * inSender, IOHIDValueRef inIOHIDValueRef )
{
//#pragma unused( inSender )
IOHIDElementRef eref = IOHIDValueGetElement( inIOHIDValueRef );
if (!eref) return;



IOHIDDeviceRef tIOHIDDeviceRef = IOHIDElementGetDevice(eref);
if (!tIOHIDDeviceRef) return;

Mouse3D *d = ( Mouse3D* ) inContext;
if (!d) return;

std::cout << std::endl;

UInt32 usagePage = IOHIDElementGetUsagePage( eref );
UInt32 usage = IOHIDElementGetUsage( eref );

if ( !usagePage || !usage ) return;
if ( -1 == usage ) return;

//HIDDumpElementInfo(eref);
CFIndex value = IOHIDValueGetIntegerValue(inIOHIDValueRef);

switch(usagePage)
{
case Usage::PRIMARY_USAGE_PAGE:
switch(usage)
{
case Usage::USAGE_X: d->asyncEvent.tx = value; break;
case Usage::USAGE_Y: d->asyncEvent.ty = value; break;
case Usage::USAGE_Z: d->asyncEvent.tz = value; break;
case Usage::USAGE_RX: d->asyncEvent.rx = value; break;
case Usage::USAGE_RY: d->asyncEvent.ry = value; break;
case Usage::USAGE_RZ: d->asyncEvent.rz = value; break;
}
break;

case Usage::USAGE_PAGE_BUTTON:
d->asyncEvent.buttons[usage-1] = (value == 1); break;
break;
}

d->asyncEvent.printOn(std::cout);

}
}
this is the device value call back
bhawna.gopalka 11-Oct-10 8:36am View    
i need to send this event d->asyncEvent.printOn(std::cout);
to the server.. and link it using tcp....hav to some modification in the followng part of the program..

void testCFTcpServer()
{
CFTcpServer server;
int port = 8000;
if(!server.setup(port))
{
std::cout << std::endl << "server setup failed"<< std::endl;
return;
}
std::cout << std::endl << "server running"<< std::endl;



CFRunLoopRun();
}
bhawna.gopalka 11-Oct-10 5:26am View    
programming is done in c++
and i have also chkd it on net.. its da same but showng this error..