// This method handles the 'build selection' command. bool CatchBuildSelection() { //TODO: //this should really check if any files haven't been saved yet //if thats so, we should ignore bCompileCpp //also we should Abort runthread, and restart //Ok to compile c++ now if (bCompileCpp) { bCompileCpp = false; GetBuildOutputPane().OutputString("Built opC++ Successfully...\n"); return(true); } //don't compile c++ if we have opcpp running if (runthread != null) { return(false); } mode = CompileMode.BuildSelection; List <Project> projects = FindCurrentProjects(); returncode totalresult = BuildProjects(projects); //don't compile c++, we're running opcpp if (totalresult == returncode.None) { return(true); } return(false); }
// This handles the 'start without debugging' command. bool CatchNoDebugStart() { //Ok to compile c++ now if (bCompileCpp) { bCompileCpp = false; GetBuildOutputPane().OutputString("Built opC++ Successfully...\n"); return(true); } //don't compile c++ if we have opcpp running if (runthread != null) { return(false); } mode = CompileMode.NoDebugStart; List <Project> projects = FindProjects(); returncode totalresult = BuildProjects(projects); //don't compile c++, we're running opcpp if (totalresult == returncode.None) { return(true); } return(false); }
void WriteVariable(parameters paras, out results rets) { rets = new results(); result rst = new result(); ThreadUpdate tusend = new ThreadUpdate(); if (paras.Count != 1) { rets.response = rspCode.negitive; rets.resDesc = "More than 1 variable to read."; saveLogfile(rets.resDesc); } else { CDDLBase ddb = new CDDLBase(); if (hartDev.getItembyName((string)paras[0].value, ref ddb)) { if (ddb.GetType() == typeof(CDDLVar)) { CDDLVar vartowrite = (CDDLVar)ddb; hCcommandDescriptor pCmdDesc = vartowrite.getWrCmdList().ElementAt(0); CDDLCmd pCmd = hartDev.Cmds.getCmdByNumber(pCmdDesc.cmdNumber); if (hartDev.pCmdDispatch.SendCmd(pCmd, pCmdDesc.transNumb, null, logSw) == Common.SUCCESS) { saveLogfile("Command {0}, transaction {1} sent.", pCmdDesc.cmdNumber, pCmdDesc.transNumb); returncode creply = hartDev.parentform.ReData(null); hartDev.parentform.setThread(tusend); tusend.ucTranNumSent = (byte)pCmdDesc.transNumb; tusend.ucCmdSent = (byte)pCmdDesc.cmdNumber; hartDev.parentform.procRcvData(creply, pCmdDesc.transNumb, pCmd.getCmdNumber(), pCmd.getOperation()); rets.response = (hartDev.parentform.getCmdRes() as results).response;//getCmdRes //rst.name = (string)paras[0].value; //rst.rtype = resultDataType.floatpoint; //rst.value = vartowrite.GetDispString(); rets.Add(rst); } else { rets.response = rspCode.negitive; rets.resDesc = String.Format("The Command {0}, transaction {1} cannot be sent.", pCmdDesc.cmdNumber, pCmdDesc.transNumb); saveLogfile(rets.resDesc); } } else { rets.response = rspCode.negitive; rets.resDesc = "The item is not a variable."; saveLogfile(rets.resDesc); } } else { rets.response = rspCode.negitive; rets.resDesc = "The variable name is not valid."; saveLogfile(rets.resDesc); } } }
// This method handles the 'build solution' command. bool CatchBuildSolution() { //TODO: //this should really check if any files haven't been saved yet //if thats so, we should ignore bCompileCpp //also we should Abort runthread, and restart //NOTE: I dont think we can do this... because dependency checking happens too late // but maybe I'm wrong there. // I suppose maybe the best way is to add a custom command, // and one that lists all the dependencies correctly, then it // *might* work (could test using manually input stuff) // If your custom build task is a wrapper around command line util // (compiler or similar executable) and you want to show output // from it in Output Window panel you should inherit your custom // build task from ToolTask base class. ToolTask class is able to // write output from command line utility line by line. //Ok to compile c++ now if (bCompileCpp) { bCompileCpp = false; GetBuildOutputPane().OutputString("Built opC++ Successfully...\n"); return(true); } //don't compile c++ if we have opcpp running if (runthread != null) { return(false); } mode = CompileMode.BuildSolution; List <Project> projects = FindProjects(); returncode totalresult = BuildProjects(projects); //don't compile c++, we're running opcpp if (totalresult == returncode.None) { return(true); } return(false); }
// Builds a list of projects in the current solution. // TODO - does this work? returncode BuildProjects(List <Project> projects) { returncode totalresult = returncode.None; bool bforce = false; //directly save the files foreach (Document doc in App().Documents) { if ((doc.FullName.EndsWith(".oh") || doc.FullName.EndsWith(".doh")) && doc.Saved == false) { if (doc.FullName.EndsWith(".doh")) { bforce = true; } doc.Save(doc.FullName); } } GetOutputPane().Clear(); GetOutputPane().Activate(); Application.DoEvents(); foreach (Project project in projects) { returncode result = BuildProject(project, bforce); if (result == returncode.Errors) { totalresult = returncode.Errors; return(totalresult); } else if (result == returncode.Success) { totalresult = returncode.Success; } } return(totalresult); }
private returncode getDevice(/*DD_Key_t wrkingKey, aCdevice* pAbstractDev, CDictionary dictionary, LitStringTable* litStrings,*/ bool isInTokenizer = false) // recurse down the entire hierarchy { returncode rc = returncode.eOk; devDesc = new DDlDevDescription(hcfg.ddRoot); rc = devDesc.Initialize(strInputFileName, locLan, dict); /* * char erInputFileName[MAX_FILE_NAME_PATH]; * * if (false == bRetVal)// can't be null... && NULL != chInputFileName) * { * char tmpFileName[MAX_FILE_NAME_PATH]; * unsigned filelen = strlen(chInputFileName) - 4; * strncpy(erInputFileName, chInputFileName, filelen + 5);/* stevev-for better reporting / * strncpy(tmpFileName, chInputFileName, filelen); * tmpFileName[filelen] = '\0'; * if (tmpFileName) * { * strcat(tmpFileName, ".fms"); * tmpFileName[filelen + 4] = '\0'; * strcpy(chInputFileName, tmpFileName); * chInputFileName[filelen + 4] = '\0'; * bRetVal = devDesc.Initialize(chInputFileName, "|en|", dictionary); * } * } */ if (rc != returncode.eOk) { return(rc); } int iDevItemListSize = devDesc.ItemsList.Count; devDesc.LoadDeviceDescription(isInTokenizer); return(rc); }
public override void procRcvData(returncode rc, int trannum, uint cmdnum, cmdOperationType_t operation) { form.procRcvHartData(rc, trannum, cmdnum, operation); }
private returncode identifyDDfile() { returncode rc = returncode.eErr; makeDirTree(); DevTypStruct find = new DevTypStruct(); scanDirTree(ref find); strInputFileName = hcfg.ddRoot + "\\" + strManufacturer + "\\" + strDeviceType + "\\" + string.Format("{0:D2}", find.devrev) + string.Format("{0:D2}", find.ddrev) + "." + find.ext; Common.chInputFileName = strInputFileName; BinaryReader br; // 读取文件 try { br = new BinaryReader(new FileStream(strInputFileName, FileMode.Open)); } catch (IOException e11) { Console.WriteLine(e11.Message + "\n Cannot open file."); return(returncode.eFileErr); } DDlDevDescription.DDOD_HEADER header = new DDlDevDescription.DDOD_HEADER(); header.byManufacturer = new byte[3]; DDlDevDescription.ReadHeader(br, ref header); int mfg = header.byManufacturer[0] << 16 | header.byManufacturer[1] << 8 | header.byManufacturer[2]; header.device_type = (ushort)(((header.device_type & 0x00ff) << 8) | ((header.device_type & 0xff00) >> 8)); eFFVersionMajor = header.tok_rev_major; eFFVersionMinor = header.tok_rev_minor; if (eFFVersionMajor < 5)// FDI version number { if (eFFVersionMajor == 3) { eFFVersionMajor += 7;// translate to hart version } if (eFFVersionMajor == 4) { eFFVersionMajor += 6;// translate to hart version // fdi4 => hcf10 [4/3/2014 timj] } } if ((eFFVersionMajor != find.bffver) || (mfg != hartDev.ddbDeviceID.wManufacturer) || (header.device_type != hartDev.ddbDeviceID.wDeviceType) || (header.device_revision != find.devrev) || (header.dd_revision != find.ddrev)) {// header info does not match filename // error message - //MessageBox.Show("Error: DD File header information does not match file name."); br.Close(); return(returncode.eFileErr); } br.Close(); //////VerificationLevel//?????? if (DevDDList.Count > 0) { rc = returncode.eOk; } return(rc); }
public rtNewDev newDevice(/*Identity_s ident*/ StreamWriter sw) { rtNewDev rt = rtNewDev.eSuc; logSw = sw; DevDDList.Clear(); hartDev = new HARTDevice(this); returncode rc; if (!hcfg.bOffline) { strManufacturer = ""; rc = GetIdentity(0, sw);//获得设备信息 if (rc != returncode.eOk) { switch (rc) { case returncode.eSerErr: //MessageBox.Show("串口错误"); rt = rtNewDev.eCommSerErr; break; default: //MessageBox.Show("未知错误"); rt = rtNewDev.eOther; break; } return(rt); } //Thread th = new Thread(RecvData); //th.Start(); returncode creply = RecvData(sw); if (creply == returncode.eOk) { //string msgRcv = buildStringTypeInfo(rcvlen, rcvbuf); //dispMsgRcv(msgRcv); if (rcvlen != 0) { Rcv_00(rcvbuf, rcvlen, sw); rcvlen = 0; } } else if (creply == returncode.eTimeOutErr) { //MessageBox.Show(Resource.NoRsp, Resource.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return(rtNewDev.eCommTimeout); } else if (creply == returncode.eCloseErr) { //MessageBox.Show(Resource.NonePort, Resource.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return(rtNewDev.eCommSerErr); } //this.Text = await testString(); } else { //"C:\hcf\ddl\Library\00601e\e188" //strManufacturer = "000026";//"00601e";// //strDeviceType = "0006";//"e188";// //strManufacturer = "00601e"; //strDeviceType = "e188"; //strDeviceRevision = "3";//"1"; //strDDRevision = "7";// "1"; if (strManufacturer != null && strManufacturer != "") { if (strManufacturer.Contains("0x")) { strManufacturer = strManufacturer.Remove(0, 2); } hartDev.ddbDeviceID.wManufacturer = Convert.ToUInt16(strManufacturer, 16);// 0x26;//0x00601e;// if (strDeviceType.Contains("0x")) { strDeviceType = strDeviceType.Remove(0, 2); } hartDev.ddbDeviceID.wDeviceType = Convert.ToUInt16(strDeviceType, 16);// 0x6;//0xe188;// } } rc = identifyDDfile(); if (rc == returncode.eOk) { dict = new HartDictionary(locLan); if (eFFVersionMajor < 8) { // then we have to load extra stuff buildDicitonary(); // uses chDbdir to open and fill } if (eFFVersionMajor <= 0x08) // temporary, delete this line for fm8 v 8.3 [2/25/2014 timj] { // fill all of the items & attributes of the abstract device, also dict & strings getDevice(); } } else if (rc == returncode.eFileErr) { return(rtNewDev.eDDFailed); } else { return(rtNewDev.eNoDD); } return(rt); }
public virtual void procRcvData(returncode rc, int trannum, uint cmdnum, cmdOperationType_t operation) { }