Page 204 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 204

PDA 09  5/27/03  8:50 AM  Page 180
                             }                       PDA Robotics
                             //
                             // search for the peer device, In this case PDA Robot
                             //
                             pDevList->numDevice = 0;
                             if (getsockopt(Infrared_Socket, SOL_IRLMP, IRLMP_ENUMDEVICES, (CHAR *) pDevList,
                               &DevListLen) == SOCKET_ERROR)
                             {
                               msg = "No Peer conection";
                               this->m_status_window.SetWindowText( (LPCTSTR) msg);
                               return false;
                             }else{

                               //
                               // print number and name of devices found
                               //

                               char bu[20];
                               _ultoa( pDevList->numDevice , bu, 10 );

                               msg = "Num devices: ";
                               msg += bu;
                               msg += " Name ";
                               msg += pDevList->Device->irdaDeviceName;
                               this->m_status_window.SetWindowText( (LPCTSTR) msg);
                             }
                             if (pDevList->numDevice == 0)
                             {
                               msg = "No IrDA device found";
                               this->m_status_window.SetWindowText( (LPCTSTR) msg);
                               return false;
                             }
                             //
                             // Assume first device, we should check the name of the device
                             // to ensure that it is 'Generic IrDA', the default name provided by the
                             // MCP2150 IrDA chip used on the PDA Robot circuit.
                             //

                             memcpy(&DstAddrIR.irdaDeviceID[0], &pDevList->Device[0].irdaDeviceID[0], 4);
                             //
                             // query the peer to check for 9wire IrCOMM support
                             //


                          180
   199   200   201   202   203   204   205   206   207   208   209