When trying to initiate a discovery over the IR port I always get back
IR_STATUS_MEDIA_BUSY. I've looked through the archives and tried every that
I can think of but I can't get around this problem. If anyone can take a
look at the code that I've included and point me in the right direction I'd
appreciate it. If it makes any difference I'm using Code Warrior 7 and the
3.5 SDK.
IrConnect con;
UInt16 nRef;
UInt8 openConnection()
{
IrStatus err = 0;
UInt8 deviceInfo[] = { IR_HINT_PDA, IR_CHAR_ASCII, 'F', 'O', 'O' };
UInt8 deviceName[] = { IAS_ATTRIB_USER_STRING, IR_CHAR_ASCII, 3,
'F', 'O', 'O' };
UInt8 attributeValue[] = { IAS_ATTRIB_INTEGER, 0,0,0,2 };
IrIasObject iasObject;
IrIasAttribute attribute;
//find library
if( SysLibFind( irLibName, &nRef ) != IR_STATUS_SUCCESS )
{
print( "Failed to load library" );
return 1;
}
//open IR library
if( IrOpen( nRef, irOpenOptSpeed9600 ) != IR_STATUS_SUCCESS )
{
print( "Failed to open library" );
return 1;
}
//bind to stack
if( IrBind( nRef, &con, callMe ) != IR_STATUS_SUCCESS )
{
print( "Failed to bind to stack" );
return 1;
}
//set device information
if( IrSetDeviceInfo( nRef, deviceInfo, sizeof( deviceInfo ) ) !=
IR_STATUS_SUCCESS )
{
print( "Failed to set device information" );
return 1;
}
//IAS
attribute.name = (UInt8 *) "IrDA:IrLMP:LsapSel";
attribute.len = 18;
attribute.value = attributeValue;
attribute.valLen = sizeof( attributeValue );
iasObject.name = (UInt8 *) "Test";
iasObject.len = 4;
iasObject.nAttribs = 1;
iasObject.attribs = &attribute;
err = IrIAS_SetDeviceName( nRef, deviceName, sizeof( deviceName ) );
err = IrIAS_Add( nRef, &iasObject );
for( UInt8 x = 0; x < 100; x++ )
{
err = IrDiscoverReq( nRef, &con );
if( err == IR_STATUS_PENDING )
{
print( "Discovery Pending" );
return 0;
}
}
return 1;
}
Thanks
Paul Crivellari
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/