Page 205 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 205
PDA 09 5/27/03 8:50 AM Page 181
memcpy(&pIASQuery->irdaDeviceID[0], &pDevList->Device[0].irdaDeviceID[0], 4);
// Chapter 9 / PDA Robot Software for Pocket PC 2002
// IrCOMM IAS attributes. see chapter on the IrDA protocol
//
memcpy(&pIASQuery->irdaClassName[0], "IrDA:IrCOMM", 12);
memcpy(&pIASQuery->irdaAttribName[0], "Parameters", 11);
if (getsockopt(Infrared_Socket, SOL_IRLMP, IRLMP_IAS_QUERY, (char *) pIASQuery,
&IASQueryLen) == SOCKET_ERROR)
{
this->m_status_window.SetWindowText( (LPCTSTR) CString("Couldn't get Ir socket
options"));
return false;
}
if (pIASQuery->irdaAttribType != IAS_ATTRIB_OCTETSEQ)
{
//
// peer's IAS database entry for IrCOMM is bad
//
this->m_status_window.SetWindowText( (LPCTSTR) CString("IAS database entry is
corrupt"));
}
if (pIASQuery->irdaAttribute.irdaAttribOctetSeq.Len < 3)
{
//
// peer's IAS database entry for IrCOMM is bad
//
this->m_status_window.SetWindowText( (LPCTSTR) CString("IAS database entry is
corrupt"));
}
//
// search for the PI value 0x00 and check for 9 wire support, see IrCOMM spec.
//
pPI = pIASQuery->irdaAttribute.irdaAttribOctetSeq.OctetSeq;
pPL = pPI + 1;
pPV = pPI + 2;
while (1)
{
if (*pPI == 0 && (*pPV & 0x04))
{
//
// It's good, don't need to check any futher
181