Inheritance: System.Windows.Forms.Form
Esempio n. 1
0
 private bool AddToEndCsv(DeviceTabsForm.CsvData newCsvData, ref List<DeviceTabsForm.CsvData> csvData)
 {
     bool flag = false;
     try
     {
         if (newCsvData == null)
             throw new ArgumentException(string.Format("There Is No Data To Add.\n"));
         DeviceTabsForm.CsvData csvData1 = new DeviceTabsForm.CsvData();
         csvData.Add(new DeviceTabsForm.CsvData()
         {
             addr = newCsvData.addr,
             auth = newCsvData.auth,
             ltk = newCsvData.ltk,
             div = newCsvData.div,
             rand = newCsvData.rand
         });
     }
     catch (Exception ex)
     {
         msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("Cannot Add Data To End Of The CSV List.\n\n{0}\n", ex.Message));
         flag = true;
     }
     return flag;
 }
Esempio n. 2
0
 public void SetPairingStatus(DeviceTabsForm.PairingStatus state)
 {
     pairingStatus = state;
     PairBondUserInputControl();
 }
Esempio n. 3
0
 private bool ReplaceAddrDataInCsv(DeviceTabsForm.CsvData newCsvData, ref List<DeviceTabsForm.CsvData> csvData, int csvIndex)
 {
     bool flag = false;
     try
     {
         if (csvData == null || csvData.Count <= 0)
             throw new ArgumentException(string.Format("There Is No Csv Data To Replace\n"));
         DeviceTabsForm.CsvData csvData1 = new DeviceTabsForm.CsvData();
         DeviceTabsForm.CsvData csvData2 = csvData[csvIndex];
         if (csvData2.addr != newCsvData.addr)
             throw new ArgumentException(string.Format("The Addresses Do Not Match\nCSV Replace Is Cancelled\nExpected {0:S}\nFound {1:S}\n", csvData2.addr, newCsvData.addr));
         csvData2.addr = newCsvData.addr;
         csvData2.auth = newCsvData.auth;
         csvData2.ltk = newCsvData.ltk;
         csvData2.div = newCsvData.div;
         csvData2.rand = newCsvData.rand;
         csvData[csvIndex] = csvData2;
     }
     catch (Exception ex)
     {
         msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("Cannot Access The Data To Replace The Addr In The CSV List\n\n{0}\n", ex.Message));
         flag = true;
     }
     return flag;
 }
Esempio n. 4
0
 public void AddSlaveDevice(DeviceTabsForm.LinkSlave linkSlave)
 {
     bool dataErr = false;
     byte[] addr = new byte[6];
     int index = 0;
     string s = devUtils.UnloadDeviceAddr(linkSlave.slaveBDA, ref addr, ref index, false, ref dataErr);
     linkSlave.addrBDA = s;
     if (cbConnSlaveDeviceBDAddress.FindString(s) == -1)
     {
         ++SlaveDeviceFound;
         cbConnSlaveDeviceBDAddress.Items.Add(s);
         SetAddrType((byte)linkSlave.addrType);
         linkSlaves.Add(linkSlave);
     }
     if (cbConnSlaveDeviceBDAddress.Items.Count > 1)
     {
         cbConnSlaveDeviceBDAddress.SelectedIndex = 1;
         SetAddrType((byte)linkSlaves[cbConnSlaveDeviceBDAddress.SelectedIndex].addrType);
     }
     lblDeviceFound.Text = SlaveDeviceFound.ToString();
 }
Esempio n. 5
0
 private string GetPairingStatusStr(DeviceTabsForm.PairingStatus status)
 {
     string str1 = string.Empty;
     string str2;
     switch (status)
     {
         case DeviceTabsForm.PairingStatus.Empty:
             str2 = "";
             break;
         case DeviceTabsForm.PairingStatus.NotConnected:
             str2 = "Not Connected";
             break;
         case DeviceTabsForm.PairingStatus.NotPaired:
             str2 = "Not Paired";
             break;
         case DeviceTabsForm.PairingStatus.PasskeyNeeded:
             str2 = "Passkey Needed";
             break;
         case DeviceTabsForm.PairingStatus.DevicesPairedBonded:
             str2 = "Devices Paired And Bonded";
             break;
         case DeviceTabsForm.PairingStatus.DevicesPaired:
             str2 = "Devices Paired";
             break;
         case DeviceTabsForm.PairingStatus.PasskeyIncorrect:
             str2 = "Passkey Incorrect";
             break;
         case DeviceTabsForm.PairingStatus.ConnectionTimedOut:
             str2 = "Connection Timed Out";
             break;
         default:
             str2 = "Unknown Pairing Status";
             break;
     }
     return str2;
 }
