/////////////////////////////////////////// // TU480A.MNU File // ////////////////////////////////////////// // Menu file for iSMART TFT module // Delayed wake up time is determined by the server on the network // LIB(button, "SDHC/button1.bmp?back=\\ffffff"); LIB(dem, "SDHC/home3.bmp"); LIB(nump, "SDHC/keypadap.bmp?back=\\ff0000"); LIB(helpb, "SDHC/helpbut2.bmp?back=\\ff0000"); LIB(grnsw, "SDHC/greenn.bmp"); LIB(ledgrn, "SDHC/greenle.bmp"); LIB(ledred, "SDHC/redledd.bmp"); LIB(keyb, "SDHC/keyic.bmp?back=\\ffff00"); LIB(keyb2, "SDHC/keyic2.bmp?back=\\ffff00"); LIB(langs, "SDHC/langsel.bmp?back=\\000000"); LIB(asc16b, "SDHC/asc_16b.fnt"); LIB(libkeys, "SDHC/Keys2.bmp"); //load the button keys LIB(libucase, "SDHC/ucase.bmp?back=\\ffffff"); //load the upper case keys LIB(liblcase, "SDHC/lcase.bmp?back=\\ffffff"); //load the lower case keys INC("SDHC/Var_Sty.mnu"); INC("SDHC/Func.mnu"); INC("SDHC/Chat.mnu"); INC("SDHC/Lang.mnu"); SETUP(system) { touchsamples=5; touchaccuracy=50; touchdebounce=5; //test=showTouchAreas; } SETUP(AS1) { baud = 115200; parity = none; data = 8; stop = 1; flow = N; rxi = Y; proc = ALL; encode = sd; txi = Y; } //Start up set up LOAD(keyinp,"\\04",ipdata); LOAD(keyinpa,"\\04",ipdataa); LOAD(keyinpb,"\\04",ipdatab); LOAD(keyinpc,"\\04",ipdatac); LOAD(AS1, "AT@C\\0D"); /////////////////////////////////////////////////////////// //Main Console Page PAGE(menupad, keypPage) //main menu/console { POSN(352,104); KEY(setipkey, [RUN(thisipfnc);], 70,60, TOUCH); //place the touch area to set the ip on "this module" POSN(368,46); TEXT (thisip,ipdata,Normtext3); //creates a text entity to show the local ip entered by user POSN(432,104); KEY(setportkey, [RUN(thisprtfnc);], 70,60, TOUCH); //place the touch area to set the port on "this module" POSN(368,74); TEXT (thisport,ipdataa,Normtext3); //creates a text entity to show the local port entered by user POSN(440,74); TEXT(thsporttxt,"Client",hostslvst); //Creates a text entity next to display the current mode of the module (smaller one top right) POSN(352,242); KEY(conipkey, [RUN(conipfnc);], 70,60, TOUCH); //place the touch area to set the ip on "connect to" POSN(368,184); TEXT (connip,ipdatab,Normtext3); //creates a text entity to show the destination ip entered by user POSN(432,242); KEY(conportkey, [RUN(conportfnc);], 70, 60, TOUCH); //place the touch area to set the port on "connect to" POSN(368,212); TEXT (connport,ipdatac,Normtext3); //creates a text entity to show the destination port entered by user POSN(440,212); TEXT(conporttxt,"Host",hostslvst); //Creates a text entity next to display the current mode of the module (smaller one bottom right) POSN(245,254); IMG(gswitch,grnsw,100,33, keypst); HIDE(gswitch); POSN(246,185); IMG(gled,ledgrn,100,100,keypst); HIDE(gled); POSN(245,205); KEY(greenled, [RUN(grnledfnc);],100,135,TOUCH); //creates another key for the LED switch to enable to go to the other state KEY(redled, [RUN(redledfnc);],100,135,TOUCH); HIDE(redled); POSN(246,45); TEXT(Connnow3,"Connecting",nowconn); //creates a text entity in the status indicator TEXT(Connnow2,"Connected",nowconn); //creates a text entity in the status indicator TEXT(Connnow,"Client Mode",nowconn); //creates a text entity in the status indicator HIDE(Connnow2,Connnow3); POSN(246,74); IMG(butcon,button,100,50,keypst); //Creates the connect button image HIDE(butcon); POSN(245,72); TEXT(conmes,"Connect",context); POSN(245,65); KEY(conbut, [RUN(fnctcp);],130,40,TOUCH); //Creates key for the connect button HIDE(conmes,conbut); POSN(223,100); TEXT(hosttext,"Mode", context); //Creates the text Mode to toggle between Host and Client mode POSN(222,107); KEY(hosttoggle,[RUN(hosttogglefnc);], 80,40,TOUCH); //Creates the key to perform functions whether its in Host or Client mode POSN(283,101); IMG(qwert,keyb,33,33,keypst); IMG(qwert2,keyb2,33,33,keypst); POSN(285,107); KEY(callkeys, [LOAD(KeyData2,"iS@C\\0D");RUN(chatmodefnc);], 45,40,TOUCH); //Creates the keyboard button and a key to perform functions HIDE(qwert2,callkeys); //These places text entities in the instruction box POSN(15,20); TEXT(inst1, lnptr1,testtext); //1st row POSN(15,+15); TEXT(inst2, lnptr2, insttext); //2nd row POSN(15,+15); TEXT(inst3, lnptr3, insttext); //3rd row POSN(15,+15); TEXT(inst4, lnptr4, insttext); //4th row POSN(15,+15); TEXT(inst5, lnptr5, insttext); //5th row POSN(15,+15); TEXT(inst6, lnptr6, insttext); //6th row POSN(15,+15); TEXT(inst7, lnptr7, insttext); //7th row POSN(15,+15); TEXT(inst8, lnptr8, insttext); //8th row POSN(15,+15); TEXT(inst9, lnptr9, insttext); //9th row POSN(15,+15); TEXT(inst10, lnptr10, insttext); //10th row POSN(15,+15); TEXT(inst11, lnptr11, insttext); //11th row POSN(15,+15); TEXT(inst12, lnptr12, insttext); //12th row POSN(15,+15); TEXT(inst13, lnptr13, insttext); //13th row POSN(24,233); IMG(gs,langs,keypst); POSN(26,234); KEY(german, [LOAD(lang,3);RUN(LangC);RUN(LangSel);],33,40,TOUCH); //creates a touch area to display instruction to German POSN(59,233); IMG(ss,langs,keypst); POSN(60,234); KEY(spanish,[LOAD(lang,2);RUN(LangC);RUN(LangSel);],33,40,TOUCH); //creates a touch area to display instruction to Spanish POSN(93,233); IMG(fs,langs,keypst); POSN(94,234); KEY(french, [LOAD(lang,1);RUN(LangC);RUN(LangSel);],33,40,TOUCH); //creates a touch area to display instruction to French POSN(127,233); IMG(is,langs,keypst); POSN(128,234);KEY(italian,[LOAD(lang,4);RUN(LangC);RUN(LangSel);],33,40,TOUCH); //creates a touch area to display instruction to Italian POSN(161,233); IMG(es,langs,keypst); POSN(162,234);KEY(english,[LOAD(lang,0);RUN(LangC);RUN(LangSel);],33,40,TOUCH); //creates a touch area to display instruction to English RUN(LangSel); LOOP(switchconnloop,forever) //loop to analyse string of characters received via AS1 and perform actions based on switch status { IF(switch=1?redfunc); //for the led toggle IF(switch=2?greenfunc); //for the led toggle IF(hostsw=1?[RUN(fnchostyes);RUN(fncindi);]); //for the Host/Client Mode button IF(hostsw=0?[RUN(fnchostno);RUN(fncindi2);]); //for the Host/Client Mode button IF(conval=0?[RUN(TTConec);]); //anaylses if connection has been established IF(RcvBuf="iS@K\\0D"?[SHOW(keys);LOAD(AS1.proc,"CR");]); //analyses if the keyboard should be shown IF(RcvBuf="iS@G\\0D"?[LOAD(switch,2);SHOW(gled);]); //analyses if the led should be changed to green IF(RcvBuf="iS@R\\0D"?[LOAD(switch,1);HIDE(gled);]); //analyses if the led should be changed to red } } /////////////////////////////////////////////////////////// //IP address and port setup pages PAGE(SetIP, keypPage) //set the contents of the set ip page on "this module" { POSN(310,136); IMG(numpad,nump,184,272,keypst); //place the numpad image POSN(138,76); IMG(helpbox,helpb,184,272,keypst); //place the obtain ip box/image POSN(71,66); TEXT(ipdisplaytxt,KeyData3,Normtext2); //creates a text entity placed in the obtain ip box POSN(137,124); KEY(obtainipk,[LOAD(AS1,"ATI6\\0D");SHOW(ipdisplaytxt);],150,80,TOUCH); //creates a key/touch area to obatin local ip address POSN(134,120); TEXT(obtaintx,"Obtain IP", context); //creates a text on the obtain ip button POSN(240, 30); TEXT (ipline, keyinp, Normtext2); //creates a text entity to dispaly the user's input //creates keys for the numbers,clear and the apply buttons POSN(252, 76); KEY(oKey, [LOAD(inkey,"1");], 50, 40, TOUCH ); //load 1 to inkey POSN(+58, +0); KEY(tKey, [LOAD(inkey,"2");], 50, 40, TOUCH ); //load 2 to inkey POSN(+58, +0); KEY(trKey, [LOAD(inkey,"3");], 50, 40, TOUCH ); //load 3 to inkey POSN(252, 116); KEY(fKey, [LOAD(inkey,"4");], 50, 40, TOUCH ); //load 4 to inkey POSN(+58, +0); KEY(fvKey, [LOAD(inkey,"5");], 50, 40, TOUCH ); //load 5 to inkey POSN(+58, +0); KEY(sxKey, [LOAD(inkey,"6");], 50, 40, TOUCH ); //load 6 to inkey POSN(252, 158); KEY(svkey, [LOAD(inkey,"7");], 50, 40, TOUCH ); //load 7 to inkey POSN(+58, +0); KEY(eKey, [LOAD(inkey,"8");], 50, 40, TOUCH ); //load 8 to inkey POSN(+58, +0); KEY(nKey, [LOAD(inkey,"9");], 50, 40, TOUCH ); //load 9 to inkey POSN(252, 202); KEY(clearKey, fncclearkey, 50, 40, TOUCH ); //creates a key to for the clear button POSN(+58, +0); KEY(zrKey, [LOAD(inkey,"0");], 50, 40, TOUCH ); //load 0 to inkey POSN(+58, +0); KEY(fsKey, [LOAD(inkey,".");], 50, 40, TOUCH ); //load . to inkey POSN(274, 242); KEY(entrKey, fncentrkey, 90, 30, TOUCH ); //creates a a key/touch area for the apply button POSN(355,242); KEY(clback,[SHOW(menupad);],60,40,TOUCH); //creates a a key/touch area for the exit button LOOP(inkeyloop,forever) //set up a loop for when a key has been pressed { IF(inkey<>"\\FF"?fncinkey);; //if the key value isn't(<>) blank/empty then add the character to the text } } PAGE(Setport, keypPage) //page is exactly the same only without the obtain ip box { POSN(307,136); IMG(numpada,nump,184,272,keypst); POSN(240, 30); TEXT (iplinea, keyinpa, Normtext2); POSN(249, 76); KEY(oKeya, [LOAD(inkeya,"1");], 50, 40, TOUCH ); POSN(+58, +0); KEY(tKeya, [LOAD(inkeya,"2");], 50, 40, TOUCH ); POSN(+58, +0); KEY(trKeya, [LOAD(inkeya,"3");], 50, 40, TOUCH ); POSN(249, 116); KEY(fKeya, [LOAD(inkeya,"4");], 50, 40, TOUCH ); POSN(+58, +0); KEY(fvKeya, [LOAD(inkeya,"5");], 50, 40, TOUCH ); POSN(+58, +0); KEY(sxKeya, [LOAD(inkeya,"6");], 50, 40, TOUCH ); POSN(249, 158); KEY(svkeya, [LOAD(inkeya,"7");], 50, 40, TOUCH ); POSN(+58, +0); KEY(eKeya, [LOAD(inkeya,"8");], 50, 40, TOUCH ); POSN(+58, +0); KEY(nKeya, [LOAD(inkeya,"9");], 50, 40, TOUCH ); POSN(249, 202); KEY(clearKeya, fncclearkeya, 50, 40, TOUCH ); POSN(+58, +0); KEY(zrKeya, [LOAD(inkeya,"0");], 50, 40, TOUCH ); POSN(+58, +0); KEY(fsKeya, [LOAD(inkeya,".");], 50, 40, TOUCH ); POSN(273, 242); KEY(entrKeya, fnchost, 90, 30, TOUCH ); POSN(355,242); KEY(clback,[SHOW(menupad);],60,30,TOUCH); LOOP(inkeyloopa,forever) //set up a loop for when a key has been pressed { IF(inkeya<>"\\FF"?fncinkeya);; //if the key value isn't(<>) blank/empty then add the character to the text } } PAGE(ConIP, keypPage) //similar to set ip page { POSN(307,136); IMG(numpad,nump,184,272,keypst); POSN(240, 30); TEXT (iplineb, keyinpb, Normtext2); POSN(249, 76); KEY(oKeyb, [LOAD(inkeyb,"1");], 50, 40, TOUCH ); POSN(+58, +0); KEY(tKeyb, [LOAD(inkeyb,"2");], 50, 40, TOUCH ); POSN(+58, +0); KEY(trKeyb, [LOAD(inkeyb,"3");], 50, 40, TOUCH ); POSN(249, 116); KEY(fKeyb, [LOAD(inkeyb,"4");], 50, 40, TOUCH ); POSN(+58, +0); KEY(fvKeyb, [LOAD(inkeyb,"5");], 50, 40, TOUCH ); POSN(+58, +0); KEY(sxKeyb, [LOAD(inkeyb,"6");], 50, 40, TOUCH ); POSN(249, 158); KEY(svkeyb, [LOAD(inkeyb,"7");], 50, 40, TOUCH ); POSN(+58, +0); KEY(eKeyb, [LOAD(inkeyb,"8");], 50, 40, TOUCH ); POSN(+58, +0); KEY(nKeyb, [LOAD(inkeyb,"9");], 50, 40, TOUCH ); POSN(249, 202); KEY(clearKeyb, fncclearkeyb, 50, 40, TOUCH ); POSN(+58, +0); KEY(zrKeyb, [LOAD(inkeyb,"0");], 50, 40, TOUCH ); POSN(+58, +0); KEY(fsKeyb, [LOAD(inkeyb,".");], 50, 40, TOUCH ); POSN(273, 242); KEY(entrKeyb, fncentrkeyb, 90, 30, TOUCH ); POSN(355,242); KEY(clback,[SHOW(menupad);],60,30,TOUCH); LOOP(inkeyloopb,forever) //set up a loop for when a key has been pressed { IF(inkeyb<>"\\FF"?fncinkeyb);; //if the key value isn't(<>) blank/empty then add the character to the text } } PAGE(Conport, keypPage) //similar to set ip page { POSN(307,136); IMG(numpad,nump,184,272,keypst); POSN(240, 30); TEXT (iplinec, keyinpc, Normtext2); POSN(249, 76); KEY(oKeycc, [LOAD(inkeyc,"1");], 50, 40, TOUCH ); POSN(+58, +0); KEY(tKeyc, [LOAD(inkeyc,"2");], 50, 40, TOUCH ); POSN(+58, +0); KEY(trKeyc, [LOAD(inkeyc,"3");], 50, 40, TOUCH ); POSN(249, 116); KEY(fKeyc, [LOAD(inkeyc,"4");], 50, 40, TOUCH ); POSN(+58, +0); KEY(fvKeyc, [LOAD(inkeyc,"5");], 50, 40, TOUCH ); POSN(+58, +0); KEY(sxKeyc, [LOAD(inkeyc,"6");], 50, 40, TOUCH ); POSN(249, 158); KEY(svkeyc, [LOAD(inkeyc,"7");], 50, 40, TOUCH ); POSN(+58, +0); KEY(eKeyc, [LOAD(inkeyc,"8");], 50, 40, TOUCH ); POSN(+58, +0); KEY(nKeyc, [LOAD(inkeyc,"9");], 50, 40, TOUCH ); POSN(249, 202); KEY(clearKeyc, fncclearkeyc, 50, 40, TOUCH ); POSN(+58, +0); KEY(zrKeyc, [LOAD(inkeyc,"0");], 50, 40, TOUCH ); POSN(+58, +0); KEY(fsKeyc, [LOAD(inkeyc,".");], 50, 40, TOUCH ); POSN(273, 242); KEY(entrKeyc, fncentrkeyc, 90, 30, TOUCH ); POSN(355,242); KEY(clback,[SHOW(menupad);],60,30,TOUCH); LOOP(inkeyloopc,forever) //set up a loop for when a key has been pressed { IF(inkeyc<>"\\FF"?fncinkeyc);; //if the key value isn't(<>) blank/empty then add the character to the text } } /////////////////////////////////////////////////////////// INT(int, AS1RXC, func1); //triggers the interrupt on the AS1 port IF(hostst=1?[LOAD(hostsw,1);]); IF(hostst=0?[LOAD(hostsw,0);]); SHOW(menupad); /////////////////////////////////////////// // VAR + Styles // ////////////////////////////////////////// /////////////////////////////////////////////////////////// //All Styles STYLE(keypst, IMAGE) {curRel = CC;} STYLE(keypPage, PAGE){image= dem;} STYLE(context, TEXT){font="asc16b"; col=white; maxLen=32; maxRows=1; curRel=CC;} STYLE(Normtext2, TEXT){font="asc16b"; col=black; maxLen=64; maxRows=1; curRel=CL;} STYLE(Normtext3, TEXT){font=Ascii8; col=blue; maxLen=15; maxRows=1; curRel=CL;} STYLE(insttext, TEXT){font=Ascii8; col=white; maxLen=30; maxRows=2; curRel=CL;} STYLE(testtext, TEXT){font="asc16b"; col=white; maxLen=30; maxRows=2; curRel=CL;} STYLE(nowconn, TEXT){font="asc16b"; col=black; maxLen=30; maxRows=2; curRel=CC;} STYLE(hostslvst, TEXT){font=Ascii8; col=blue; maxLen=30; maxRows=2; curRel=CC;} STYLE(stPage, Page){image=libkeys;} //create a page style for the main page and set background image to libkeys STYLE(BlueText32, Text){font="asc16b"; col=blue; maxLen=17; maxRows=1; curRel=CL;} /////////////////////////////////////////////////////////// //Main Page Variables VAR(switch,1,U8); VAR(hostsw,0,U8E); VAR(hostst,0,U8E); VAR(conval,0,U8); VAR(RcvBuf, "", TXT); VAR(txthold, "\\0D",TXTE); VAR(inkey,"\\FF",TXT); VAR(keyinp, "", TXT); VAR(ipdata, "", TXTE); VAR(inkeya,"\\FF",TXT); VAR(keyinpa, "", TXT); VAR(ipdataa, "", TXTE); VAR(inkeyb,"\\FF",TXT); VAR(keyinpb, "", TXT); VAR(ipdatab, "", TXTE); VAR(inkeyc,"\\FF",TXT); VAR(keyinpc, "", TXT); VAR(ipdatac, "", TXTE); /////////////////////////////////////////////////////////// VAR(KeyData3, "", TXT); /////////////////////////////////////////////////////////// //Chat Mode variables VAR(TextData, "", TXT); //create a text variable to hold the resultant text VAR(KeyData, "", TXT); VAR(KeyData2, "", TXT); //create a text variable to hold the current character input by the user VAR(Cap, 0, U8); //create an unsigned 8 bit variable to define the state of the CAP (Caps lock) key VAR(Shift, 0, U8); //create an unsigned 8 bit variable to define the state of the Shift key VAR(InsK, 0, U8); //create an unsigned 8 bit variable to define the state of the INS(Insert) key VAR(enkey,"\\FF",TXT); //create a text variable to store the character pressed, with a starting value of hex \\FF VAR(backpad, 0, U8); /////////////////////////////////////////////////////////// /////////////////////////////////////////// // Functions // ////////////////////////////////////////// /////////////////////////////////////////////////////////// //Chat Functions FUNC(fncenkey) //store the character and increment the cursor for the next character { CALC(KeyData,KeyData,enkey,"INS"); //add character at cursor when the key is pressed and increment cursor TEXT(TextLine,KeyData); //store the new character to the variable Keydata and display it on the screen LOAD(enkey,"\\FF"); //restore the default value of the variable that holds entered character by the user IF(Shift=1?[RUN(fncshiftkey);LOAD(Shift,0);]);; //if the "shift" key has been pressed then run the fncshiftkey function once then set the variable Shift value to 0 again } FUNC(fncshiftkey) { IF(Cap=0? [HIDE(uc); SHOW(lc);LOAD(Cap,1);]:[SHOW(uc); HIDE(lc); LOAD(Cap,0);]);; //if the "shift" key hasn't been pressed (Cap=0) then hide the image uc and show lc, else(:) do the opposite } FUNC(fncbskey) { CALC(KeyData,KeyData,-1,"DEL"); //if the "backspace" key has been pressed delete one character to the left and move the cursor by one to the left TEXT(TextLine,KeyData);; //load the new KeyData value to TextLine which displays it to the screen } FUNC(fncdelkey) { CALC(KeyData,KeyData,1,"DEL"); //if the "delete" key has been pressed delete one character to the right TEXT(TextLine,KeyData);; //load the new KeyData value to TextLine which displays it to the screen } FUNC(fnccapkey) { IF(Cap=0? [HIDE(uc); SHOW(lc); LOAD(Cap,1);]:[SHOW(uc); HIDE(lc); LOAD(Cap,0);]);; //if the "caps lock" key hasn't been pressed (Cap=0) then hide the image uc and show lc, else(:) do the opposite } FUNC(fncleftkey) { CALC(KeyData,KeyData,-1,"REL"); //move the cursor by one to the left TEXT(TextLine,KeyData);; //load the new value of KeyData to TextLine } FUNC(fncrightkey) { CALC(KeyData,KeyData,+1,"REL"); //move the cursor by one to the right TEXT(TextLine,KeyData);; //load the new value of KeyData to TextLine } FUNC(fncinskey) //this function is called when the insert key has been pressed { IF(InsK=0? [LOAD(InsK,1);CALC(KeyData,KeyData,"\\07","CUR");]:[LOAD(InsK,0);CALC(KeyData,KeyData,"\\04","CUR");]); //if the insert key is set to 0 change cursor type and set insK to 1, else(:) do the opposite TEXT(TextLine,KeyData);; //load the new value of KeyData to TextLine } /////////////////////////////////////////////////////////// FUNC(func1) //function for the interrupt { LOAD(RcvBuf, AS1); LOAD(KeyData2, RcvBuf); LOAD(KeyData3, RcvBuf); TEXT(RcvMessages,KeyData2); TEXT(ipdisplaytxt,KeyData3);; } FUNC(fncentkey) //function to call when the apply key and enter key are pressed on the keyboard { LOAD(TextData,KeyData,"\\0D"); CALC(TextData,TextData,"\\02\\03\\04\\05\\06\\07","REM"); LOAD(AS1,TextData ); LOAD(KeyData,""); TEXT(TextLine, "");; } /////////////////////////////////////////////////////////// //Connection Functions FUNC(TTConec) //Function to estabilsh connection { IF(RcvBuf="iS@C\\0D"?[RUN(constartup);]); IF(conval=1?[LOAD(AS1,"iS@C\\0D");LOAD(conval,2);]); } FUNC(constartup) //Function to call once the connection has been established { WAIT(2000); SHOW(Connnow2); HIDE(Connnow,Connnow3,conmes,conbut,butcon,hosttoggle); HIDE(ipdisplaytxt,helpbox,obtainipk,obtaintx); LOAD(conval,1); LOAD(hostsw,2); SHOW(qwert2,callkeys); } FUNC(fnctcp) //this function is called when the connect button is pressed { LOAD(txthold,"ATD",ipdatab,",",ipdatac,",T,",ipdataa); LOAD(AS1,txthold); RUN(fncentkey); HIDE(Connnow); SHOW(Connnow3); WAIT(1000); LOAD(AS1,"iS@C\\0D"); //Received Data } /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// //Opens Chat mode on both modules FUNC(chatmodefnc) //this functon is called when the Keyboard button is pressed { HIDE(RcvMessages); SHOW(keys); LOAD(RcvBuf,""); //clears the AS1 buffer IF(RcvBuf="iS@C\\0D"?[LOAD(AS1.proc,"CR");]); //Received Data12 LOAD(AS1,"iS@K\\0D"); //Received Data LOAD(RcvBuf,"iS@K\\0D"); LOAD(KeyData,""); TEXT(TextLine, KeyData);; } /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// //Host or Client Status FUNC(fnchostno) //function to be called if module is in client mode { LOAD(AS1,"AT@L",ipdataa,"\\0D"); //puts the module/ethernet port to listen mode RUN(fncentkey); } FUNC(fnchostyes) //function to be called if module is in host mode { LOAD(ipdataa,ipdataa); } FUNC(hosttogglefnc) //function to call to display the appropriate status and call correct function { IF(hostsw=0?[RUN(imhostfnc);]:[RUN(imclientfnc);]); LOAD(AS1,"AT@C\\0D"); //clears the port from listen mode } FUNC(imhostfnc) //function to call in host mode { LOAD(hostsw,1); SHOW(Connnow); RUN(fnchostyes); HIDE(Connnow2,Connnow3); } FUNC(imclientfnc) //function to call in client mode { LOAD(hostsw,0); SHOW(Connnow); RUN(fnchostno); HIDE(Connnow2,Connnow3); } FUNC(fncindi) //this shows the appropriate status on the status indicator { LOAD(hostst,1); SHOW(conmes,conbut,butcon); TEXT(thsporttxt,"Host"); TEXT(conporttxt,"Client"); TEXT(Connnow,"Host Mode");; } FUNC(fncindi2) //this shows the appropriate status on the status indicator { LOAD(hostst,0); HIDE(conmes,conbut,butcon); TEXT(thsporttxt,"Client"); TEXT(conporttxt,"Host"); TEXT(Connnow,"Client Mode");; } /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// //LED indicator functions FUNC(greenfunc) //shows the green led when the switch is pressed { SHOW(gswitch,greenled); HIDE(redled);; } FUNC(redfunc) //shows the red led when the switch is pressed { HIDE(gswitch,greenled); SHOW(redled);; } FUNC(redledfnc) //displays the correct key and led { LOAD(switch,2); LOAD(AS1,"iS@G\\0D"); //loads the string to be analysed on the receiever SHOW(gled); LOAD(RcvBuf,""); } FUNC(grnledfnc) //displays the correct key and led { LOAD(switch,1); LOAD(AS1,"iS@R\\0D"); //loads the string to be analysed on the receiever HIDE(gled); LOAD(RcvBuf,""); } /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// //Show Pages to Set IP address and ports FUNC(thisipfnc) //function called when set ip on "this module" is pressed and the ip area { LOAD(AS1,"ATI6\\0D"); //Ensures that the IP address is shown when obtain ip button is pressed //LOAD(keyinp, ""); LOAD(keyinp,ipdata); TEXT(ipline, keyinp);; TEXT(ipdisplaytxt,KeyData2);; HIDE(ipdisplaytxt); SHOW(SetIP); } FUNC(thisprtfnc) //function called when the set port on "this module" is pressed and the port area { //LOAD(keyinpa, ""); LOAD(keyinpa,ipdataa); TEXT(iplinea, keyinpa);; SHOW(Setport); } FUNC(conipfnc) //function called when the set ip on "connect to" is pressed and the ip area { //LOAD(keyinpb, ""); LOAD(keyinpb,ipdatab); TEXT(iplineb, keyinpb);; SHOW(ConIP); } FUNC(conportfnc) //function called when the set port on "connect to" is pressed and the port area { //LOAD(keyinpc, ""); LOAD(keyinpc,ipdatac); TEXT(iplinec, keyinpc);; SHOW(Conport); } /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// //IP and port insert clear and enter functions FUNC(fncinkey) //store the character and increment the cursor for the next character { CALC(keyinp,keyinp,inkey,"INS"); //add character at cursor when the key is pressed and increment cursor TEXT(ipline,keyinp); //store the new character to the variable Keydata and display it on the screen LOAD(inkey,"\\FF"); //restore the default value of the variable that holds entered character by the user } FUNC(fncclearkey) { CALC(keyinp,keyinp,-1,"DEL"); //if the "backspace" key has been pressed delete one character to the left and move the cursor by one to the left TEXT(ipline,keyinp);; //load the new KeyData value to TextLine which displays it to the screen } FUNC(fncentrkey) //loads the correct AT command to set the ip of the module and clears the text box { LOAD(ipdata,keyinp,"\\0D"); CALC(ipdata,keyinp,"\\02\\03\\04\\05\\06\\07","REM"); LOAD(keyinp, ""); TEXT(ipline, keyinp);; TEXT(thisip,ipdata);; LOAD(AS1,"AT@IP=",ipdata); RUN(fncentkey); SHOW(menupad);; } FUNC(fncinkeya) //store the character and increment the cursor for the next character { CALC(keyinpa,keyinpa,inkeya,"INS"); //add character at cursor when the key is pressed and increment cursor TEXT(iplinea,keyinpa); //store the new character to the variable Keydata and display it on the screen LOAD(inkeya,"\\FF"); //restore the default value of the variable that holds entered character by the user } FUNC(fncclearkeya) { CALC(keyinpa,keyinpa,-1,"DEL"); //if the "backspace" key has been pressed delete one character to the left and move the cursor by one to the left TEXT(iplinea,keyinpa);; //load the new KeyData value to TextLine which displays it to the screen } FUNC(fnchost) { IF(hostsw=1?[RUN(fncentrkeya1);]:[RUN(fncentrkeya2);]); } FUNC(fncentrkeya1) //function called if module is in Host Mode { LOAD(ipdataa,keyinpa,"\\0D"); CALC(ipdataa,keyinpa,"\\02\\03\\04\\05\\06\\07","REM"); TEXT(iplinea, keyinpa);; LOAD(keyinpa, ""); TEXT(thisport,ipdataa);; RUN(fncentkey); SHOW(menupad);; } FUNC(fncentrkeya2) //function called if module is in client Mode as sets listen mode { LOAD(ipdataa,keyinpa,"\\0D"); CALC(ipdataa,keyinpa,"\\02\\03\\04\\05\\06\\07","REM"); TEXT(iplinea, keyinpa);; LOAD(keyinpa, ""); TEXT(thisport,ipdataa);; LOAD(AS1,"AT@L",ipdataa); RUN(fncentkey); SHOW(menupad);; } FUNC(fncinkeyb) //store the character and increment the cursor for the next character { CALC(keyinpb,keyinpb,inkeyb,"INS"); //add character at cursor when the key is pressed and increment cursor TEXT(iplineb,keyinpb); //store the new character to the variable Keydata and display it on the screen LOAD(inkeyb,"\\FF"); //restore the default value of the variable that holds entered character by the user } FUNC(fncclearkeyb) { CALC(keyinpb,keyinpb,-1,"DEL"); //if the "backspace" key has been pressed delete one character to the left and move the cursor by one to the left TEXT(iplineb,keyinpb);; //load the new KeyData value to TextLine which displays it to the screen } FUNC(fncentrkeyb) { LOAD(ipdatab,keyinpb,"\\0D"); CALC(ipdatab,keyinpb,"\\02\\03\\04\\05\\06\\07","REM"); LOAD(keyinpb, ""); TEXT(iplineb, keyinpb);; TEXT(connip,ipdatab); SHOW(menupad);; } FUNC(fncinkeyc) //store the character and increment the cursor for the next character { CALC(keyinpc,keyinpc,inkeyc,"INS"); //add character at cursor when the key is pressed and increment cursor TEXT(iplinec,keyinpc); //store the new character to the variable Keydata and display it on the screen LOAD(inkeyc,"\\FF"); //restore the default value of the variable that holds entered character by the user } FUNC(fncclearkeyc) { CALC(keyinpc,keyinpc,-1,"DEL"); //if the "backspace" key has been pressed delete one character to the left and move the cursor by one to the left TEXT(iplinec,keyinpc);; //load the new KeyData value to TextLine which displays it to the screen } FUNC(fncentrkeyc) { LOAD(ipdatac,keyinpc,"\\0D"); CALC(ipdatac,keyinpc,"\\02\\03\\04\\05\\06\\07","REM"); TEXT(iplinec, ""); LOAD(keyinpc, ""); TEXT(connport,ipdatac);; SHOW(menupad);; } /////////////////////////////////////////////////////////// /////////////////////////////////////////// // Language Select Page // ////////////////////////////////////////// VAR(lang,0,U8E); //1st row Text Variables VAR(ln10,"Network Demo",TXT); VAR(ln11,"Demo Reseau",TXT); VAR(ln12,"Demo de la red",TXT); VAR(ln13,"Netzwerk Demo",TXT); VAR(ln14,"Rete Demo",TXT); //2nd row Text Variables VAR(ln20,"Set mode to host/client.",TXT); VAR(ln21,"Reglez le mode host/client.",TXT); VAR(ln22,"Asignar el modo",TXT); VAR(ln23,"Set-Modus zu Host/Client.",TXT); VAR(ln24,"Impostare la modalita",TXT); //3rd row Text Variables VAR(ln30,"Set local IP and Port.", TXT); VAR(ln31,"Set IP locale et le port.", TXT); VAR(ln32,"de host/client.", TXT); VAR(ln33,"Set lokale IP und Port.", TXT); VAR(ln34,"di host/client.", TXT); //4th row Text Variables VAR(ln40,"Set destination IP and Port.", TXT); VAR(ln41,"Set IP de destination ", TXT); VAR(ln42,"Set IP local y el puerto.", TXT); VAR(ln43,"Set Ziel-IP-und Port.", TXT); VAR(ln44,"Impostare IP locale e Port.", TXT); //5th row Text Variables VAR(ln50,"Press Connect and wait", TXT); VAR(ln51,"et le port.", TXT); VAR(ln52,"Set IP de destino ", TXT); VAR(ln53,"Press Connect und warten", TXT); VAR(ln54,"Impostare IP di", TXT); //6th row Text Variables VAR(ln60,"until status indicator", TXT); VAR(ln61,"Appuyez sur Connecter et", TXT); VAR(ln62,"y el puerto.", TXT); VAR(ln63,"bis Statusanzeige", TXT); VAR(ln64,"destinazione e Port.", TXT); //7th row Text Variables VAR(ln70,"says \\22Connected\\22.", TXT); VAR(ln71,"attendre que l'indicateur", TXT); VAR(ln72,"Definir destino el puerto.", TXT); VAR(ln73,"sagt \\22Connected\\22.", TXT); VAR(ln74,"Porta di destinazione ", TXT); //8th row Text Variables VAR(ln80,"When status says", TXT); VAR(ln81,"d'etat dit \\22Connected\\22.", TXT); VAR(ln82,"Pulse Conectar y espere.", TXT); VAR(ln83,"Wenn der Status sagt", TXT); VAR(ln84,"impostata. Press Connect e", TXT); //9th row Text Variables VAR(ln90,"\\22Connected\\22, LED switch", TXT); VAR(ln91,"Lorsque le statut indique", TXT); VAR(ln92,"hasta que el indicador", TXT); VAR(ln93,"\\22Connected\\22, LED-Schalter", TXT); VAR(ln94,"attendere finché l'indicatore", TXT); //10th row Text Variables VAR(ln100,"and Keyboard is activated." , TXT); VAR(ln101,"\\22Connected\\22, Interrupteur a", TXT); VAR(ln102,"dice \\22Connected\\22. Cuando el", TXT); VAR(ln103,"und Keyboard aktiv ist.", TXT); VAR(ln104,"di stato dice \\22Connected\\22.", TXT); //11th row Text Variables VAR(ln110,"", TXT); VAR(ln111,"LED et de Keyboard", TXT); VAR(ln112,"estado dice \\22Connected\\22,", TXT); VAR(ln113,"", TXT); VAR(ln114,"Quando lo stato dice", TXT); //12th row Text Variables VAR(ln120,"", TXT); VAR(ln121,"est active.", TXT); VAR(ln122,"LED interruptor Keyboard en", TXT); VAR(ln123,"", TXT); VAR(ln124,"\\22Connected\\22,LED interruttore", TXT); //13th row Text Variables VAR(ln130,"", TXT); VAR(ln131,"", TXT); VAR(ln132,"vivo y se activa.", TXT); VAR(ln133,"", TXT); VAR(ln134,"e Keyboard e attiva.", TXT); //Pointer variables to for instructions in different languages VAR(lnptr1>"ln10",PTRE); VAR(lnptr2>"ln20",PTRE); VAR(lnptr3>"ln30",PTRE); VAR(lnptr4>"ln40",PTRE); VAR(lnptr5>"ln50",PTRE); VAR(lnptr6>"ln60",PTRE); VAR(lnptr7>"ln70",PTRE); VAR(lnptr8>"ln80",PTRE); VAR(lnptr9>"ln90",PTRE); VAR(lnptr10>"ln100",PTRE); VAR(lnptr11>"ln110",PTRE); VAR(lnptr12>"ln120",PTRE); VAR(lnptr13>"ln130",PTRE); //Function to be called for the instructions in different languages FUNC(LangC) { LOAD(lnptr1>"ln1",lang); LOAD(lnptr2>"ln2",lang); LOAD(lnptr3>"ln3",lang); LOAD(lnptr4>"ln4",lang); LOAD(lnptr5>"ln5",lang); LOAD(lnptr6>"ln6",lang); LOAD(lnptr7>"ln7",lang); LOAD(lnptr8>"ln8",lang); LOAD(lnptr9>"ln9",lang); LOAD(lnptr10>"ln10",lang); LOAD(lnptr11>"ln11",lang); LOAD(lnptr12>"ln12",lang); LOAD(lnptr13>"ln13",lang); TEXT(inst1,lnptr1); TEXT(inst2,lnptr2); TEXT(inst3,lnptr3); TEXT(inst4,lnptr4); TEXT(inst5,lnptr5); TEXT(inst6,lnptr6); TEXT(inst7,lnptr7); TEXT(inst8,lnptr8); TEXT(inst9,lnptr9); TEXT(inst10,lnptr10); TEXT(inst11,lnptr11); TEXT(inst12,lnptr12); TEXT(inst13,lnptr13);; } FUNC(LangSel) { IF(lang=0?[SHOW(es);HIDE(fs,ss,gs,is);]); IF(lang=1?[SHOW(fs);HIDE(es,ss,gs,is);]); IF(lang=2?[SHOW(ss);HIDE(es,fs,gs,is);]); IF(lang=3?[SHOW(gs);HIDE(es,fs,ss,is);]); IF(lang=4?[SHOW(is);HIDE(es,fs,ss,gs);]); }