Page 190 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 190
PDA 08 5/27/03 8:47 AM Page 166
char info[36];
// clear the label PDA Robotics
StrCopy((char *)&info, (char *)"______________________________");
FrmCopyLabel (FrmGetActiveForm(), MainStatusLabel, (char*)&info);
if( deviceList->nItems == 0 )
{
StrCopy((char *)&info, (char *)"NO Devices Discovered ");
FrmCopyLabel (FrmGetActiveForm(), MainStatusLabel, (char*)&info);
return;
}
for (i = 0; i < deviceList->nItems; i++)
{
//
// We don't want to recognize any device but PDA Robot
// so ensure that the device name is 'Generic IrDA'. This
// is the default name used by the MCP2150 chip. We will
// connect with the first found
//
if( (StrCompare((char *)"Generic IrDA", (char *) &deviceList->dev[i].xid[3])) == 0)
{
dev = deviceList->dev[i].hDevice;
connect.rLsap = deviceList->dev[i].xid[0];
StrCopy((char *)&info, (char *)"Discovered PDA Robot ");
FrmCopyLabel (FrmGetActiveForm(), MainStatusLabel, (char*)&info);
}
}
}
//
// Information Access Service Callback. This function
// is called when we query PDA Robot for information.
// If we received the LSAP information then we connect
// to to PDA Robot.
//
static void IrIasCallback(IrStatus status) {
UInt8 b;
UInt8 i;
if((query.retCode)!=IAS_RET_SUCCESS)
{
return;
}
i=IrIAS_GetType(&query);
166