Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ABSPOSAA

ABSPOSAA.m

Go to the documentation of this file.
  1. ABSPOSAA ; IHS/FCS/DRS - JWS, ; [ 09/12/2002 10:05 AM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
  1. Q
  1. ; $$CONNECT(DIALOUT) - initialize modem and dial
  1. ; Called from ABSPOSAQ from ABSPOSAM
  1. ; Various errors can be returned
  1. ; Future: put a field in the 9002313.55 record to put these
  1. ; stages as you progress through establishing the connection.
  1. ; Future: tap into that field when constructing display message
  1. ; for the data entry / status display screen.
  1. ; That is, show more than just "Waiting to transmit" - show
  1. ; it going through stages like "Initializing modem",
  1. ; "Dialing", "Waiting for remote connect", etc.
  1. ; And tack on "Failed while " in front, when something goes wrong.
  1. ;
  1. CONNECT(DIALOUT) ;EP -
  1. ; Open the device
  1. N RET
  1. S RET=$$OPEN^ABSPOSAB(DIALOUT)
  1. I RET Q 20999_",OPEN^ABSPOSAB(),"_RET
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",0"
  1. ;
  1. ;Flush input buffer
  1. S RET=$$FLUSH^ABSPOSAB(DIALOUT)
  1. I RET Q 20997_",FLUSH^ABSPOSAB(),"_RET_",1"
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",1"
  1. ;
  1. ; if it's a direct T1 line connection, we are done - return success
  1. ;
  1. I $$T1DIRECT^ABSPOSA(DIALOUT) Q 0
  1. ;
  1. ; First, ATZ command to reset the modem
  1. ; And flush the buffer, too.
  1. S RET=$$ATZ^ABSPOSAB(DIALOUT)
  1. I RET Q 20008_",ATZ^ABSPOSAB(),"_RET
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",2"
  1. S RET=$$FLUSH^ABSPOSAB(DIALOUT)
  1. I RET Q 20997_",FLUSH^ABSPOSAB(),"_RET_",2"
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",3"
  1. ;
  1. ; Then send the initialization string, and flush
  1. ;
  1. S RET=$$INIMODEM^ABSPOSAB(DIALOUT)
  1. I RET Q 20009_",INIMODEM^ABSPOSAB(),"_RET
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",4"
  1. S RET=$$FLUSH^ABSPOSAB(DIALOUT)
  1. I RET Q 20997_",FLUSH^ABSPOSAB(),"_RET_",3"
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",5"
  1. ;
  1. ; Diagnostics: query the modem for its status
  1. ;
  1. S RET=$$MODEMSTS^ABSPOSAB(DIALOUT)
  1. I RET Q 20997_",MODEMSTS^ABSPOSAB(),"_RET_",31"
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",32"
  1. S RET=$$FLUSH^ABSPOSAB(DIALOUT)
  1. I RET Q 20997_",FLUSH^ABSPOSAB(),"_RET_",31"
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",33"
  1. ;
  1. ; Now we can dial the phone, and flush
  1. ;
  1. S RET=$$DIAL^ABSPOSAB(DIALOUT)
  1. I RET Q 20010_",DIAL^ABSPOSAB(),"_RET
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",6"
  1. S RET=$$FLUSH^ABSPOSAB(DIALOUT)
  1. I RET Q 20997_",FLUSH^ABSPOSAB(),"_RET_",4"
  1. S RET=$$STATUS(DIALOUT) I RET Q "20998,STATUS^"_$T(+0)_","_RET_",7"
  1. Q 0
  1. ;
  1. STATUS(DIALOUT) ;check status of IO
  1. ; Always returns 0 (OK) for direct-connect Modem.
  1. ; Returns $ZB value for terminal server.
  1. ; Development: $$STATRPT^ABSPOSAZ, $$GETSTAT^ABSPOSAZ may be useful
  1. ;
  1. I '$$TCP^ABSPOSA(DIALOUT) Q 0 ; relevant only to term server and T1
  1. ; if last operation timed out (-3), that's okay
  1. ; maybe we should also skim past "end of input" (-1), too
  1. N IO S IO=$$IO^ABSPOSA(DIALOUT)
  1. U IO N ZB S ZB=$ZB S:ZB=-3 ZB=0 Q ZB