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

PDA 09  5/27/03  8:50 AM  Page 178
                             }
                             //                      PDA Robotics
                             // Disable the wireless button since we MUST first  be connetd to the command cen-
                          ter
                          // before initializing the IrDA connection if we want to use the wireless link
                             //
                             m_wireless_button.EnableWindow(FALSE);

                          }
                          Below is the code listing for InitiateIrDAConnection().

                          bool CPDABotDlg::InitiateIrDAConnection()
                          {
                             //
                             // Initiate an IrDA client
                             //

                          #define DEVICE_LIST_LEN 5
                          #define IAS_QUERY_ATTRIB_MAX_LEN 32

                          //
                          // DevListBuff discovery buffer stores the information that PDARobots body will send to
                          // us in the initial stages of the IrDA handshake
                          //

                             BYTE  DevListBuff[sizeof(DEVICELIST) - sizeof(IRDA_DEVICE_INFO) +
                               (sizeof(IRDA_DEVICE_INFO) * DEVICE_LIST_LEN)];
                             int           DevListLen = sizeof(DevListBuff);
                          //
                          // This list stores all the devices that responded to our IrDA query. There may
                          // be an IrDA compliant printer, like my HP1000, and the PDABot body. We
                          // should look for 'Generic IrDA' and connect with only this device. I will
                          // leave this modification up to you. See the chapter on the PalmOS software
                          // for instructions on how to do this. For now I pick the first device in the list.
                          //
                             PDEVICELIST   pDevList   = (PDEVICELIST) &DevListBuff;

                             //
                             // buffer for IAS query
                             //

                             BYTE          IASQueryBuff[sizeof(IAS_QUERY) - 3 + IAS_QUERY_ATTRIB_MAX_LEN];
                             int           IASQueryLen = sizeof(IASQueryBuff);
                             PIAS_QUERY    pIASQuery   = (PIAS_QUERY) &IASQueryBuff;

                             //
                             // for searching through peers IAS response

                          178
   197   198   199   200   201   202   203   204   205   206   207