private void sendFlag(ref CommunicationManager targetComm) { if (this.frmLPCmdBufferAlwaysRadioBtn.Checked) { targetComm.SendFlag = 0; } else if (this.frmCmdBufferOnInputRadioBtn.Checked) { targetComm.SendFlag = 1; } else if (this.frmCmdBufferForceRadioBtn.Checked) { targetComm.SendFlag = 2; targetComm.OK_TO_SEND = true; targetComm.WriteData(); } else if (this.frmLPCmdBufferForceFalseRadioBtn.Checked) { targetComm.SendFlag = 3; targetComm.OK_TO_SEND = false; } }
private void sendBuffer(ref CommunicationManager targetComm) { bool flag = targetComm.OK_TO_SEND; targetComm.OK_TO_SEND = true; this.setFlagStatus(ref targetComm); targetComm.WriteData(); this.clearCommands(); targetComm.OK_TO_SEND = flag; }
public void AutoDetectBaudAfterFacRst4E(ref CommunicationManager targetComm) { if (CommunicationManager.ValidateCommManager(targetComm)) { targetComm.AutoDetectProtocolAndBaudDone = false; targetComm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.Text; targetComm.TxCurrentTransmissionType = CommunicationManager.TransmissionType.Text; targetComm.BaudRate = "4800"; targetComm.Flag_didFacRst_atSSB = true; uint baud = uint.Parse(targetComm.BaudRate); targetComm.comPort.UpdateBaudSettings(baud); targetComm.portDataInit(); targetComm.AutoDetectProtocolAndBaudDone = true; string msg = NMEAReceiver.NMEA_AddCheckSum(string.Format("$PSRF100,0,{0},8,1,0", targetComm.ToSwitchBaud)); msg = NMEAReceiver.NMEA_AddCheckSum("$PSRF105,1") + "\r\n" + msg; targetComm.WriteData(msg); Thread.Sleep(0x3e8); targetComm.RxType = CommunicationManager.ReceiverType.SLC; targetComm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.GPS; targetComm.TxCurrentTransmissionType = CommunicationManager.TransmissionType.GP2; targetComm.BaudRate = targetComm.ToSwitchBaud; int num2 = 0; uint num3 = uint.Parse(targetComm.BaudRate); while (num2++ < 5) { if (targetComm.comPort.UpdateBaudSettings(num3)) { break; } Thread.Sleep(1); } targetComm.portDataInit(); targetComm.AutoDetectProtocolAndBaudDone = true; } }
private void pollSWVersionHandler(CommunicationManager comm) { bool isSLCRx = false; int mid = 0x84; comm.CMC.TxCurrentTransmissionType = (CommonClass.TransmissionType) comm.TxCurrentTransmissionType; string messageProtocol = comm.MessageProtocol; if ((comm.RxType == CommunicationManager.ReceiverType.SLC) || (comm.RxType == CommunicationManager.ReceiverType.TTB)) { isSLCRx = true; if (comm.RxType == CommunicationManager.ReceiverType.TTB) { messageProtocol = "TTB"; } } string str3 = messageProtocol; if (str3 != null) { if (!(str3 == "SSB") && !(str3 == "TTB")) { if (str3 == "F") { mid = 0x17; } else if (str3 == "OSP") { messageProtocol = "SSB"; isSLCRx = false; mid = 0x84; } } else { mid = 0x84; } } string msg = comm.m_Protocols.GetDefaultMsgtoSend(isSLCRx, mid, -1, "Software Version Request", messageProtocol); comm.WriteData(msg); }
private bool manualConnect(ref CommunicationManager comm) { if (comm == null) { return false; } try { bool flag2; if (clsGlobal.IsMarketingUser()) { comm.IsAutoDetectBaud = true; } if (comm.IsSourceDeviceOpen()) { goto Label_04E8; } if (!comm.RequireHostRun || (sysCmdExec.IsExistingWin(comm.HostSWFilePath) != 0)) { goto Label_02AC; } string argStr = string.Empty; switch (comm.InputDeviceMode) { case CommonClass.InputDeviceModes.RS232: argStr = @"-a\\.\\" + comm.HostPair1 + " -y\"" + comm.HostAppCfgFilePath + "\" -e\"" + comm.HostAppMEMSCfgPath + "\""; break; case CommonClass.InputDeviceModes.TCP_Client: argStr = "-n" + comm.CMC.HostAppClient.TCPClientPortNum.ToString() + " -y\"" + comm.HostAppCfgFilePath + "\" -e\"" + comm.HostAppMEMSCfgPath + "\""; break; case CommonClass.InputDeviceModes.TCP_Server: argStr = "-n" + comm.CMC.HostAppServer.TCPServerPortNum.ToString() + " -y\"" + comm.HostAppCfgFilePath + "\" -e\"" + comm.HostAppMEMSCfgPath + "\""; break; } if (!comm.RequireEE) { goto Label_02A4; } string eESelect = comm.EESelect; if (eESelect != null) { if (!(eESelect == "CGEE")) { if (eESelect == "SGEE") { goto Label_01EB; } if (eESelect == "Mixed SGEE + CGEE") { goto Label_01F9; } } else { argStr = argStr + " -mode \"ff4_cgee_only\""; } } goto Label_0205; Label_01EB: argStr = argStr + " -mode \"ff4_sgee_only\""; goto Label_0205; Label_01F9: argStr = argStr + " -mode \"ff4_mixed_mode\""; Label_0205:; argStr = argStr + " -s\"" + comm.ServerName + "\" -d\"/diff/packedDifference.f2p" + comm.EEDayNum + "enc.ee\" -j\"" + comm.AuthenticationCode + "\" -k" + comm.ServerPort; if ((comm.EESelect == "CGEE") || (comm.EESelect == "Mixed SGEE + CGEE")) { argStr = argStr + " -b" + comm.BankTime; } Label_02A4: RunHostAppFromMain(argStr, ref comm); Label_02AC: flag2 = false; if (comm.ProductFamily == CommonClass.ProductType.GSD4e) { if (comm.InputDeviceMode == CommonClass.InputDeviceModes.RS232) { if ((comm.ResetPort != string.Empty) && (comm.ResetPort != "-1")) { string s = comm.ResetPort.Replace("COM", ""); int result = 0; if (int.TryParse(s, out result)) { comm.Init4eMPMWakeupPort(result); comm.Toggle4eWakeupPort(); } } if (comm.IsAutoDetectBaud) { if (searchforProtocolAndBaud(ref comm) > 0) { flag2 = true; } else { flag2 = false; } } else { comm.AutoDetectProtocolAndBaudDone = true; flag2 = comm.OpenPort(); } } else if (comm.InputDeviceMode == CommonClass.InputDeviceModes.I2C) { if (searchforProtocol_I2C(ref comm) > 0) { flag2 = true; } else { flag2 = false; } } else { flag2 = true; } if (!flag2) { comm.ConnectErrorString = "Autodetect baud failed!"; return false; } if (comm.MessageProtocol == "OSP") { comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.GPS; comm.CMC.RxCurrentTransmissionType = CommonClass.TransmissionType.GPS; } else if (comm.MessageProtocol == "NMEA") { comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.Text; comm.CMC.RxCurrentTransmissionType = CommonClass.TransmissionType.Text; } else { comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.Hex; comm.CMC.RxCurrentTransmissionType = CommonClass.TransmissionType.Hex; } } else { comm.AutoDetectProtocolAndBaudDone = true; if (!comm.OpenPort()) { comm.ConnectErrorString = "Unable to open port!"; return false; } } if (comm.RxType == CommunicationManager.ReceiverType.TTB) { comm.WriteData("A0A2 0009 CCA6 0002 0100 0000 00 8175 B0B3"); comm.WriteData("A0A2 0009 CCA6 0004 0100 0000 00 8177 B0B3"); comm.WriteData("A0A2 0009 CCA6 0029 0100 0000 00 819C B0B3"); } if (comm.RequireHostRun && (sysCmdExec.IsExistingWin(comm.HostSWFilePath) == 1)) { sysCmdExec.SetWinSize(comm.HostSWFilePath, 2); } if (comm.RequireHostRun) { comm.RxCtrl.SetMEMSMode(0); } if (comm.MessageProtocol != "NMEA") { comm.RxCtrl.PollClockStatus(); comm.RxCtrl.PollSWVersion(); comm.RxCtrl.PollNavigationParameters(); } if (comm.RxName == string.Empty) { comm.RxName = "SiRF_EVK"; } goto Label_0515; Label_04E8: manualDisconnect(ref comm); } catch (Exception exception) { if (comm != null) { comm.ConnectErrorString = "Error: " + exception.ToString(); } return false; } Label_0515: return true; }
private void pollTrackerConfig(CommunicationManager comm) { bool isSLCRx = false; int mid = 0xb2; int sid = 9; comm.CMC.TxCurrentTransmissionType = (CommonClass.TransmissionType) comm.TxCurrentTransmissionType; string messageProtocol = comm.MessageProtocol; string msg = comm.m_Protocols.GetDefaultMsgtoSend(isSLCRx, mid, sid, "SW Toolbox Message", messageProtocol); comm.WriteData(msg); }