コード例 #1
0
ファイル: OltProtocol.cs プロジェクト: dimabugrov/ecusystems
        public void SetIoControlValue(IoControlType ioControlType, byte rawValue)
        {
            var request = new IoControlRequest();

            request.StartCaptureAndSetValue((byte)ioControlType, rawValue);
            Requests.Enqueue(request);
        }
コード例 #2
0
        private static bool GetIoControlType(object sender, out IoControl control, out IoControlType ioControlType)
        {
            control       = sender as IoControl;
            ioControlType = IoControlType.Unknown;
            var ioControlTypeStr = control != null && control.Tag != null?control.Tag.ToString() : null;

            return(!String.IsNullOrEmpty(ioControlTypeStr) && Enum.TryParse(ioControlTypeStr, true, out ioControlType));
        }
コード例 #3
0
        private bool GetRawValue(IoControl control, IoControlType ioControlType, out byte rawValue)
        {
            rawValue = 0;
            var value = control.GetCurrentvalue();

            if (!value.Item1)
            {
                return(false);
            }
            var phisvalue = value.Item3;

            switch (ioControlType)
            {
            case IoControlType.RxxStep:
                rawValue = (byte)Math.Round(phisvalue, MidpointRounding.AwayFromZero);
                break;

            case IoControlType.XxRpm:
                rawValue = (byte)Math.Round(phisvalue / 10, MidpointRounding.AwayFromZero);
                break;

            case IoControlType.Alf:
                rawValue = (byte)Math.Round(phisvalue * 256 / 14.7 - 128, MidpointRounding.AwayFromZero);
                break;

            case IoControlType.Uoz:
                rawValue = (byte)Math.Round(phisvalue * 2, MidpointRounding.AwayFromZero);
                break;

            case IoControlType.Duoz:
                rawValue = (byte)Math.Round(phisvalue, MidpointRounding.AwayFromZero);
                break;

            case IoControlType.Faza:
                rawValue = (byte)Math.Round(phisvalue / 6, MidpointRounding.AwayFromZero);
                break;

            case IoControlType.InjCoeff:
                rawValue = (byte)Math.Round(phisvalue * 256 - 128, MidpointRounding.AwayFromZero);
                break;

            case IoControlType.Twat:
                rawValue = (byte)Math.Round(phisvalue + 60, MidpointRounding.AwayFromZero);
                break;
            }

            return(true);
        }
コード例 #4
0
ファイル: OltProtocol.cs プロジェクト: dimabugrov/ecusystems
 public void StopIoControl(IoControlType ioControlType)
 {
     ioControlRequest.StopCapture((byte)ioControlType);
     ExecuteRequest(ioControlRequest);
 }
コード例 #5
0
ファイル: OltProtocol.cs プロジェクト: dimabugrov/ecusystems
 public bool StartIoControl(IoControlType ioControlType, byte rawValue)
 {
     ioControlRequest.StartCaptureAndSetValue((byte)ioControlType, rawValue);
     ExecuteRequest(ioControlRequest);
     return(ioControlRequest.Test());
 }