TP String Parsing Module
ondrovic
Posts: 217
I am having a little trouble on where to go next on this module.
Here are the lines needed to make this work
The code uses the built in keypad and sends the variables to strKPResp fine but now what I am wanting to do is separate the strKPResp into 3 different variables so that I can use it with a satellite receiver.
Any help would be great
Thanks
MODULE_NAME='TP String Parsing Mod' ( DEV dv_SPM_TP, CHAR c_SPM_CurPg[], CHAR str_SPM_KPValue[], CHAR str_SPM_KBValue[] ) (***********************************************************) (* System Type : NetLinx *) (***********************************************************) (* REV HISTORY: *) (***********************************************************) (***********************************************************) (* DEVICE NUMBER DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_DEVICE (***********************************************************) (* CONSTANT DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_CONSTANT (***********************************************************) (* DATA TYPE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_TYPE (***********************************************************) (* VARIABLE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_VARIABLE CHAR str_SPM_TPBuffer[1000] CHAR str_SPM_TPResponse[100] CHAR str_SPM_Trash[100] INTEGER n_SPM_TPButton (***********************************************************) (* LATCHING DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_LATCHING (***********************************************************) (* MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_MUTUALLY_EXCLUSIVE (***********************************************************) (* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *) (***********************************************************) (* EXAMPLE: DEFINE_FUNCTION <RETURN_TYPE> <NAME> (<PARAMETERS>) *) (* EXAMPLE: DEFINE_CALL '<NAME>' (<PARAMETERS>) *) (***********************************************************) (* STARTUP CODE GOES BELOW *) (***********************************************************) DEFINE_START CREATE_BUFFER dv_SPM_TP,str_SPM_TPBuffer (***********************************************************) (* THE EVENTS GO BELOW *) (***********************************************************) DEFINE_EVENT DATA_EVENT[dv_SPM_TP] { STRING: { str_SPM_TPResponse = REMOVE_STRING(str_SPM_TPBuffer,str_SPM_TPBuffer,1) SELECT { ACTIVE(FIND_STRING(str_SPM_TPResponse,'PAGE-',1)): { str_SPM_Trash = REMOVE_STRING(str_SPM_TPResponse,'PAGE-',1) c_SPM_CurPg = REMOVE_STRING(str_SPM_TPResponse,str_SPM_TPResponse,1) } ACTIVE(FIND_STRING(str_SPM_TPResponse,'KEYP-',1)): { str_SPM_TRASH = REMOVE_STRING(str_SPM_TPResponse,'KEYP-',1) str_SPM_KPValue = REMOVE_STRING(str_SPM_TPResponse,str_SPM_TPResponse,1) } ACTIVE(FIND_STRING(str_SPM_TPResponse,'KEYB-',1)): { str_SPM_TRASH = REMOVE_STRING(str_SPM_TPResponse,'KEYB-',1) str_SPM_KBValue = REMOVE_STRING(str_SPM_TPResponse,str_SPM_TPResponse,1) } } } } (***********************************************************) (* THE ACTUAL PROGRAM GOES BELOW *) (***********************************************************) DEFINE_PROGRAM (***********************************************************) (* END OF PROGRAM *) (* DO NOT PUT ANY CODE BELOW THIS COMMENT *) (***********************************************************)
Here are the lines needed to make this work
Define_Device dvTP 128:1:0 Define_Variable CHAR strTPMd[25] CHAR strKPResp[10] CHAR strKBResp[25] CHAR strTPPg[25] Define_Start Define_Module 'TP String Parsing Mod' ModPrase (dvtp, strTPPg, strKPResp, strKBPResp)
The code uses the built in keypad and sends the variables to strKPResp fine but now what I am wanting to do is separate the strKPResp into 3 different variables so that I can use it with a satellite receiver.
Any help would be great
Thanks
0
Comments
you can use left_string, mid_string or right_string. Check their syntax, they work pretty well...
Thanks Yuri