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

📄 b00d8403b85f001d1289bbda6de18a35

📁 Vxworks环境下
💻
📖 第 1 页 / 共 3 页
字号:
		TRT_ATT_TEXT,filenamewithpath,		NULL);                                    /* you can get file path here*/	                                       		strcat(filenamewithpath,"/");		strcat(filenamewithpath,Currentfileselect); /* to get the filename*/ 			Delete_RepetCharacter(filenamewithpath,'/');				error=strcpy(CurrentFileWantToRun,filenamewithpath);		error=Ncs_Fsr_stat(filenamewithpath,&file_state);		error=Ncs_Fsr_read(Ncs_Fsr_open(filenamewithpath,O_RDONLY,0),						   filecontextfuffer,						   file_state.st_size+10); /*To ensure we have read the file complately.*/                                     					TRT_SetValues(TRT_cid2, "FileContext",     /*Send the file context to the Tilcon.*/			TRT_ATT_TEXT,filecontextfuffer,			NULL);				TRT_SetValues(TRT_cid2, "Message_Display",			TRT_ATT_TEXT,"Load file to CPL Successfully!",			NULL);			TRT_SetValues(TRT_cid2, "CurrentProg",     /*Show the program name and path*/			TRT_ATT_TEXT,CurrentFileWantToRun,			NULL);			error=Ncs_Fsr_logout("root",0); }/*************************************************************************//***************************************************************************This function can help us to get correct file path. **For example "\usr\user"--->"/usr/user"*/void ChangeChar(char *Setence,char oldchar, char newchar)   {   	char* p= Setence;   	while(*p !='\0')   	{   		if(*p == oldchar)   			*p = newchar;   		p++;   	}   	}/***************************************************************************This function can help us to find CPL variable from the variavle tree.***/void Find_PermVariable(char* source){   char* Hold=source;   char* p;   char* q;   q=Hold;   while(*q!=0) q++;   p=q;   while(*p!='@')p--;   TRT_SetValues(TRT_cid2, "WatchSelect",		TRT_ATT_TEXT,p,		NULL);                             }/*F*//*************************************************************************** >AUTHOR        : AB**  FUNCTIONNAME  : ChangeConnectSymbol** ** >DESCRIPTION: this funktion is  an example function for Display and hid**                the connect Symbol on the Window** ** >NOTES:** ** >PARAMETER:   status =1 -> connected to target**                     =0 -> Disconnected** ** >RETURN VALUE:** ** >INCLUDES:** */LOCAL void ChangeConnectSymbol(char status){  long Error=0;  if (status ==1)  {    /* Hide the disconnected symbol */    Error=TRT_Hide(TRT_cid, DISCONNEC_SYMBOL_ICON_ID);    /* Display the connected symbol*/    Error+=TRT_Display(TRT_cid, CONNEC_SYMBOL_ICON_ID);   }  else if(status==0)  { /* Hide the connect symbol */    Error=TRT_Hide(TRT_cid, CONNEC_SYMBOL_ICON_ID);     /* Display the disconnect symbol*/    Error+=TRT_Display(TRT_cid, DISCONNEC_SYMBOL_ICON_ID);  }  if(Error)  {/*Traitment of Error*/  }}  /* OF ChangeConnectSymbol *//*F*//*************************************************************************** >AUTHOR        : AB**  FUNCTIONNAME  : ConnectGUItoNCS** ** >DESCRIPTION: Connect the GUI task to NCS** ** >NOTES: there is a deference in the call of NC_OPEN()**	   between the PC variante and the BRC Target variante. ** ** >PARAMETER:** ** >RETURN VALUE: No one** ** >INCLUDES:** */LOCAL void ConnectGUItoNCS(void){  Ncs_Mbx_t HMI_EventHandlerMailbox;/* MailBox for receive ncs Responce*/#ifdef HWDS_WINDOWS  HWND    hWnd = (HWND) NULL;#endif  /* get the ID of the mail box of the event handler mailbox created     from event handler task*/    dab_h_GetEvHanMailbox(&HMI_EventHandlerMailbox);  #ifdef HWDS_WINDOWS  /* for PC variante the hwnd is the ID of the Mailbox  */  hWnd = (HWND) HMI_EventHandlerMailbox;  /* Register the GUI-Task by NCS   */  /* for synchron and asynchron Requests */  /*the response of synchron requests will be Processed in this Task*/  /*the response of asynchron requests will be*/   /*  Processed in Event Handler Task*/  if (Ncs_Open(               NCS_SYNC_LENT_C,/*synchronous and asynchronous requests */               /* For asynchronous requests, a socket that has */               /* already be created for asynchronous requests.*/               /* we use this parameter because an Ncs_open with*/               /* NCS_SYNC_ASYNC_C */               /*is already occurred in evant handler Task.*/               "10.110.241.86",  /* IP Adresse of the Target.*/                                 /*change as necessary*/               hWnd,             /* Windo handle of the calling program*/               WM_ASYNC_READ,    /* Message that is sent to the*/                                  /*hWnd window in*/                /*the case of an asynchronous response.*/                /* The MessageNumber must be higher than*/               /* WM_USER + 0x100*/               /* we use  #define WM_ASYNC_READ (WM_USER+0x101);*/               5)   /*Time in seconds after which a timeout shall */      /*occur for a */      /*synchronous call. 0 disables the timeout.*/      != Ncs_ErrOk)    {    /* Error Traitement */     Ncs_WeaSetCritSysErr(0,"");  }#else                /* GUI is running on Target */                     /*the NCS_Open will be called as below*/  if (Ncs_Open(               NCS_SYNC_LENT_C,                &HMI_EventHandlerMailbox,               TRUE,   /*ResourceWaitMode:what to do if the Sendepuffer*/               /* is occupied bei belegten Sendepuffern.*/               /*    TRUE -> wait of free Sendebuffer*/               /*    FALSE-> dont wait,beack off with Error*/               0)     /*Time in seconds after which a */                      /*timeout shall occur for a */      /*synchronous call. 0 disables the timeout.*/      != Ncs_ErrOk)  {    /* Error Traitement */     Ncs_WeaSetCritSysErr(0,"");  }#endif}  /* OF ConnectGUItoNCS *//*F*//*************************************************************************** >AUTHOR        : AB**  FUNCTIONNAME  : Dab_h_WaitForEngineStart** ** >DESCRIPTION: the event handler task will try to open a channel to **              Tilcon EVE but for a communication with Tilcon EVE the EVE**             mus be started first.this function synchronise the start. ** ** >NOTES: this function will be called from event handler task **           in module dab_h_evhan.c** ** >PARAMETER: void** ** >RETURN VALUE: void ** ** >INCLUDES: "ab_h_startgra.h"** */EXPORT void Dab_h_WaitForEngineStart(void){  boolean WaitingForEngine= TRUE;  while (WaitingForEngine == TRUE)  {    if(EngineStatus == 0)    {      Dab_h_Delay(500);/*Wait*/      WaitingForEngine = TRUE;    }    else    {      WaitingForEngine = FALSE;    }  }}  /* OF Dab_h_WaitForEngineStart *//*F*//*************************************************************************** >AUTHOR        : AB**  FUNCTIONNAME  :  InitializeApp** ** >DESCRIPTION: Do everything that can be done before getting an event **               from outside.**               Start timers, clocks, etc.  Load/display primery windows.**               Update their objects.  Initialize data/structures.  **		 A local Tilcon EVE wil be launched.**		 we will open a channel to the EVE kernel (TRT_cid) and **               tell it to display the display the primery window **** ** >NOTES:       for more Information see the Tilcon Help** ** >PARAMETER: void** ** >RETURN VALUE: errorcode if an error is occurred else 0** ** >INCLUDES:** */LOCAL long InitializeApp(void){  long errorcode = 0;  TRT_FontRegister fontRegisterProps;  long taskMask;  short int TofElements = 4;  short int NofParameters = 1;  char      file_ext[5] = "";  short int Error = 0;    /* set tilcon environment */  putenv ("Tilcon=/ata0a/GUI_Demo");  TRT_StartData StartData; /* Strucktur of start data */  StartData.Os_Env  = OS_TYPE; /* Opereting system is seting at */  /*the beginning of this file */  StartData.Display	= NULL; /* we use 1 Display. muss be null */  StartData.IPAddr	= NULL;	/*IP addr if the Engine will be used in*/                                /* a remote mode.Hier is NULL  */  StartData.AppName	= "HermesHMI"; /* the name of this aplikation */  /*if you change it hier you have*/   /*to change it in*/   /*dab_h_evhan.c too*/  StartData.Userprog 	= "GUI_TASK";  /* a name of user Programe*/   /*can be changed too*/  StartData.Flags		= FALSE;   errorcode =TRT_StartEx (0, &StartData); /* Start the Tilcon EVE */  if(errorcode)  {/*Traitment of Error*/  }     EngineStatus=1;       /* Engine is started ->*/  /* set the syncronisation signal*/  TRT_cid = StartData.TRT_CID; /*get the channel ID  GUITask <-> EVE */  /* Intitial Fonts*/  taskMask = TRT_FONTREGISTER_MASK_SET|TRT_FONTREGISTER_MASK_FACENAME;  fontRegisterProps.fontType=35;  fontRegisterProps.fontStyle=0;  fontRegisterProps.nameStr="unifont";  TRT_RegisterFont(TRT_cid,taskMask,(void*)(&fontRegisterProps));	  /*Ennable Blink */  errorcode = TRT_BlinkOn(TRT_cid, 1, 10);/*10x50=500ms on and 500ms off*/  if(errorcode)  {/*Traitment of Error*/  }	  /*Load/display preliminary windows.*/  errorcode = TRT_WindowLoad(TRT_cid, MAIN_WINDOW_FILE);  if( errorcode)  {    /*Traitement of Error for example : Display Messagebox*/    return -1;  }#ifdef HWDS_WINDOWS   /*Load/display preliminary windows.*/  if( errorcode = TRT_WindowLoad(TRT_cid,"VPanel.twd") )  {    /*Traitement of Error for example : Display Messagebox*/    }#endif  /*Initialize Callbacks.*/  /*For mor Information and example about*/   /*how does the callback mechanismus work*/  /*please see the Tilcon Help*/  errorcode = TRT_WindowCallbacks(                                  TRT_cid,                                  MAIN_WINDOW_ID,                                  (char*)Callb_Struct_callback,                                   sizeof(Callb_Struct_callback));  if(errorcode)  {/*Traitment of Error*/  }	  if(TRT_WindowDisplay(TRT_cid, MAIN_WINDOW_ID) )  {    /*Traitement of Error*/     } #ifdef HWDS_WINDOWS   if(errorcode =TRT_WindowDisplay(TRT_cid, "VPanel_ID") )  {    /*Traitement of Error*/     }#endif  /*Display Auto run Panel on the Window*/  DisplayAutorun(MO_MAINT);  /*Initialise the System language*/  /* Get the extention of the Configured language  */  (void)Ncs_McaGetSingleBlock (601000010, file_ext, 5, &TofElements,			       &NofParameters, &Error);  if(!Error)  {    /*Command to initialise the Language*/    ChangeSysLanguage(file_ext);        }  return errorcode;}  /* OF  InitializeApp *//*F*//*************************************************************************** >AUTHOR        : AB**  FUNCTIONNAME  : MainEventLoop** ** >DESCRIPTION:stay in this loop until some event signals us to exit.  **              Check TRT_GetInput() to see if a Tilcon event occurred**              the event can be a notification from a button... **              If an event did occur, take appropriate  action. 	** ** >NOTES:  for more Information see the Tilcon Help** ** >PARAMETER: void** ** >RETURN VALUE: errorcode if an error is occurred else 0** ** >INCLUDES:** */LOCAL long MainEventLoop (void){  long			c;  long			blocking_flag	= TRT_BLOCK;  char			continue_looping = TRUE;  long			errorcode  = 0;

⌨️ 快捷键说明

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