modemmgr.pp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {$MACRO ON}
  2. (******************************************************************************
  3. *
  4. * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
  5. * All rights reserved.
  6. *
  7. * File: ModemMgr.h
  8. *
  9. * Release: Palm OS SDK 4.0 (63220)
  10. *
  11. * Description:
  12. * Include file for Modem Manager
  13. *
  14. * History:
  15. * 9/20/95 VMK - Created by Vitaly Kruglikov
  16. *
  17. *****************************************************************************)
  18. unit modemmgr;
  19. interface
  20. uses palmos, coretraps, errorbase;
  21. (************************************************************
  22. * Modem Manager constants
  23. *************************************************************)
  24. const
  25. mdmMaxStringSize = 40;
  26. mdmCmdBufSize = 81; // command buffer capacity (including null)
  27. mdmRespBufSize = 81; // reply buffer capacity (including null)
  28. mdmCmdSize = 8; // max storage needed for smartmodem command
  29. mdmDefCmdTimeOut = 500000; // in micro-seconds
  30. mdmDefDTWaitSec = 4;
  31. mdmDefDCDWaitSec = 70;
  32. mdmDefSpeakerVolume = 1;
  33. mdmResetStrInCmdBuf = $01;
  34. // Speaker volume settings
  35. const
  36. mdmVolumeOff = 0;
  37. mdmVolumeLow = 1;
  38. mdmVolumeMed = 2;
  39. mdmVolumeHigh = 3;
  40. // Modem connection stages (NEW for Pilot 2.0)
  41. type
  42. MdmStageEnum = Enum;
  43. const
  44. mdmStageInvalid = 0; // invalid state
  45. mdmStageReserved = 1; // reserved for 1.0 compatibility
  46. mdmStageFindingModem = Succ(mdmStageReserved); // checking if modem is present
  47. mdmStageInitializing = Succ(mdmStageFindingModem); // initializing the modem
  48. mdmStageDialing = Succ(mdmStageInitializing); // dialing the modem
  49. mdmStageWaitingForCarrier = Succ(mdmStageDialing); // waiting for carrier detect
  50. mdmStageHangingUp = Succ(mdmStageWaitingForCarrier); // hanging up the modem
  51. (************************************************************
  52. * Modem Manager data structures
  53. *************************************************************)
  54. // Prototype for the "user cancel" check callback function
  55. type
  56. MdmUserCanProcPtr = function(userRef: UInt32): Int16;
  57. MdmInfoType = record
  58. portID: UInt16; // serial port ID number. [NewSerialMgr; replaces serRefNum]
  59. initialBaud: UInt32; // initial baud rate to use
  60. cmdTimeOut: UInt32; // number of micro-sec to wait after a cmd
  61. dtWaitSec: Int16; // dialtone wait (sec) (-1 for modem's default)
  62. dcdWaitSec: Int16; // dcd timeout wait (sec) (-1 for modem's default)
  63. volume: Int16; // speaker volume(see mdmVolume... constants)
  64. pulse: Boolean; // pulse or tone dialing
  65. hwHShake: Boolean; // enable cts/rts handshaking
  66. autoBaud: Boolean; // enable/disable auto-baud to connected baud rate
  67. telConnection: UInt8; // Boolean true if connecting to a mobile phone
  68. // false otherwise.
  69. canProcP: MdmUserCanProcPtr; // ptr to user-cancel function
  70. userRef: UInt32; // parameter for canProcP()
  71. cmdBuf: array [0..mdmCmdBufSize-1] of Char; // build all commands here
  72. respBuf: array [0..mdmRespBufSize-1] of Char; // response buffer
  73. connectBaud: UInt32; // baud at which connection was established
  74. // (0 = unknown)
  75. curStage: UInt8; // set by ModemMgr to report current MdmStageEnum
  76. strInCmdBuf: UInt8; // Set to mdmResetStrInCmdBuf if the reset string is
  77. // stored in the command buffer cmdBuf. This is to
  78. // get around a compatibility problem with not being
  79. // able pass in a reset string. The reset string
  80. // must be prefixed with AT. Set to zero otherwise
  81. end;
  82. MdmInfoPtr = ^MdmInfoType;
  83. (************************************************************
  84. * Modem Manager result codes
  85. * (mdmErrorClass is defined in ErrorBase.h)
  86. *************************************************************)
  87. const
  88. mdmErrNoTone = mdmErrorClass or 1; // no dial tone
  89. mdmErrNoDCD = mdmErrorClass or 2; // no carrier / timeout
  90. mdmErrBusy = mdmErrorClass or 3; // busy signal heard
  91. mdmErrUserCan = mdmErrorClass or 4; // cancelled by user
  92. mdmErrCmdError = mdmErrorClass or 5; // command error
  93. mdmErrNoModem = mdmErrorClass or 6; // no modem detected
  94. mdmErrMemory = mdmErrorClass or 7; // not enough memory
  95. mdmErrPrefs = mdmErrorClass or 8; // modem preferences have not been
  96. // setup - (app should take user to modem prefs panel)
  97. mdmErrDial = mdmErrorClass or 9; // dial command error - most likely the dial
  98. // string is too long for the modem's buffer or
  99. // contains invalid characters
  100. // <chg 3-7-98 RM> New error code for empty phone number which is only invalid if
  101. // the modem type is not a "Direct Connect" modem
  102. mdmErrNoPhoneNum = mdmErrorClass or 10; // No phone number and not "Direct Connect"
  103. (********************************************************************
  104. * Modem Manager Routines
  105. * These are define as syscall calls only under emulation mode or
  106. * under native mode from the module that actually installs the trap
  107. * vectors
  108. ********************************************************************)
  109. //-------------------------------------------------------------------
  110. // API
  111. //-------------------------------------------------------------------
  112. function MdmDial(modemP: MdmInfoPtr; okDialP, userInitP, phoneNumP: PChar): Err; syscall sysTrapMdmDial;
  113. function MdmHangUp(modemP: MdmInfoPtr): Err; syscall sysTrapMdmHangUp;
  114. (************************************************************
  115. * Modem Manager Macros
  116. *************************************************************)
  117. implementation
  118. end.