private int OpenPort(out string strError) { int hr; //Open Port - get last (connected) port in the ports list string[] portsStr; hr = pp.GetPorts(out portsStr, out strError); if (!SUCCEEDED(hr)) { return(hr); } if (portsStr.Length <= 0) { strError = "==> Error! Connect MiniProg3 to PC!"; return(-1); } bool bFound = true; string portName = ""; for (int i = 0; i < portsStr.Length; i++) { if (portsStr[i].StartsWith("MiniProg3")) { portName = portsStr[i]; bFound = true; break; } } if (!bFound) { strError = "==> Error! Connect MiniProg3 to PC!"; return(-1); } hr = pp.OpenPort(portName, out strError); return(hr); }
public string[] GetPorts() { //object portArray; string[] portArray; string strError; if (IsSuccess(Programmer.GetPorts(out portArray, out strError)) == false) { PSoCProgrammerError = true; } //PortList = portArray as string[]; if (portArray.Count() > 0) { Log.PrintLog(this, "Discovered " + portArray.Count().ToString() + " programers.", LogDetailLevel.LogRelevant); } return(portArray); }