home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************************/
- /* */
- /* Module Name: CAVoiceDetect */
- /* */
- /* File Name: CAVoiceDetect.c */
- /* */
- /* © Apple Computer, Inc. 1994-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1994-07-15 Jaakko Railo Original version */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- #ifndef __TELEPHONES__
- #include "Telephones.h"
- #endif
-
- #include "TestModule.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- #define rDisplayVoiceDetectDLOG 10000
- #define kVoiceDetectOnItem 2
- #define kVoiceDetectOffItem 3
- #define kVoiceDetectOn 1
- #define kVoiceDetectOff 0
-
- /****************************************** PROTOTYPES ******************************************/
-
- short DisplayVoiceDetect (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 DisplayVoiceDetect (void)
- {
- short itemHit;
- DialogPtr theDialog;
-
- if ((theDialog = GetNewDialog (rDisplayVoiceDetectDLOG, 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 numOfCAs;
- TELCAHandle caHand;
- short itemHit;
- OSErr errCode;
- Boolean voiceDetect;
-
- if ((dnHand = GetDNHandle (paramPtr)) != nil) {
-
- if ((numOfCAs = TELCountCAs (dnHand, telAllCallOrigins)) > 0) {
-
- if ((caHand = GetCAHandle (paramPtr)) != nil) {
- itemHit = DisplayVoiceDetect ();
- if ((itemHit == kVoiceDetectOnItem) || (itemHit == kVoiceDetectOffItem)) {
-
- voiceDetect = (itemHit == kVoiceDetectOnItem)?kVoiceDetectOn:kVoiceDetectOff;
-
- if ((errCode = TELCAVoiceDetect (caHand, voiceDetect)) == noErr)
- Print (paramPtr, "TELCAVoiceDetect --> VoiceDetect = %s",
- ((voiceDetect==kVoiceDetectOn)?"VoiceDetectOn":"VoiceDetectOff"));
- else
- Print (paramPtr, "### TELCAVoiceDetect failed : %d", errCode);
- }
- else
- if (itemHit == -1)
- Print (paramPtr, "### Unable to get a DLOG resource");
- }
- else
- Print (paramPtr, "### Unable to retrieve the CA handle");
- }
- else
- Print (paramPtr, "### Number of CAs is %d", numOfCAs);
- }
- else
- Print (paramPtr, "### Unable to retrieve the DN handle");
- }
-
-
-