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

PDA 09  5/27/03  8:50 AM  Page 192
                             {
                               //                    PDA Robotics
                               // Receive the data from Command Center
                               //
                               ret = recv ( (SOCKET) m_pSocket, &szMessage[0], numbytes, 0);
                             }
                             else{
                               return;
                             }
                             //
                             // Set the status to the last command so it can be displayed
                             // in the status edit box named m_status_window and used in the
                             // OnTimer() function to relay the commands to PDA Robot
                             //

                             LastStatus = szMessage;
                             //
                             // Note: The Timer was started when the Wireless link was
                             // Enabled and the data received is interpreted when the timer
                             // goes off.
                             //


                          }


                          void CPDABotDlg::OnTimer(UINT nIDEvent)
                          {
                             m_status_window.SetWindowText( (LPCTSTR) LastStatus);

                             if(LastStatus == "SUCCESS" )
                             {
                               //
                               // We have connected to the Command Center
                               //
                               m_status_window.SetWindowText( (LPCTSTR) CString("Connect Infrared") );

                             }else if(LastStatus == "FORWARD"){
                               //
                               // Instruct PDA Robot to move Forward via the IR Socket if
                               // an IrDA link has been established
                               //

                               if( m_bIrDAConnected )
                               {
                                  send( Infrared_Socket, (const char *) "be", 2, MSG_DONTROUTE);

                          192
   211   212   213   214   215   216   217   218   219   220   221