Пример #1
0
        /// <summary>
        /// Get new data from ECU
        /// </summary>
        /// <returns>True on success, false on error, then old data will be available</returns>
        public ReturnValue RefreshValues()
        {
            ReturnValue ret = mProtocol.ReadActualValues(out mReadBuffer);

            if (ret == ReturnValue.NoError)
            {
                for (byte i = 0; i < mValueNumber; i++)
                {
                    UInt16 uiValue = (UInt16)(mReadBuffer[(i * 2) + 1] * 256);
                    uiValue += mReadBuffer[(i * 2)];
                    if (Item[i] == null)
                    {
                        Item[i] = new ActualValueItem();
                    }
                    Item[i].ValueString = mProtocol.GetValueString(i, uiValue);
                }
            }
            return(ret);
        }