コード例 #1
0
ファイル: DeviceTabsForm.cs プロジェクト: x893/BTool
 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
ファイル: DeviceTabsForm.cs プロジェクト: x893/BTool
 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();
 }