Пример #1
0
        /// <summary>
        /// Callback for the Ergometer. Contains data.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Ergo_SubscriptionValueChanged(object sender, BLESubscriptionValueChangedEventArgs e)
        {
            this.bLESimulator.SaveBytesErgo(e.Data);
            this.bLESimulator.WriteData(WriteOption.Ergo);
            BLEDecoderErgo.Decrypt(e.Data, this.dataHandler);
            string toSendErgoData = this.dataHandler.ReadLastData();

            this.iClient.Write(toSendErgoData);
        }
Пример #2
0
        /// <summary>
        /// Run the simulator with a data transfer time of 4Hz, just like the real protocol.
        /// </summary>

        public void RunSimulator()
        {
            BLEDataHandler bLEDataHandler = new BLEDataHandler(ergoID);
            int            i    = 0;
            List <byte[]>  data = new List <byte[]>();

            while (true)
            {
                data = ReadData(ApplicationSettings.GetReadWritePath(ergoID), WriteOption.Ergo);
                System.Threading.Thread.Sleep(250);
                BLEDecoderErgo.Decrypt(data[i], bLEDataHandler);
                if (i >= data.Count - 1)
                {
                    i = 0;
                }
                i++;
            }
        }
Пример #3
0
        /// <summary>
        /// Run the simulator with a data transfer time of 4Hz, just like the real protocol.
        /// </summary>

        public void RunSimulator()
        {
            this.bLEDataHandler = new BLEDataHandler(this._ergoID, this._patientName, this._patientNumber);
            int           i    = 0;
            List <byte[]> data = new List <byte[]>();

            while (true)
            {
                data = this.ReadData(ApplicationSettings.GetReadWritePath(this._ergoID), WriteOption.Ergo);
                BLEDecoderErgo.Decrypt(data[i], this.bLEDataHandler);
                string toSend = this.bLEDataHandler.ReadLastData();                 // Data that should be send to the client.
                this._iClient.Write(toSend);
                if (i >= data.Count - 1)
                {
                    i = 0;
                }

                i++;
                System.Threading.Thread.Sleep(250);
            }
        }
Пример #4
0
        /// <summary>
        /// Callback for the Ergometer. Contains data.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Ergo_SubscriptionValueChanged(object sender, BLESubscriptionValueChangedEventArgs e)
        {
            bLESimulator.SaveBytesErgo(e.Data);
            bLESimulator.WriteData(WriteOption.Ergo);
            BLEDecoderErgo.Decrypt(e.Data, this.dataHandler);
        }