Main Page   File List   File Members  

SlipMootooth_GBI_Test_wht_c_nt.h

00001 // The full source file of GBI-Test.
00002 
00020 #include "white_interface.h"
00021 
00022 char * strcpy (char *to, const char *from); 
00023 
00024 int vccPrintPdxDebugInfo(const char *format, ...); 
00025 
00026 /* Global variables */
00040 /* no longer in service */
00041 int connected = 0;   
00042 
00048 /* buffer to store string from game device (upper layer) */
00049 char string_to_GBI[20]; 
00050 
00055 /* buffer to store string from GBI */
00056 char string_from_GBI[20]; 
00057 
00058 /* Init Function */
00065 void poin_entry_Init() {
00066 
00067     /* Send Start_GBI_Post(1) to GBI to start it's poin_entry_Run() function!*/
00068         Start_Run_Post(1); 
00069 
00070         /* to analysis output */
00071         if(Master_Value())
00072                 vccPrintPdxDebugInfo("%_START_ MASTER : GBI-Test ->Start_Run_Post(1) to GBI %_END_");
00073         else
00074                 vccPrintPdxDebugInfo("%_START_ SLAVE  : GBI-Test ->Start_Run_Post(1) to GBI %_END_");
00075 }
00076 
00077 /* Run Function */
00103 void poin_entry_Run() {
00104 
00105     /* If Set port is enabled (a Trigger sent from GBI) and the value is
00106         1, then the connection is formed, set connected = 1. The Set port should
00107         be enabled only once. */
00108         if(Set_Enabled()){
00109                 if(Set_Value()){    /*if Connection Formed, Set=1 */
00110                         connected = 1;
00111                 }
00112         }
00113 
00114         if(Input_Enabled()) {
00115                 /* only run if connected - if(connected) - removed*/
00116                 
00117                 /* When a string enters the Input port of GBI-Test, it will be
00118                   copied into the "string_from_GBI" buffer */
00119                 strcpy(string_from_GBI, Input_Value());
00120 
00121                 /* to analysis output window */
00122                 if(Master_Value())
00123                         vccPrintPdxDebugInfo("%_START_ Master : GBI-Test <-received [%s] from GBI %_END_", string_from_GBI);
00124                 else
00125                         vccPrintPdxDebugInfo("%_START_ Slave  : GBI-Test <-received [%s] from GBI %_END_", string_from_GBI);
00126                 
00127                 /* The string in buffer "string_from_GBI" would be posted via
00128                 the NET_Out port of GBI-Test to the upper layers(eg.game device). */
00129                 NET_Out_Post(string_from_GBI);
00130 
00131                 /* to analysis output window */
00132                 if(Master_Value())
00133                         vccPrintPdxDebugInfo("%_START_ Master : GBI-Test -Input_Enabled() ->send [%s] to NET_Out %_END_", string_to_GBI);
00134                 else    
00135                         vccPrintPdxDebugInfo("%_START_ Slave  : GBI-Test -Input_Enabled() ->send [%s] to NET_Out %_END_", string_to_GBI);
00136                 
00137         }
00138 
00139         if(NET_In_Enabled()) {
00140                 /* string enters GBI-Test via the NET_In port of GBI-Test from 
00141                 the     upper layer would be copied into the "string_to_GBI" buffer. */ 
00142                 strcpy(string_to_GBI, NET_In_Value());
00143         
00144                 /* the string in the "string_to_GBI" buffer is posted to the lower
00145                 layer (GBI) via the Output port. */
00146                 Output_Post(string_to_GBI);
00147         }
00148 }  
00149 

Generated on Sun May 19 19:05:21 2002 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002