Example #1
0
 /// <summary>Get strings for actual values from language read by connection
 /// The text for unit is automatically alternative unit, if factor is set</summary>
 /// <param name="NoAltUnit">True to use original unit, false for alternative unit (if available)</param>
 public void RefreshLanguage(bool NoAltUnit)
 {
     mProtocol.SetValueAltUnitFlag(NoAltUnit);
     for (byte i = 0; i < mValueNumber; i++)
     {
         Item[i]         = new ActualValueItem();
         Item[i].Name    = mProtocol.GetValueName(i);
         Item[i].Unit    = mProtocol.GetValueUnit(i);
         Item[i].Hidden  = mProtocol.GetValueHiddenFlag(i);
         Item[i].Display = mProtocol.GetValueDisplayFlag(i);
     }
 }
Example #2
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);
        }