⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 b00d8403b85f001d1289bbda6de18a35

📁 Vxworks环境下
💻
📖 第 1 页 / 共 3 页
字号:
/*$Log:**** Rev /main/NC_V0_integration/12** Date: Apr 17 17:33:43 2008 abdeaity** neue fkeys**** Rev /main/NC_V0_integration/11** Date: Apr 2 17:46:59 2008 karlgros** Grafik Applikation auf OEM-Partitition GUI_Demo**** Rev /main/NC_V0_integration/10** Date: Mar 7 17:45:10 2008 karlgros** changed MO_DIAGNOSE to the right key**** Rev /main/NC_V0_integration/9** Date: Mar 5 13:47:55 2008 abdeaity** define Clrt F tasten**** Rev /main/NC_V0_integration/8** Date: Jan 10 15:12:26 2008 abdeaity** exclude pxr0vxsc.h**** Rev /main/NC_V0_integration/7** Date: Nov 1 17:12:28 2007 abdeaity** Kommentar HMI Demo V2 **** Rev /main/NC_V0_integration/6** Date: Oct 30 15:12:51 2007 karlgros** putenv (benutzt in dab) fuer getenv von Tilcon**** Rev /main/NC_V0_integration/5** Date: Jun 6 17:10:18 2007 abdeaity** Kommentar:example of getting the text from system**** Rev /main/NC_V0_integration/4** Date: Jun 1 15:17:49 2007 abdeaity** Kommentar:exclude pxr0xx.h**** Rev /main/NC_V0_integration/3** Date: May 9 17:9:51 2007 abdeaity** Kommentar:call new functions**** Rev /main/NC_V0_integration/2** Date: Mar 13 13:58:1 2007 rolfglei** Log-Syntax geaendert*//*** ---------------------------------------------------------------------**                Copyright (c) Bosch Rexroth AG 1997 - 2007**                        All Rights Reserved** ---------------------------------------------------------------------****    File: dab_h_startgra.c** **    Responsible: AB** **    Description of functions:**                This file is the main File of the graphic task.**                It contain the needed steps to interface to NC Kernel**                on the basis of NCS and to interface to the Tilcon EVE**                There are a few platform-specific commands that need **                to be compiled into the program: **		  We define one of the following according to which **                platform we use:**                1. #define CC_TRT_DOS and #define HWDS_WINDOWS for**                        a Win32 applications**                                   OR**		  2. #define CC_TRT_VXWORKS for an applications running **                       on BRC Target whith Vxworks****					                           **                 in this file we will:**			  -  Start the  GUI task **			  -  Connect the GUI task to NCS   **			  -  InitializeApp (Start the Tilcon Engine EVE,**                        - Open channel to the EVE,Initialize Callbacks**                              Loead Window...)**			  -  wait for events from EVE**			  -  call callback Funktion as example to get **                           axis values, axis number....  ** ** ---------------------------------------------------------------------*//*======================================================================**           >>>>    C - Standard Headerfiles        <<<<** ==================================================================== */#ifdef HWDS_WINDOWS #include <windows.h> /* required for all Windows applications*/#include <stdlib.h>#include <stdio.h>#endif#include <time.h>#include <string.h>/* include Tilcon API functions *//* All function Names begining with TRT_ are Tilcon funktions*//*lint -e46*//*lint -e49*//*lint -e10*/#include <tilcon/TRTAPI.h> 	// Tilcon API functions/*lint +e46*//*lint +e49*//*lint +e10*//*======================================================================**           >>>>    General definitions for c-files <<<<**        these lines are generated automatically , do not modify !** ==================================================================== */#include <ty3c_mac.h>/*F*//*======================================================================**           >>>>    MTX - Headerfiles               <<<<** ==================================================================== */#ifndef HWDS_WINDOWS#ifndef PXR1OSTY_INCLUDED#include "pxr1osty.h"#endif#endif#ifndef NCS1MCSY_INCLUDED#include "ncs1mcsy.h"#endif#ifndef NCS1MCCN_INCLUDED#include "ncs1mccn.h"#endif#ifndef NCS1BAS_INCLUDED#include "ncs1bas.h"#endif #ifndef NCS1WEA_INCLUDED#include "ncs1wea.h"#endif #ifndef NCS1BAP_INCLUDED#include "ncs1bap.h"#endif /*======================================================================**           >>>>    Headerfiles of the subsystem    <<<<** ==================================================================== */#ifdef HWDS_WINDOWS#include "dab_h_win32.h"#endif#ifndef DAB_H_STARTGRA_INCLUDED#include "dab_h_startgra.h"#endif#ifndef DAB_H_ENGINE_IF_INCLUDED#include "dab_h_engine_if.h"#endif#ifndef DAB_H_WEA_INCLUDED#include "dab_h_wea_if.h"#endif#ifndef DAB_H_EVHAN_INCLUDED#include "dab_h_evhan.h"#endif#ifndef DAB_H_AXIS_IF_INCLUDED#include "dab_h_axis_if.h"#endif#ifndef DAB_H_OBJIDS_INCLUDED#include "dab_h_ObjIDs.h"#endif#ifndef DAB_H_CALLBACKS_INCLUDED#include "dab_h_callbacks.h"/*the Header file with Callback Funktions*/#endif#ifndef DAB_H_DIREXP_IF_INCLUDED#include "dab_h_direxp_if.h"#endif#ifndef DAB_H_GETMACPAR_INCLUDED#include "dab_h_getmacpar.h"#endif#ifndef DAB_H_NCEDITOR_INCLUDED#include "dab_h_nceditor.h"#endif#ifndef DAB_H_MEM_INCLUDED#include "dab_h_mem.h"#endif#ifndef DAB_H_MENUIF_INCLUDED#include "dab_h_menuif.h"#endif #ifndef DAB_H_MNTNANCE_INCLUDED#include "dab_h_mntnance.h"#endif#ifndef DAB_H_KYESDEF_INCLUDED#include "dab_h_keysdef.h"#endif#include "dab_h_cpl.h" /*Jiang add it*//*F*//*======================================================================**           >>>>    Local definitions               <<<<** ==================================================================== *//* Plattform specifacation for Tilcon EVE */#ifdef	CC_TRT_VXWORKS	     /* if the Engine (EVE) will run on Vxworks*/#define OS_TYPE TRT_VXWORKS#endif#ifdef CC_TRT_DOS	 /*if the Engine (EVE) will run on a windows PC*/#define OS_TYPE TRT_MS_WINDOWS			#endifEXPORT pid_t TRT_cid;EXPORT TRT_ReceiveData rec_data;EXPORT int EngineStatus;#define MAXWatchNr 40                 /*we can monitor only 40 watchponts at same time.*/char    FileFoldBuf[100];             /*it will save Directory you select.*/char Currentfileselect[20]=""; /*It will save the file name only.*/long WatchPointRecordNr=0;            /*Use it help me to operate the Watchpoint record.*/         struct  WatchPoint_ID{	char Name[20];                    /*"@1"*/	int  ID;						    /*save ID gived by system*/ 	int  Index;                       /*watchpoint element place in the array.*/	int  Value;                       /*watchpoint element value in the array.*/}WatchPointRecord[MAXWatchNr];        /*Use it to Save the Watchpoint*/ /************************************************************************/EXPORT void Directory_Load(void){	char buf[1024];	char *entry;	int  ret;	char buffer[4096]="";	char filebuffer[20];	struct stat file_state;	char BufferSelectPath[20]="";	char item_base[5]="item";	char imagebuf[50]="";	char child_item[10]="";	int  n=1;	int  itemnumber=0;	char tempr[3];		TRT_SetValues(TRT_cid2, "FilesUnderFold",		TRT_ATT_TEXT,"",		NULL);	//Get file path of access from HMI	TRT_GetValues(TRT_cid2,"FoldSelect",		TRT_ATT_TEXT,BufferSelectPath,NULL);		//Mybe at here we will add a procress to modify the pathbuffer by delete redundant '/'! 	Delete_RepetCharacter(BufferSelectPath,'/');		TRT_SetValues(TRT_cid2,"FoldSelect",		TRT_ATT_TEXT,BufferSelectPath,NULL);			//How to prepare to add a item to a tree	//at first you should know the parent item id 	//at second you should know the item id of itself 	//at 3rd you should know the item name which is be added to the tree.	//at last you should add a ico to the item ,but it must not be done.	sprintf(imagebuf,"%s\3%s\3%s\3%s\0",		"item", "item0",BufferSelectPath,"folderop.ico");		/* show root on the Tree view */	TRT_SetValues(TRT_cid2, "Test_tree",		/* del all already exist info on the tree view */		TRT_ATT_LIST_DELETE_ITEMS, -1,		/* add the item with the itemname and its icon */		TRT_ATT_TREE_ITEMS_ADD_ID_IMAGE , imagebuf,		NULL);		//At first you should clear the filelist every time.	TRT_SetValues(TRT_cid2, "FilesUnderFold",		TRT_ATT_LIST_DELETE_ITEMS,-1,		NULL); 		//login the file system	Ncs_Fsr_login("root", 0, 0, 0);		//open a directory and record the "context" in the bufferXX		ret=Ncs_Fsr_fopendir(BufferSelectPath,buf,1024);	Ncs_Fsr_chdir(BufferSelectPath);	Ncs_Fsr_getcwd(Currentpath);	if (ret< 0)	{		TRT_SetValues(TRT_cid2,"Message_Display",			TRT_ATT_TEXT,"Read_file_Error!!!",NULL);		return;	}	entry=NULL;	do	{		//extract entry from the bufferXX		ret=Ncs_Fsr_fgetdirentry(buf,&entry);		//Get the entry state		Ncs_Fsr_stat(entry,&file_state);		if(ret>0) 		{   //prepare to got a filename;			strcpy(filebuffer,entry);			if(S_ISDIR(file_state.st_mode)!=0){				//make a new item id as  				sprintf(tempr,"%d",n);				strcat(item_base,tempr);								strcpy(child_item,item_base);				sprintf(imagebuf,"%s\3%s\3%s\3%s\0",					"item0", child_item, entry, "folder.ico");							TRT_SetValues(TRT_cid2, "Test_tree",					TRT_ATT_TREE_ITEMS_ADD_ID_IMAGE,imagebuf,					NULL);				n++;			}			else{								TRT_SetValues(TRT_cid2, "FilesUnderFold",					TRT_ATT_ITEM_CREATE,entry,					NULL); 				//do someting record in order to show file list in this fold				record[itemnumber].fileid=itemnumber;				strcpy(record[itemnumber].filename,entry);				itemnumber++;			}		}		if (ret< 0)		{			TRT_SetValues(TRT_cid2,"Message_Display",				TRT_ATT_TEXT,"Get_Entry_Error!!!",				NULL);		}	} while (ret>0);	strcpy(BufferSelectPath,Currentpath);	TRT_SetValues(TRT_cid2,"FoldSelect",		TRT_ATT_TEXT,BufferSelectPath,		NULL);	Ncs_Fsr_fclosedir(buf);	Ncs_Fsr_logout("root",0);	}/*F*//*************************************************************************** >AUTHOR        : Jiang**  FUNCTION NAME : FileReadTest** ** >DESCRIPTION: Example to Load directory into the HMI.**               **** ** >NOTES:	**         **         **   ** >PARAMETER: none** ** >RETURN VALUE: none ** ** >INCLUDES :  none** */EXPORT void FileReadTest(void){   		char filenamewithpath[20]="";	char fileselect[20]="";	char filecontextfuffer[MAXFILESIZE];		/*have problem here.*/	long itemid=0;	char itemtxt[15]="";	struct stat file_state;	int error;	char* point=NULL;							/*check the npg file.*/	int number=0;	int BreakpointPlace[20]={0};	int i=0;	int n=0;	int m=0;	char tempbuffer[4]="";	char tablename_my[20]="";	TRT_SetValues(TRT_cid2, "FileContext",       /* At first you shoud clear the old file context! */		TRT_ATT_TEXT,"",		NULL);	error=Ncs_Fsr_login("root", 0, 0, 0);	TRT_GetValues(TRT_cid2,"FoldSelect",

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -