Esempio n. 1
0
 private void btnSendPassKey_Click(object sender, EventArgs e)
 {
     PairBondFieldTabDisable(true);
     HCICmds.GAPCmds.GAP_PasskeyUpdate gapPasskeyUpdate = new HCICmds.GAPCmds.GAP_PasskeyUpdate();
     try
     {
         gapPasskeyUpdate.connHandle = Convert.ToUInt16(tbPasskeyConnHandle.Text.Trim(), 16);
     }
     catch (Exception ex)
     {
         msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("Invalid Connection Handle\nFormat: 0x0000\n\n{0}\n", ex.Message));
         tbPasskeyConnHandle.Focus();
         PairBondUserInputControl();
         return;
     }
     gapPasskeyUpdate.passKey = tbPasskey.Text;
     ShowProgress(true);
     devForm.StartTimer(DeviceForm.EventType.PairBond);
     if (devForm.sendCmds.SendGAP(gapPasskeyUpdate))
         return;
     if (tcDeviceTabs.SelectedIndex == 2)
     {
         devForm.StopTimer(DeviceForm.EventType.PairBond);
         ShowProgress(false);
         PairBondUserInputControl();
     }
     msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("Invalid Passkey Length\nLength must be {0:D}", 6));
 }