?? c0ce410fa05f001d1289bbda6de18a35
字號:
** >INCLUDES:** */LOCAL long MainEventLoop (void){ long c; long blocking_flag = TRT_BLOCK; char continue_looping = TRUE; long errorcode = 0; while (continue_looping && !errorcode) { c = TRT_GetInput(NULL, /*must be NULL- */ /*we dont use synchronisation with symaphore*/ 0, /*must be NULL - */ /*we dont use synchronisation with symaphore*/ NULL,/*must be NULL -*/ /* we dont use communication to other Prozess*/ 0, /*must be NULL -*/ /*we dont use communication to other Prozess*/ &rec_data,
blocking_flag);/* Wait until an event does occur*/ /***************************************** ** CHECK RETURN CODES of Notifications ** ******************************************/ if (c == 0) { /* Process Tilcon Notification (rec_data) */ switch (rec_data.code) { case TRT_window: /* Handle Window notifications */ { /* if (strcmp(rec_data.window_ID, MAIN_WINDOW_ID) == 0)*/ if (rec_data.state == TRT_window_quit) { /* if 'X' close button hit on this window, end program */ continue_looping = FALSE; } break; } case TRT_button: /* Handle Button notifications */ /* we can call this funktion as callback. hier is just to test*/ if (strcmp(rec_data.ID,"Chan_Lang_Button") == 0) On_Chan_Lang_Button();
else if(strcmp(rec_data.ID,"B1_M004_DirectoryExpl")==0)
Dab_h_ListDir(); break;
case TRT_slider:
/* we can call this funktion also as callback.
hier is just to test*/ if (!strcmp(rec_data.ID,"Feedrate_Slider"))
Dab_h_ChangeFeedrate();
if (!strcmp(rec_data.ID,"Spindlerate_Slider"))
Dab_h_ChangeSpindlerate();
break;
/****************************************************************/
case TRT_tree:
/*
if (!strcmp(rec_data.ID, "DirectoryTree_ID1"))
{
Dab_h_ListDir();
}*/
if (!strcmp(rec_data.ID,"Test_tree"))
{ //FOCUS IS THE KEY.
if(rec_data.event==1){ /*event==1 means Enter input!*/
strcpy(FileFoldBuf,rec_data.txt);
ChangeChar(FileFoldBuf,'\\','/');
TRT_SetValues(TRT_cid2,"FoldSelect",
TRT_ATT_TEXT,FileFoldBuf,NULL);
/************************************/
Directory_Load();
Directory_Load();
TRT_SetValues(TRT_cid2, "Test_tree",
TRT_ATT_STATE,TRUE,
TRT_ATT_CURRENT_ITEM,0,
NULL);
TRT_SetValues(TRT_cid2, "FilesUnderFold",
TRT_ATT_STATE,TRUE,
TRT_ATT_CURRENT_ITEM,0,
NULL);
}
};
if (!strcmp(rec_data.ID,"VariableTree")){
if(rec_data.event==1)
{
Find_PermVariable(rec_data.txt);
}
}
break;
/****************************************************************/
case TRT_numberbox: /*Handle Numberbox notifications */
break;
case TRT_listbox:
if(!strcmp(rec_data.ID,"FilesUnderFold")){
if(rec_data.event==1){
strcpy(Currentfileselect,rec_data.txt);
/******************************************/
FileReadTest();
Dab_h_LoadNcProg();
}
};
break;
case TRT_combobox: /* Handle Combobox notifications */ break; case TRT_edit_text: /*Handle Edit text notifications */
if (strcmp(rec_data.ID, "Table2"))
{
Dab_h_ChangeToolData();
}
break;
break; default: break; } } else if (c == 1) /* call callback funktion */ { /* TRT_GetInput has already called a callback, so do nothing */ } else if (c == -1) { if (blocking_flag == TRT_BLOCK) /* Something has failed.*/ errorcode = -1; else {/*no message was received */ } } else if (c & TRT_CH_TRIGGER_BIT) /* i.e. if the sign bit is set */ { /* another process called the function TRT_ChTrigger() */ } else if (c > 1) /* indicates a TRT_ChSend */ { } else { /* invalid return code, Rec_Data will contain garbage and */ /* not a Tilcon notification, so could cause crash */ /* Possible memory is no good. */ } } /* end of main loop */
/* errorcode+=TRT_Exit (TRT_cid); */
return errorcode;} /* OF MainEventLoop *//*F*//*************************************************************************** >AUTHOR : AB** FUNCTIONNAME : Dab_h_GraStartup** ** >DESCRIPTION: This is the entry funktion of the graphic task .** Ther are tow defferent Entrys: ** an entry for windows variante and ** an other for BRC Target ** ** >NOTES: you can change the content of this function as necessary ** but dont change the name and the Call Parameter ** ** >PARAMETER:** ** >RETURN VALUE:** ** >INCLUDES:"dab_h_startgra.h"** */#ifdef CC_TRT_DOSEXPORT int Dab_h_GraStartup() /* WINDOWS Entry*/#else /*Vxworks Entry*/ EXPORT int Dab_h_GraStartup(PxrTask_t MyTask, PxrMbx_t MyMbx, PxrEvents_t MyEvents)#endif{ static long errorcode = 0; errorcode = InitializeApp(); /*Initialize Application */ ConnectGUItoNCS(); /*Connect to NCS */ /*Begin Test*/ Dab_h_GetAxisNmb_Req(); Dab_h_InitAxisinterface(); /* Get the axis Values */ Dab_h_GetAxisValues_Req(); /* Get the axis ende position Values */ Dab_h_GetAxisEndPosValues_Req(); /* Get the axis Restweg Values */ Dab_h_GetAxisRestwegValues_Req(); /* StartMechanism for get Wera Infos*/ Dab_h_activateWeraReports(); /* init maschine parameter*/ Dab_h_InitMacParainterface(); /* Async. & Event to get the feedoverride*/ Dab_h_GetFeedrate_Req(); Dab_h_GetSpindlerate_Req(); /* sample to get machsine parameter*/ Dab_h_TestGetParameter(); /* init to load whole file system */ // Init_load_ListDir(); /* get the aktive NC function */ Dab_h_GetAktNCFunc(); /* to get a tool data */ Dab_h_GetToollist(); Dab_h_GetZeroOffset_Req();
/* test to set a watchpoint */ /* Test Ende*/ if (!errorcode) { ChangeConnectSymbol(1); /* Change the connection symbol on GUI */ errorcode += MainEventLoop(); /* Process unti done */ } else {/* Traitment of Errors*/ /* Initialisation Problem*/ } errorcode += TRT_WindowDelete (TRT_cid, MAIN_WINDOW_ID );#ifdef HWDS_WINDOWS errorcode += TRT_WindowDelete (TRT_cid, MOP_WINDOW_ID ); #endif errorcode += TRT_Exit (TRT_cid); /* Close TRT_CID */ return(errorcode); /*lint -e715*/} /* OF Dab_h_GraStartup *//*lint +e715*//************************************************************************//******************** Callback functions ********************************//************************************************************************//* this functions will be called automatically by pressing the ** correspendent button on the GUI** The name of a callback funktion will be given on Tilcon GUI Editor, ** dont change*//*F*//*************************************************************************** >AUTHOR : AB** FUNCTION NAME : void Dab_OnGetCoord** ** >DESCRIPTION: Example about how to call a funktion as callback** to get the Axis values** ** >NOTES:** ** >PARAMETER: ** ** >RETURN VALUE:** ** >INCLUDES:** */EXPORT void On_Menu1_Button2(TRT_ReceiveData * Datat,void * ClientData_p){ Dab_h_LoadNcProg(); /*Dab_h_GetAxisValues_Req();*/ /*lint -e715*/} /* OF void Dab_OnGetCoord *//*lint +e715*//*F*/
/*
************************************************************************
** >AUTHOR : AB
** FUNCTION NAME : void On_SubNCTestMenu_Button2
**
** >DESCRIPTION: Example about how to call a funktion as callback
** to choose a Nc program
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE:
**
** >INCLUDES:
**
*/
EXPORT void On_SubNCTestMenu_Button2(TRT_ReceiveData * Datat,void * ClientData_p)
{
Dab_h_RunNcProg();
/*Dab_h_GetAxisValues_Req();*/
/*lint -e715*/
} /* OF void On_SubNCTestMenu_Button2 */
/*lint +e715*/
/*F*/
/*
************************************************************************
** >AUTHOR : AB
** FUNCTION NAME : void On_SubNCTestMenu_Button3
**
** >DESCRIPTION: Example about how to call a funktion as callback
** to clear exist NC Programm in channel
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE:
**
** >INCLUDES:
**
*/
EXPORT void On_SubNCTestMenu_Button3(TRT_ReceiveData * Datat,void * ClientData_p)
{
Dab_h_CLRNcProg();
/*Dab_h_GetAxisValues_Req();*/
/*lint -e715*/
} /* OF void On_SubNCTestMenu_Button3 */
/*lint +e715*/
/*F*//*************************************************************************** >AUTHOR : AB** FUNCTION NAME : void On_Menue1_Button3** ** >DESCRIPTION: Example about how to call a funktion as callback** to start the michanism to get the System Infos (WERA)** ** >NOTES:** ** >PARAMETER:** ** >RETURN VALUE:** ** >INCLUDES:** */EXPORT void On_Menue1_Button3(TRT_ReceiveData * Datat,void * ClientData_p){ Dab_h_activateWeraReports(); /*lint -e715*/} /* OF On_Menue1_Button3 *//*lint +e715*//*F*//*************************************************************************** >AUTHOR : AB** FUNCTION NAME : void On_Menue3_Button2** ** >DESCRIPTION: Example about how to call a funktion as callback** to delet all System Warnings Errors and Annoucements** ** >NOTES: the funktion name must be the same name given in the Tilcon ** Interface builder** ** >PARAMETER:** ** >RETURN VALUE: void** ** >INCLUDES: dab_h_callbacks.h** */EXPORT void On_Menue3_Button2(TRT_ReceiveData * Datat,void * ClientData_p){ Dab_h_DeleteErrors (); /*lint -e715*/} /* OF On_Menue3_Button2 *//*lint +e715*//*F*/
/*
************************************************************************
** >AUTHOR : AB
** FUNCTION NAME : void B1_M005_Save
**
** >DESCRIPTION: Example about how to call a funktion as callback
** to save a file to nc file system
**
** >NOTES: the save-file path and name are fixed at the moment.
** "usr/user/Rechteck.npg"
**
** >PARAMETER:
**
** >RETURN VALUE: void
**
** >INCLUDES: dab_h_callbacks.h
**
*/
EXPORT void B1_M005_Save(TRT_ReceiveData * Datat,void * ClientData_p)
{
dab_h_TestSaveFile();
/*lint -e715*/
} /* OF B1_M005_Save */
/*lint +e715*/
/*F*/
/*
************************************************************************
** >AUTHOR : AB
** FUNCTION NAME : void B0_M005_Open
**
** >DESCRIPTION: Example about how to call a funktion as callback
** to open a file in nc file system
**
** >NOTES: the file path and name are fixed at the moment
** "usr/user/Rechteck.npg"
**
** >PARAMETER:
**
** >RETURN VALUE: void
**
** >INCLUDES: dab_h_callbacks.h
**
*/
EXPORT void B0_M005_Open(TRT_ReceiveData * Datat,void * ClientData_p)
{
dab_h_TestOpenFile();
/*lint -e715*/
} /* OF B0_M005_Open */
/*lint +e715*/
/*F*/
/*
************************************************************************
** >AUTHOR : MY
** FUNCTION NAME : void B1_M008_SelContinueMode
**
** >DESCRIPTION: example that how to set continue mode
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE: void
**
** >INCLUDES: dab_h_callbacks.h
**
*/
EXPORT void B1_M008_SelContinueMode(TRT_ReceiveData * Datat,void * ClientData_p)
{
Dab_h_SelContinueMode();
/*lint -e715*/
} /* OF B0_M005_Open */
/*lint +e715*/
/*F*/
/*
************************************************************************
** >AUTHOR : MY
** FUNCTION NAME : void B2_M008_SelDebugSTEPMode
**
** >DESCRIPTION: example that how to set step debug mode
**
** >NOTES: the file path and name are fixed at the moment
** "usr/user/Rechteck.npg"
**
** >PARAMETER:
**
** >RETURN VALUE: void
**
** >INCLUDES: dab_h_callbacks.h
**
*/
EXPORT void B2_M008_SelDebugSTEPMode(TRT_ReceiveData * Datat,void * ClientData_p)
{
Dab_h_SelDebugSTEPMode();
/*lint -e715*/
} /* OF B0_M005_Open */
/*lint +e715*/
/*F*/
/*
************************************************************************
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -