Home AMX Forum NetLinx Studio
Options

xap dialer

Anybody can gimmi a few pointers on how to handle a xap dialerf system? as in syntax variables and so forth and dunno how to umm store pressed buttons until the call button is executed :(

Comments

  • dthorsondthorson Junior Member
    First you have to create a string from a keypad, then send it.
    Check out:
    cKEYPAD_ENTRY = ITOA(BUTTON.INPUT.CHANNEL - 100)
    the buttons on the keypad are 100-110
    so subtract 100 and assign that value to a keypad variable, then update the cPHONE_NUMBER. Then send the value to the touch panel in the dial button event.
    You can also delete and clear the phone number.
    DEFINE_CONSTANT
    // ATC Functions
    atcDEV_XAP800	= '#5'	//XAP 800
    atcDEV_XAP400	= '#7'	//XAP 400
    atcDEV_ID		= '0'
    atc0				=	100
    atc1				=	101
    atc2				=	102
    atc3				=	103
    atc4				=	104
    atc5				=	105
    atc6				=	106
    atc7				=	107
    atc8				=	108
    atc9				=	109
    atcSTAR			     =	110
    atcPOUND			=	111
    atcCALL_ANSWER		=	112
    atcHANG_UP			=	113
    atcFLASH			=	114
    atcCLEAR			=	115
    atcBACKSPACE		=	116
    atcANSWER			= 	118
    
    DEFINE_VARIABLE
    VOLATILE CHAR cXAP_RX[50]
    VOLATILE INTEGER iPHONE_OFF_HOOK
    VOLATILE CHAR cKEYPAD_ENTRY[1]
    VOLATILE CHAR cPHONE_NUMBER[255]
    
    DEVCHAN devATC_KEYPAD[] =
    {{vdvTPd,atc0},{vdvTPd,atc1},{vdvTPd,atc2},{vdvTPd,atc3},{vdvTPd,atc4},
     {vdvTPd,atc5},{vdvTPd,atc6},{vdvTPd,atc7},{vdvTPd,atc8},{vdvTPd,atc9},
     {vdvTPd,atcSTAR},{vdvTPd,atcPOUND}}
    
    
    
    BUTTON_EVENT[devATC_KEYPAD]
    {
    	PUSH:
    	{
    	  TO[vdvTPd,BUTTON.INPUT.CHANNEL]
    		IF(BUTTON.INPUT.CHANNEL = atcSTAR)
    		{
    			cKEYPAD_ENTRY = '*'
    		}
    		ELSE IF(BUTTON.INPUT.CHANNEL = atcPOUND)
    		{
    			cKEYPAD_ENTRY = '#'
    		}
    		ELSE
    		{
    			cKEYPAD_ENTRY = ITOA(BUTTON.INPUT.CHANNEL - 100)
    		}	
    		IF(iPHONE_OFF_HOOK = 1)
    		{
    			SEND_STRING dvXAP,"atcDEV_XAP400,atcDEV_ID,' DIAL 1 ',cKEYPAD_ENTRY,$0D"
    			cPHONE_NUMBER = "cPHONE_NUMBER,cKEYPAD_ENTRY"
    			SEND_COMMAND vdvTPa,"'TEXT11-',cPHONE_NUMBER"
    		}
    		ELSE
    		{
    			cPHONE_NUMBER = "cPHONE_NUMBER,cKEYPAD_ENTRY"
    			SEND_COMMAND vdvTPa,"'TEXT11-',cPHONE_NUMBER"
    		}
    	}
    }
    
    BUTTON_EVENT[vdvTPd,atcFLASH]	// Flash
    {
    	PUSH: 
    	{
    	  TO[vdvTPd,BUTTON.INPUT.CHANNEL]
    	  SEND_STRING dvXAP,"atcDEV_XAP400,atcDEV_ID,' HOOK 1',$0D"
    	}
    }
    
    BUTTON_EVENT[vdvTPd,atcCALL_ANSWER] // Call / Answer
    {
    	PUSH:
    	{
    		TO[vdvTPd,BUTTON.INPUT.CHANNEL]
    		IF(LENGTH_STRING(cPHONE_NUMBER) > 0)
    		{
    			SEND_STRING dvXAP,"atcDEV_XAP400,atcDEV_ID,' DIAL 1 ',cPHONE_NUMBER,$0D"
    		}
    		ELSE
    		{
    			SEND_STRING dvXAP,"atcDEV_XAP400,atcDEV_ID,' TE 1 1',$0D"
    		}
    	}
    }
    
    BUTTON_EVENT[vdvTPd,atcANSWER] // Answer
    {
    	PUSH:
    	{
    		TO[vdvTPd,BUTTON.INPUT.CHANNEL]
    		SEND_STRING dvXAP,"atcDEV_XAP400,atcDEV_ID,' TE 1 1',$0D"
    		SEND_COMMAND vdvTPa,'@PPF-Incoming Call'
    		IF(!iSYSTEM_POWER)
    		{
    		  CALL 'SYSTEM ON'		(* REV0 *)
    		  DO_PUSH(vdvTPa,14)	(* SELECT ATC MODE *)
    		}
    	}
    }
    BUTTON_EVENT[vdvTPd,atcCLEAR]	// Clear
    {
    	PUSH:
    	{
    		cPHONE_NUMBER = ''
    		cKEYPAD_ENTRY = ''
    		SEND_COMMAND vdvTPa,"'TEXT11-',cPHONE_NUMBER"
    	}
    }
    
    BUTTON_EVENT[vdvTPd,atcBACKSPACE]	// Backspace
    {
    	PUSH:
    	{
    		IF(LENGTH_STRING(cPHONE_NUMBER) > 0)
    		{
    			SET_LENGTH_STRING(cPHONE_NUMBER,(LENGTH_STRING(cPHONE_NUMBER) - 1))
    		}
    		SEND_COMMAND vdvTPa,"'TEXT11-',cPHONE_NUMBER"
    	}
    }
    BUTTON_EVENT[vdvTPd,atcHANG_UP]	// Hang Up
    {
    	PUSH:
    	{
    		TO[vdvTPd,BUTTON.INPUT.CHANNEL]
    		cPHONE_NUMBER = ''
    		cKEYPAD_ENTRY = ''
    		SEND_COMMAND vdvTPa,"'TEXT11-',cPHONE_NUMBER"	
    		SEND_STRING dvXAP,"atcDEV_XAP400,atcDEV_ID,' TE 1 0',$0D"
    	}
    }	
    
    
  • avi_daveavi_dave Junior Member
    much appreciate it boss, much appreciated :D
  • alanhalanh Junior Member
    Although the above code is for XAP units and for G4 panels, is there any reason for the phone number not to appear in the variable text box on a G5 panel, i have replaced the Text11 command with ^TXT-11,0 and when i put in a manual test string for a button event like SEND_COMMAND vdvTPa,"'^TXT-11,0, 123456'" it works and shows 123456 in the variable text box 11, but using the above code the CHAR cPHONE_NUMBER does not appear in the variable text box 11 but the code works and the unit dials and connects etc, what any i missing here any help greatly appreciated, i know it will be something simple, the code and variable text box both work on a TP4 touchscreens as i just copied and pasted previous working examples and changed the TEXT11- where ever it was used.


Sign In or Register to comment.