Пример #1
0
 private void btnEstablishCancel_Click(object sender, EventArgs e)
 {
     discoverConnectStatus = DiscoverConnectStatus.EstablishCancel;
     DiscoverConnectUserInputControl();
     HCICmds.GAPCmds.GAP_TerminateLinkRequest terminateLinkRequest = new HCICmds.GAPCmds.GAP_TerminateLinkRequest();
     try
     {
         terminateLinkRequest.connHandle = (ushort)65534;
         terminateLinkRequest.discReason = HCICmds.GAP_DisconnectReason.Remote_User_Terminated;
         devForm.sendCmds.SendGAP(terminateLinkRequest);
     }
     catch (Exception ex)
     {
         string msg = string.Format("Failed To Send Terminate Link Message.\n\n{0}\n", ex.Message);
         msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg);
     }
 }
Пример #2
0
 private void btnTerminate_Click(object sender, EventArgs e)
 {
     discoverConnectStatus = DiscoverConnectStatus.Terminate;
     DiscoverConnectUserInputControl();
     HCICmds.GAPCmds.GAP_TerminateLinkRequest terminateLinkRequest = new HCICmds.GAPCmds.GAP_TerminateLinkRequest();
     bool flag;
     try
     {
         terminateLinkRequest.connHandle = Convert.ToUInt16(tbTermConnHandle.Text, 16);
         terminateLinkRequest.discReason = HCICmds.GAP_DisconnectReason.Remote_User_Terminated;
         flag = devForm.sendCmds.SendGAP(terminateLinkRequest);
     }
     catch (Exception ex)
     {
         string msg = string.Format("Invalid Connection Handle\n\n{0}\n", ex.Message);
         msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg);
         tbTermConnHandle.Focus();
         flag = false;
     }
     if (flag)
         return;
     discoverConnectStatus = DiscoverConnectStatus.Idle;
     DiscoverConnectUserInputControl();
 }