home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************************/
- /* */
- /* Module Name: DNSetAutoAnswer */
- /* */
- /* File Name: DNSetAutoAnswer.c */
- /* */
- /* © Apple Computer, Inc. 1994-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1994-05-20 Jaakko Railo Original version */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- #include "TextUtils.h"
-
- #ifndef __TELEPHONES__
- #include "Telephones.h"
- #endif
-
- #include "TestModule.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- #define rDisplaySetAutoAnswerDLOG 10000
- #define kAutoAnswerOnItem 2
- #define kAutoAnswerOffItem 3
- #define kAutoAnswerOn 1
- #define kAutoAnswerOff 0
-
- /****************************************** PROTOTYPES ******************************************/
-
- short DisplaySetAutoAnswer (void);
- void DoTest (CHRSPtr paramPtr);
-
- /************************************************************************************************/
- /************************************************************************************************/
-
-
- pascal short TestModule (CHRSPtr paramPtr)
- {
- short returnValue = noErr;
-
- if (paramPtr->version <= kTestModuleVersion) {
-
- DoTest (paramPtr);
-
- }
- else
- returnValue = kWrongVersion;
-
- return (returnValue);
- }
-
-
- short DisplaySetAutoAnswer (void)
- {
- short itemHit;
- DialogPtr theDialog;
-
- if ((theDialog = GetNewDialog (rDisplaySetAutoAnswerDLOG, nil, (WindowPtr)(-1L))) != nil) {
-
- ShowWindow (theDialog);
-
- ModalDialog (nil, &itemHit);
-
- DisposeDialog (theDialog);
- }
- else
- itemHit = -1;
-
- return (itemHit);
- }
-
-
- void DoTest (CHRSPtr paramPtr)
- {
- TELHandle termHand = GetCurrentTELHandle (paramPtr);
- TELDNHandle dnHand;
- short itemHit;
- OSErr errCode;
- Boolean autoAnswer;
-
- if ((dnHand = GetDNHandle (paramPtr)) != nil) {
- itemHit = DisplaySetAutoAnswer ();
- if ((itemHit == kAutoAnswerOnItem) || (itemHit == kAutoAnswerOffItem)) {
-
- autoAnswer = (itemHit == kAutoAnswerOnItem)?kAutoAnswerOn:kAutoAnswerOff;
-
- if ((errCode = TELDNSetAutoAnswer (dnHand, autoAnswer)) == noErr)
- Print (paramPtr, "TELDNSetAutoAnswer --> AutoAnswer = %s",
- ((autoAnswer==kAutoAnswerOn)?"AutoAnswerOn":"AutoAnswerOff"));
- else
- Print (paramPtr, "### TELDNSetAutoAnswer failed : %d", errCode);
- }
- else
- if (itemHit == -1)
- Print (paramPtr, "### Unable to get a DLOG resource");
- }
- else
- Print (paramPtr, "### Unable to retrieve the DN handle");
- }
-
-
-