Esempio n. 1
0
        private void btTonePlyCfgGet_Click(object sender, EventArgs e)
        {
            UInt16 attrID, freq;
            byte   spl;

            DateTime tStart = DateTime.Now;
            TimeSpan ts     = DateTime.Now.Subtract(tStart);

            attrID = m_ParentFrm.c_BleDev.AttrHandleByUUID(DatConvert.ByteArrayToHexString(UUID_Config));
            if (attrID != CAttribute.InvalidHandle)
            {
                Byte[] cmd = m_ParentFrm.bglib.BLECommandATTClientReadByHandle(m_ParentFrm.c_BleDev.ConnHandle, attrID);
                m_ParentFrm.BleDoReadAction();
                m_ParentFrm.SendBleCmd(cmd);

                while (m_ParentFrm.BleIsReadDone() == false)
                {
                    Application.DoEvents();
                    ts = DateTime.Now.Subtract(tStart);
                    if (ts.Seconds > 1)
                    {
                        break;
                    }
                }

                if (ts.Seconds <= 1)
                {
                    spl  = m_ParentFrm.c_BleDev.AttReadValue[0];
                    freq = BitConverter.ToUInt16(m_ParentFrm.c_BleDev.AttReadValue, 1);

                    tbTonePlyFreqGet.Text = freq.ToString();
                    tbTonePlySplGet.Text  = spl.ToString();
                }
            }
        }
Esempio n. 2
0
        private void btFitStsGet_Click(object sender, EventArgs e)
        {
            UInt16   attrID;
            byte     sts;
            DateTime tStart = DateTime.Now;
            TimeSpan ts     = DateTime.Now.Subtract(tStart);

            attrID = m_ParentFrm.c_BleDev.AttrHandleByUUID(DatConvert.ByteArrayToHexString(UUID_Activate));
            if (attrID != CAttribute.InvalidHandle)
            {
                Byte[] cmd = m_ParentFrm.bglib.BLECommandATTClientReadByHandle(m_ParentFrm.c_BleDev.ConnHandle, attrID);
                m_ParentFrm.BleDoReadAction();
                m_ParentFrm.SendBleCmd(cmd);

                while (m_ParentFrm.BleIsReadDone() == false)
                {
                    Application.DoEvents();
                    ts = DateTime.Now.Subtract(tStart);
                    if (ts.Seconds > 1)
                    {
                        break;
                    }
                }

                if (ts.Seconds <= 1)
                {
                    sts = m_ParentFrm.c_BleDev.AttReadValue[0];
                    tbFitStatusGet.Text = CvtStatusToString(sts);
                }
            }
        }
Esempio n. 3
0
        private void btCalibMicMaskGet_Click(object sender, EventArgs e)
        {
            UInt16   attrID;
            UInt16   maskVal;
            DateTime tStart = DateTime.Now;
            TimeSpan ts     = DateTime.Now.Subtract(tStart);


            attrID = m_ParentFrm.c_BleDev.AttrHandleByUUID(DatConvert.ByteArrayToHexString(UUID_MicMask));
            if (attrID != CAttribute.InvalidHandle)
            {
                Byte[] cmd = m_ParentFrm.bglib.BLECommandATTClientReadByHandle(m_ParentFrm.c_BleDev.ConnHandle, attrID);
                m_ParentFrm.BleDoReadAction();
                m_ParentFrm.SendBleCmd(cmd);
                while (m_ParentFrm.BleIsReadDone() == false)
                {
                    Application.DoEvents();
                    ts = DateTime.Now.Subtract(tStart);
                    if (ts.Seconds > 1)
                    {
                        break;
                    }
                }

                if (ts.Seconds <= 1)
                {
                    maskVal = System.BitConverter.ToUInt16(m_ParentFrm.c_BleDev.AttReadValue, 0);

                    tbCalibMicMaskGet.Text = CvtMicMaskToString(maskVal);
                }
            }
        }