home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / ModuleSources / SetIndHSConnect.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-03  |  2.9 KB  |  105 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Module Name:    SetIndHSConnect                                                                */
  4. /*                                                                                                */
  5. /*    File Name:        SetIndHSConnect.c                                                            */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1994-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1994-05-20    Jaakko Railo        Original version                                        */
  15. /*                                                                                                */
  16. /************************************************************************************************/
  17.  
  18. /****************************************** DESCRIPTION ******************************************
  19.  
  20. *************************************************************************************************/
  21.  
  22. /******************************************** HEADERS *******************************************/
  23.  
  24. #ifndef __TELEPHONES__
  25. #include "Telephones.h"
  26. #endif
  27.  
  28. #include "TestModule.h"
  29.  
  30. /****************************************** DEFINITIONS *****************************************/
  31.  
  32. #define    rDisplaySetIndHSConnectDLOG    10000
  33. #define    kHandsetConnectItem            2
  34. #define    kHandsetDisconnectItem        3
  35.  
  36. /****************************************** PROTOTYPES ******************************************/
  37.  
  38. short     DisplaySetIndHSConnect (void);
  39. void     DoTest (CHRSPtr paramPtr);
  40.  
  41. /************************************************************************************************/
  42. /************************************************************************************************/
  43.  
  44.  
  45. pascal short TestModule (CHRSPtr paramPtr)
  46. {
  47.     short    returnValue = noErr;
  48.     
  49.     if (paramPtr->version <= kTestModuleVersion) {
  50.         
  51.         DoTest (paramPtr);
  52.         
  53.     }
  54.     else
  55.         returnValue = kWrongVersion;
  56.         
  57.     return (returnValue);
  58. }
  59.  
  60.  
  61. short DisplaySetIndHSConnect (void)
  62. {
  63.     short        itemHit;
  64.     DialogPtr    theDialog;
  65.     
  66.     if ((theDialog = GetNewDialog (rDisplaySetIndHSConnectDLOG, nil, (WindowPtr)(-1L))) != nil) {
  67.         
  68.         ShowWindow (theDialog);
  69.         
  70.         ModalDialog (nil, &itemHit);
  71.         
  72.         DisposeDialog (theDialog);
  73.     }
  74.     else
  75.         itemHit = -1;
  76.     
  77.     return (itemHit);
  78. }
  79.  
  80.  
  81. void DoTest (CHRSPtr paramPtr)
  82. {
  83.     TELHandle    termHand = GetCurrentTELHandle (paramPtr);
  84.     short        itemHit;
  85.     OSErr        errCode;
  86.     Boolean        handsetConnect;
  87.     
  88.     itemHit = DisplaySetIndHSConnect ();
  89.     if ((itemHit == kHandsetConnectItem) || (itemHit == kHandsetDisconnectItem)) {
  90.         
  91.         handsetConnect = (itemHit == kHandsetConnectItem)?telIndHSConnected:telIndHSDisconnected;
  92.         
  93.         if ((errCode = TELSetIndHSConnect (termHand, handsetConnect)) == noErr)
  94.             Print (paramPtr, "TELSetIndHSConnect --> HandsetConnect = %s", 
  95.                     ((handsetConnect==telIndHSConnected)?"telIndHSConnected":"telIndHSDisconnected"));
  96.         else
  97.             Print (paramPtr, "### TELSetIndHSConnect failed : %d", errCode);
  98.     }
  99.     else
  100.         if (itemHit == -1)
  101.             Print (paramPtr, "### Unable to get a DLOG resource");
  102. }
  103.  
  104.  
  105.