Page 206 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 206
PDA 09 5/27/03 8:50 AM Page 182
//
Found = TRUE; PDA Robotics
break;
}
if (pPL + *pPL >= pIASQuery->irdaAttribute.irdaAttribOctetSeq.OctetSeq +
pIASQuery->irdaAttribute.irdaAttribOctetSeq.Len)
{
break;
}
pPI = pPL + *pPL;
pPL = pPI + 1;
pPV = pPI + 2;
}
if (! Found)
{
//
// Peer doesn't support 9 wire mode.
//
msg = "peer doesn't support 9 wire mode";
this->m_status_window.SetWindowText( (LPCTSTR) msg);
return false;
}
//
// enable 9wire mode before we call connect()
//
if (setsockopt(Infrared_Socket, SOL_IRLMP, IRLMP_9WIRE_MODE, (const char *)
&Enable9WireMode,
sizeof(int)) == SOCKET_ERROR)
{
msg = "Couldn't set socket options";
this->m_status_window.SetWindowText( (LPCTSTR) msg);
return false;
}
//
// Nothing special for IrCOMM from now on, we treat it as
// a normal socket. Try to connect with PDA Robot
//
if (connect(Infrared_Socket, (const struct sockaddr *) &DstAddrIR,
sizeof(SOCKADDR_IRDA))
== SOCKET_ERROR)
{
msg = "Couldn't connect via IrDA";
this->m_status_window.SetWindowText( (LPCTSTR) msg);
return false;
182