Esempio n. 6
0
        public DeviceForm()
        {
            devInfo.DevForm = this;
            connectInfo.BDA = "00:00:00:00:00:00";
            connectInfo.Handle = 0;
            connectInfo.AddrType = 0;
            disconnectInfo.BDA = "00:00:00:00:00:00";
            disconnectInfo.Handle = 0;
            disconnectInfo.AddrType = 0;
            Connections.Clear();
            commMgr.InitCommManager();
            msgLogForm = new MsgLogForm(this);
            commSelectForm = new CommSelectForm();

            InitializeComponent();

            Text = FormMain.ProgramTitle + FormMain.ProgramVersion;
            threadMgr = new ThreadMgr(this);
            sendCmds = new SendCmds(this);
            attrData.sendAutoCmds = false;
            attributesForm = new AttributesForm(this);
            devTabsForm = new DeviceTabsForm(this);

            LoadUserInitializeValues();
            LoadUserSettings();

            sendCmds.DisplayMsgCallback = new DeviceForm.DisplayMsgDelegate(DisplayMsg);

            threadMgr.txDataOut.DeviceTxDataCallback = new DeviceForm.DeviceTxDataDelegate(DeviceTxData);
            threadMgr.txDataOut.DisplayMsgCallback = new DeviceForm.DisplayMsgDelegate(DisplayMsg);
            threadMgr.rxDataIn.DeviceRxDataCallback = new DeviceForm.DeviceRxDataDelegate(DeviceRxData);
            threadMgr.rxTxMgr.HandleRxTxMessageCallback = new DeviceForm.HandleRxTxMessageDelegate(HandleRxTxMessage);

            dspTxCmds.DisplayMsgCallback = new DeviceForm.DisplayMsgDelegate(DisplayMsg);
            dspTxCmds.DisplayMsgTimeCallback = new DeviceForm.DisplayMsgTimeDelegate(DisplayMsgTime);
            attributesForm.DisplayMsgCallback = new DeviceForm.DisplayMsgDelegate(DisplayMsg);
            msgLogForm.DisplayMsgCallback = new DeviceForm.DisplayMsgDelegate(DisplayMsg);
            devTabsForm.DisplayMsgCallback = new DeviceForm.DisplayMsgDelegate(DisplayMsg);

            threadMgr.Init(this);

            msgLogForm.TopLevel = false;
            msgLogForm.Parent = plLog;
            msgLogForm.Visible = true;
            msgLogForm.Dock = DockStyle.Fill;
            msgLogForm.ControlBox = false;
            msgLogForm.ShowIcon = false;
            msgLogForm.FormBorderStyle = FormBorderStyle.None;
            msgLogForm.StartPosition = FormStartPosition.Manual;
            msgLogForm.Show();

            devTabsForm.TopLevel = false;
            devTabsForm.Parent = plUserTabs;
            devTabsForm.Visible = true;
            devTabsForm.Dock = DockStyle.Fill;
            devTabsForm.ControlBox = false;
            devTabsForm.ShowIcon = false;
            devTabsForm.FormBorderStyle = FormBorderStyle.None;
            devTabsForm.StartPosition = FormStartPosition.Manual;
            devTabsForm.Show();

            attributesForm.TopLevel = false;
            attributesForm.Parent = plAttributes;
            attributesForm.Visible = true;
            attributesForm.Dock = DockStyle.Fill;
            attributesForm.ControlBox = false;
            attributesForm.ShowIcon = false;
            attributesForm.FormBorderStyle = FormBorderStyle.None;
            attributesForm.StartPosition = FormStartPosition.Manual;
            attributesForm.Show();
        }