/// <summary> /// Event handler for DBC library status /// </summary> /// <param name="status">Status.</param> internal void DBCErrorHandler(int status) { switch (status) { case (int)ErrorStatus.SVT_LOGON: OnPortswapError?.Invoke(this, ServiceTool.Legacy.Dongle.Constants.SVTLogonError); break; case (int)ErrorStatus.SVT_CONNECTED: OnPortswapError?.Invoke(this, ServiceTool.Legacy.Dongle.Constants.SVTConnected); break; case (int)ErrorStatus.SVT_TIMEOUT: case (int)ErrorStatus.SVT_NO_RESPONSE: OnPortswapError?.Invoke(this, ServiceTool.Legacy.Dongle.Constants.SVTNoResponse); break; } }
/// <summary> /// Process the incoming data when in LOGON in state; Look for the SVT /// logon sequece back before going to PASSTHROUGH state /// if Logon on fails send out event /// </summary> /// <returns></returns> /// <param name="rawData">Raw data.</param> internal async Task EscapeResponse(byte[] rawData) { Console.WriteLine(ServiceTool.Legacy.REM.Helper.ByteArrayToString(rawData)); foreach (byte i in rawData) { switch (i) { case 0x1b: EscapeFlag = true; break; case 0x5b: LeftBracketFlag = true; break; case 0x79: if ((EscapeFlag == true) && (LeftBracketFlag == true)) { Log("Escape Response Received"); PortState = (int)State.PASSTHROUGH; await GECBBaud(); } break; case 0x62: //TODO Item# 2 SVT logon failed OnPortswapError?.Invoke(this, ServiceTool.Legacy.Dongle.Constants.SVTLogonError); break; case 0x68: OnPortswapError?.Invoke(this, ServiceTool.Legacy.Dongle.Constants.SVTLogonError); //Port Swap not supported Console.WriteLine("Fail"); break; } } }