phone.pp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2008 Free Pascal development team.
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. ********************************************************************** }
  10. //
  11. // phone.h
  12. //
  13. // Phone API
  14. //
  15. //
  16. // Microsoft Windows Mobile 6.0 for PocketPC SDK.
  17. //
  18. {$IFNDEF FPC_DOTTEDUNITS}
  19. unit phone;
  20. {$ENDIF FPC_DOTTEDUNITS}
  21. {$CALLING cdecl}
  22. interface
  23. {$IFDEF FPC_DOTTEDUNITS}
  24. uses WinApi.Windows;
  25. {$ELSE FPC_DOTTEDUNITS}
  26. uses Windows;
  27. {$ENDIF FPC_DOTTEDUNITS}
  28. type
  29. CALLERIDTYPE = (CALLERIDTYPE_UNAVAILABLE,
  30. CALLERIDTYPE_BLOCKED,
  31. CALLERIDTYPE_AVAILABLE);
  32. type
  33. IOM = (IOM_MISSED,
  34. IOM_INCOMING,
  35. IOM_OUTGOING);
  36. type
  37. CALLLOGSEEK = (CALLLOGSEEK_BEGINNING := 2,
  38. CALLLOGSEEK_END := 4);
  39. // Thought out by me specially for CALLLOGENTRY._flags field.
  40. const
  41. CALLLOGENTRY_FLAG_INCOMING = 0; // direction of call. (Missed calls are incoming.)
  42. CALLLOGENTRY_FLAG_OUTGOING = 1; // direction of call. (Missed calls are incoming.)
  43. CALLLOGENTRY_FLAG_CONNECTED = 2; // Did the call connect? (as opposed to busy, no answer)
  44. CALLLOGENTRY_FLAG_ENDED = 4; // Was the call ended? (as opposed to dropped)
  45. CALLLOGENTRY_FLAG_DROPPED = 0; // Was the call dropped? (as opposed to ended)
  46. CALLLOGENTRY_FLAG_ROAMING = 8; // Roaming (vs. local)
  47. CALLLOGENTRY_FLAG_LOCAL = 0; // Local
  48. type
  49. CALLLOGENTRY = record
  50. cbSize:DWORD; // sizeof CALLLOGENTRY
  51. ftStartTime:FILETIME;
  52. ftEndTime:FILETIME;
  53. _iom:IOM;
  54. _flags:UINT;
  55. {
  56. BOOL fOutgoing:1; // direction of call. (Missed calls are incoming.)
  57. BOOL fConnected:1; // Did the call connect? (as opposed to busy, no answer)
  58. BOOL fEnded:1; // Was the call ended? (as opposed to dropped)
  59. BOOL fRoam:1; // Roaming (vs. local)
  60. }
  61. cidt:CALLERIDTYPE;
  62. pszNumber:PTSTR;
  63. pszName:PTSTR;
  64. pszNameType:PTSTR; // "w" for work tel, "h" for home tel, for example
  65. pszNote:PTSTR; // filename of associated Notes file
  66. end;
  67. PCALLLOGENTRY = ^CALLLOGENTRY;
  68. const
  69. PhoneDLL = 'phone.dll';
  70. // Open the call log and set the seek pointer to the beginning.
  71. function PhoneOpenCallLog(ph:LPHANDLE):HRESULT; external PhoneDLL name 'PhoneOpenCallLog';
  72. // PhoneGetCallLogEntry returns one call log entry and advances the seek
  73. // pointer.
  74. // pentry->cbSize must be set to "sizeof CALLLOGENTRY" before this function is
  75. // called.
  76. // The entries are returned in order of start time, the most recent call first.
  77. // It is the responsibility of the caller to LocalFree any strings
  78. // which are returned.
  79. // A return value of S_FALSE indicates there are no more entries.
  80. function PhoneGetCallLogEntry(h:HANDLE; pentry:PCALLLOGENTRY):HRESULT; external PhoneDLL name 'PhoneGetCallLogEntry';
  81. // PhoneSeekCallLog seeks to a record in the call log.
  82. // iRecord is the zero-based index of the record, starting at the beginning
  83. // if seek == CALLLOGSEEK_BEGINNING, at the end if CALLLOGSEEK_END.
  84. // piRecord returns the zero-based index (from the beginning) of the seek
  85. // pointer after the seek is performed.
  86. // PhoneSeekCallLog(h, CALLLOGSEEK_END, 0, &count) will return the number of
  87. // records.
  88. function PhoneSeekCallLog(hdb:HANDLE;
  89. _seek:CALLLOGSEEK;
  90. iRecord:DWORD;
  91. piRecord:LPDWORD):HRESULT; external PhoneDLL name 'PhoneGetCallLogEntry';
  92. // Close the call log
  93. function PhoneCloseCallLog(h:HANDLE):HRESULT; external PhoneDLL name 'PhoneCloseCallLog';
  94. // The Call Log application supports the context menu extensibility mechanism.
  95. // The Context name is "Phone" and the Class name is "Log".
  96. // The IUnknown pointer passed to the context menu handler supports IPropertyBag,
  97. // and the set of properties supported is as follows:
  98. //
  99. // property name: type: value:
  100. // -------------- ----- ------
  101. // PropSet BSTR "CallLog"
  102. // Number BSTR the phone number of the other person on the call
  103. // NumberType BSTR the type of phone number (e.g. "h" for home)
  104. // Name BSTR person's name
  105. // Year I2 the year of the beginning time of the call
  106. // Month I2 the month of the beginning time of the call
  107. // Day I2 the day of the beginning time of the call
  108. // Hour I2 the hour of the beginning time of the call
  109. // Minute I2 the minute of the beginning time of the call
  110. // Second I2 the second of the beginning time of the call
  111. // DayOfWeek I2 the day of the week of the beginning time of the call
  112. // Duration UI4 the duration of the call in seconds
  113. // CallerIDType UI4 a CALLERIDTYPE value (see above)
  114. // Connected BOOL Did the call connect? (as opposed to busy, no answer)
  115. // Ended BOOL Was the call ended? (as opposed to dropped)
  116. // Outgoing BOOL Was the call outgoing? (Missed calls are incoming.)
  117. // Roaming BOOL Roaming?
  118. // IOM UI4 an IOM value (see above)
  119. // PhoneShowCallLog
  120. //
  121. // Show the Call Log, and filter it
  122. type
  123. CALLLOGFILTER = (CALLLOGFILTER_ALL_CALLS,
  124. CALLLOGFILTER_MISSED,
  125. CALLLOGFILTER_INCOMING,
  126. CALLLOGFILTER_OUTGOING);
  127. function PhoneShowCallLog(iCallLogFilter:CALLLOGFILTER):HRESULT; external PhoneDLL name 'PhoneShowCallLog';
  128. //++++++
  129. //
  130. // PhoneMakeCall
  131. //
  132. // Dials a number
  133. type
  134. tagPHONEMAKECALLINFO = record
  135. cbSize:DWORD;
  136. dwFlags:DWORD;
  137. //Params to tapiRequestMakeCall
  138. pszDestAddress:PCWSTR;
  139. pszAppName:PCWSTR;
  140. pszCalledParty:PCWSTR;
  141. pszComment:PCWSTR;
  142. // owner window for dialog box that appears when the PMCF_EDITBEFORECALLING flag is passed into PhoneMakeCall
  143. hwndOwner:HWND;
  144. end;
  145. PHONEMAKECALLINFO = tagPHONEMAKECALLINFO;
  146. PPHONEMAKECALLINFO = ^tagPHONEMAKECALLINFO;
  147. // PhoneMakeCall flags
  148. const
  149. PMCF_DEFAULT = $00000001;
  150. PMCF_PROMPTBEFORECALLING = $00000002;
  151. PMCF_EDITBEFORECALLING = $00000020;
  152. function PhoneMakeCall(ppmci:PPHONEMAKECALLINFO):LONG; external PhoneDLL name 'PhoneMakeCall';
  153. //
  154. // End PhoneMakeCall
  155. //
  156. //------
  157. //++++++
  158. //
  159. // PhoneAddSpeedDial
  160. //
  161. // adds a speed dial entry
  162. //
  163. // dwFlags - currently unused, set to 0
  164. //
  165. // piKey - in/out: the key sequence which will invoke the speed dial.
  166. // currently an entry between 2 and 99 (inclusive) is valid.
  167. // the API will cause existing entries to be overwritten
  168. //
  169. // pszDisplayName - the non-empty display name for the speed dial
  170. //
  171. // pszTelNumber - the non-empty tel# to be dialed
  172. //
  173. function PhoneAddSpeedDial(dwFlags:DWORD;
  174. piKey:LPDWORD;
  175. pszDisplayName:PTCHAR;
  176. pszTelNumber:PTCHAR):HRESULT; external PhoneDLL name 'PhoneAddSpeedDial';
  177. //
  178. // End PhoneAddSpeedDial
  179. //
  180. //------
  181. //++++++
  182. //
  183. // PhoneSendDTMFStart
  184. //
  185. // Allows an application to begin sending a DTMF tone using the
  186. // current phone call.
  187. //
  188. // Parameters:
  189. // chDTMF - DTMF character to send. Must be '0'-'9',
  190. // 'A'-'D', '*', or '#'.
  191. //
  192. // Return Value:
  193. // -----------------------------------------------------------
  194. // Value Description
  195. // ------------------------------------------------------------
  196. // S_OK The operation completed successfully.
  197. // E_FAIL An unknown error occurred.
  198. // E_INVALIDARG chDTMF is invalid.
  199. // E_NOTIMPL No phone is present on the device, the
  200. // phone service is not running, or no
  201. // calls are currently active.
  202. //
  203. // Other custom failure codes where the facility code is
  204. // FACILITY_WINDOWS_CE may be retrieved using the HRESULT_CODE
  205. // macro:
  206. // -----------------------------------------------------------
  207. // Error Code Description
  208. // ------------------------------------------------------------
  209. // ERROR_DEVICE_NOT_CONNECTED No phone is present on the device,
  210. // the phone service is not running, or
  211. // no calls are currently active.
  212. //
  213. // Remarks:
  214. // Caller must call PhoneSendDTMFStop to stop the DTMF tone.
  215. //
  216. // This function will fail if no phone is present on the
  217. // device, the phone service is not running, or no calls are
  218. // currently active. If a subsequent call to this API is made
  219. // by the caller or any other application before the DTMF tone
  220. // is finished the original DTMF tone will cease and the new
  221. // DTMF will be sent.
  222. //
  223. function PhoneSendDTMFStart(chDTMF:TCHAR):HRESULT; external PhoneDLL name 'PhoneSendDTMFStart';
  224. //
  225. // End PhoneSendDTMFStart
  226. //
  227. //------
  228. //++++++
  229. //
  230. // PhoneSendDTMFStop
  231. //
  232. // Stops an existing DTMF tone.
  233. //
  234. // Remarks:
  235. // This function stops all DTMF tones. Applications
  236. // may use PhoneSendDTMFStart to begin a DTMF tone.
  237. //
  238. procedure PhoneSendDTMFStop; external PhoneDLL name 'PhoneSendDTMFStop';
  239. //
  240. // End PhoneSendDTMFStop
  241. //
  242. //------
  243. //++++++
  244. //
  245. // PhoneIsEmergencyNumber
  246. //
  247. // Determines if a string contains an emergency phone number.
  248. //
  249. // Parameters:
  250. // fTailMatchOnly
  251. // [in] If this argument is set to TRUE, the function only
  252. // attempts to match emergency numbers at the end of
  253. // pszNumber. If this value is FALSE, the function attempts
  254. // to match the emergency string with the full pszNumber
  255. /// argument exactly.
  256. // pszNumber
  257. // [in] String to match. If this pointer is NULL or points
  258. // to an empty string, the function returns FALSE.
  259. // ppszEmergencyNumber
  260. // [out] On success, constant pointer to the emergency phone
  261. // number matched in pszNumber. Caller must not free. On
  262. // failure, this pointer is undefined. Optional, may be NULL.
  263. //
  264. // Return Value:
  265. // TRUE if pszNumber contains an emergency number; otherwise FALSE.
  266. //
  267. // Remarks:
  268. // The system merges the list of emergency phone numbers from
  269. // the registry and the SIM, if available. The list of emergency
  270. // numbers can vary by device.
  271. //
  272. function PhoneIsEmergencyNumber(fTailMatchOnly:BOOL;
  273. pszNumber:LPCTSTR;
  274. ppszEmergencyNumber:PLPWStr):BOOL;external PhoneDLL name 'PhoneIsEmergencyNumber';
  275. //
  276. // End PhoneIsEmergencyNumber
  277. //
  278. //------
  279. implementation
  280. end.