QLib.h
上传用户:jyxlt00
上传日期:2008-01-30
资源大小:369k
文件大小:540k
源码类别:

网络编程

开发平台:

Visual C++

  1. /******************************************************************************/
  2. /**
  3. Program: QLib
  4. file 
  5.   SourceQLib.h
  6. code 
  7. - Defines the "C" interface for all Factory Library functions.
  8. - Table of contents (text search can be done for the following sections)
  9. - General Information
  10. - Related Documents
  11. - Version History
  12. - Callback function definitions
  13. - Connection/Disconnection Functions
  14. - Text Logging
  15. - GSM Diag
  16. - Streaming Download Diag
  17. - Diagnostic commands
  18. - Phone async Logging
  19. - Phone sync (command) Logging
  20. - Keypad Diag
  21. - Handset Diag
  22. - MediaFLO Diag
  23. - Commands for multiple FTM modes
  24. - Dual RX Chain FTM RF Commands 
  25. - FTM CDMA RF Calibration API V2 
  26. - GSM FTM
  27. - GSM Polar Tx Cal FTM
  28. - GSM External Tx Polar Calibration FTM
  29. - WCDMA FTM
  30. - PMIC FTM
  31. - cdma2000 FTM
  32. - cdma2000 FTM non-signaling
  33. - EVDO Non-signaling FTM 
  34. - Bluetooth FTM
  35. - Audio FTM
  36. - Camera FTM
  37. - FTM Log
  38. - WCDMA BER FTM
  39. - HSDPA BER FTM
  40. - GSM BER FTM
  41. - EGPRS BER FTM
  42. - GSDI Diag
  43. - AGPS FTM
  44. - Common RF FTM
  45. - MediaFLO FTM
  46. - Software Download
  47. - EFS Functions
  48. ------------------------------------------------------
  49. ----------------------
  50. General Information
  51. ----------------------
  52. - All data types used in this interface are ANSI C compatible.
  53. - All returns that indicate "true if succeed, false if fail" are defined
  54. as:  1 = true = Success , 0 = false = failure
  55. Functions that are not entirely upper case do not correspond directly to 
  56. an FTM or diagnostic command. 
  57. For example, QLIB_ConnectServer() is not mapped directly to a diagnostic 
  58. command.
  59. - Variable Names
  60. Variable names are prefixed in lower case to indicate the data type.
  61. The following are defined:
  62. p = Pointer
  63. i = Integer type, either char, short, or long
  64. d = Double or floating point
  65. e = Enumeration (possibly stored as a short, but representing 
  66.                  a fixed list of possibilities)
  67. b = unsigned char, 0=false, 1=true
  68. ----------------------
  69. Related Documents 
  70. ----------------------
  71. - The function name convention used in this document is as follows:
  72. QLIB_ indicates that this function corresponds to library function
  73. in the QLib project.
  74. From there, all diagnostic and FTM functions are named exactly as
  75. the command identifiers are defined in the QLib_Defines.h,
  76. which are also the same as the following documents:
  77. CDMA diagnostic = 80-V1294-1
  78.                 = CDMA Dual-Mode Subscriber Station Serial Data Interface Control Document
  79. Call Manager Subsystem = 80-V1294-7
  80.                 = Call Manager Subsystem Interface Control Document
  81. UMTS Diagnostic = 80-V4083-1 
  82.                 = Serial Interface Control Document for UMTS
  83. WCDMA Diagnostic = 80-V2708-1 
  84.                  = Serial Interface Control Document for WCDMA
  85. GSM Diagnostic = 80-V5295-1 
  86.                  = Serial Interface Control Document for GSM and GPRS
  87. GSM FTM    = CL93-V5370-1 
  88.            =  Factory Test Mode GSM RF Commands, Application Note
  89. GSM Polar Commands = 80-V9539-1
  90.    = Factory Test Mode Polar Commands, Application Note
  91. GSM External Polar = 80-V9774-11
  92. = MSM6275 Polar Calibration Using Test Equipment, Application Note
  93. WCDMA FTM  = CL93-V5368-1 
  94.            = Factory Test Mode WCDMA Commands, Application Note
  95. Bluetooth  = 80-V7804-1 = Factory Test Mode Bluetooth API
  96. PMIC = 80-V8942-1  = Factory Test Mode PMIC API
  97. Aync-GPS = CL93-V7319-1 = Factory Test Mode AGPS Commands
  98. Factory Test Mode Production API (Customer Extention) = 80-V9047-1
  99. Audio = 80-V9048-1 - Factory Test Mode Audio API
  100. Camera = 80-V9027-1 - Factory Test Mode Camera API
  101. FTM Logging = 80-V9147-1 - Factory Test Mode Logging API
  102. WCDMA BER = 80-V9698-1 = Factory Test Mode WCDMA BER API
  103. GSM BER = 80-V3951-1 = Factory Test Mode GSM BER API
  104. HSDPA BER = 80-V5504-1 = Factory Test Mode HSDPA BLER API 
  105. EGPRS BER = 80-V5529-1 = Factory Test Mode EGPRS BER API
  106. CDMA FTM RF Commands = CL93-V4168-1 = Factory Test Mode RF Commands (MSM6000/6025/6050) (Command 59)
  107. CDMA FTM 1x RF Commands = CL93-V5419-1 = Factory Test Mode 1x RF Commands (MSM6100/6300) (Command 75)
  108. Diversity Path Calibration = CL93-V5864-1 = Factory Test Mode Dual Rx Chain CDMA 1x RF Commands (MSM6500/6550)
  109. CDMA2000/1xEV-DO Non-Signaling = CL93-V1974-1 = Factory Test Mode (MSM 5000/5105/5100/5500, 6000/6025/6050)  
  110. CDMA2000 Non-Signaling Commands = 80-V5849-1 = Factory Test Mode cdma2000 Commands
  111. 1xEV-DO Non-Signaling Commands = CL93-V7429-1 = Factory Test Mode 1xEV-DO Commands
  112. IntelliCeiver Calibration = 80-V2376-1 = FTM CDMA RF Calibration API V2 (MSM 6550)
  113. File System Subsystem Interface Control Document = 80-V1294-11
  114. DMSS Download Protocol Interface Specification and Operational Description = 80-39912-1
  115. File System Subsystem Interface Control Document = 80-V1294-11
  116. Handset Subsystem Interface Control Document = 80-V1294-8 
  117. Streaming Download Protocol Specification = 80-V5348-1
  118. MediaFLO FTM = 80-V2166-14 = Factory Test Mode MediaFLO RF Calibration API
  119. Factory Test Mode 1X Logging API Interface Control Document = 80-V9151-1
  120. FTM Common API = 80-VA888-1 FTM Common API
  121. endcode
  122. -----------------------
  123. Version History
  124. -----------------------
  125.  b QUALCOMM  b PROPRIETARY 
  126. This document contains propriety information, and except with written
  127. permission of Qualcomm INC, such information shall not be 
  128. published, or disclosed to others, or used for any purpose, and the   
  129. document shall not be duplicated in whole or in part.  
  130. version 
  131. code
  132. Version      Author      Description  
  133. -------      ------      -----------   
  134. 5.0.0
  135. For QDART 1.0.20 release
  136. 4.26.5
  137.   - Modified the logic at the begining of a QLIB_FTM_WCDMA_BER_StartSession() because
  138.      in cases when mobile the START operation fails, the STOP command was not being 
  139.  issued, followed by another START.  This would cause problems if the mobile had
  140.  been in a session previously, then the PC application is restarted but the phone
  141.  is not reset.
  142.   - Added MediaFLO logs and debug messages to the list of allowable async messages.
  143.   - Fixed a problem with the status variables stored in the WCDMA_BER_State structure.
  144.      The fields iACQUIRE_CNF_frequency and iACQUIRE_CNF_scr_code were not being reported
  145.  correctly.
  146.   - Changed QLIB_FTM_WCDMA_BER_Handover_V2B(), parameter iDPCCH_PowerOffset, from "unsigned short"
  147.     to "short" so that negative numbers would be valid.
  148. 4.26.4
  149. Logging fix
  150. 4.26.3
  151. - Fixed exception in QLIB_MFLO_Start_PhyMAC().
  152. - Removed QLIB_MFLO_StartPhy() and QLIB_MFLO_StopPhy().
  153. - Removed dRSSI from mftypes_per_statistics.
  154. 4.26.2
  155. - Added QLIB_MFLO_DeactivateAllFlows function for MediaFLO.
  156. - Fixed bug in QLIB_MFLO_GetPER_Phy which was causing the function to get stuck in 
  157.   an infinite loop if the statistics for one or more Flow IDs are always zero.
  158. 4.26.1
  159. QLIB_FTM_CDMA2000_NS_Start added parameter to enable logging diversity AGC
  160. 4.26.0
  161. -Added version block info to DLL
  162. 4.25
  163.   - Fixed linker problem with QLIB_FTM_SET_PA_STOP_DELTA()
  164.   - Added functions that allow the user to pause and resume the library's data read 
  165.     thread when in QPHONEMS or user-defined transport communication modes.
  166.   - QLIB_PauseDataReceive()
  167.   - QLIB_ResumeDataReceive()
  168.   - Fixed a delay that occurs when the COM port is being shut down in QPHONEMS mode.
  169.     An event that signaled the acknowledge of the request was not being handled correctly,
  170. which resulted in the library to wait for the entire time-out period.  This
  171. will be noticable when calling QLIB_DisconnectServer()
  172.   - Fixed WCDMA Band Class 9, which was not being initialized correctly when calling QLIB_FTM_SET_MODE()
  173.   - Fixed problem with QLIB_DIAG_SET_DIPSW_F() in which the wrong command code (the one for
  174.     getting the dip-switch statew) as being sent.
  175.   
  176.   - Added functions to measure MediaFLO packet error rate:
  177.  - QLIB_MFLO_Start_Phy()
  178.  - QLIB_MFLO_GetPER_Phy()
  179.  - QLIB_MFLO_Stop_Phy()
  180.  - QLIB_MFLO_InitTAPMsgContent_PhyMAC()
  181.  - QLIB_MFLO_Start_PhyMAC()
  182.  - QLIB_MFLO_GetPER_PhyMAC()
  183.  - QLIB_MFLO_Stop_PhyMAC()
  184.  - QLIB_MFLO_FinalCleanup_PhyMAC()
  185.   - Added QLIB_FTM_SET_PDM_signed(), which will allow a PDM value to be specified as a signed
  186.     number, rather than the existing implementation, which is an unsigned value.
  187.   - Fixed problem with setting the non-signaling timeout values when FTM_NONSIG_DEFAULT_TIMEOUT
  188.     is used as a parameter to QLIB_FTM_WCDMA_BER_StartSession() or QLIB_FTM_GSM_BER_StartSession()
  189.   - Fixed problems could happen with WCDMA and GSM non-signaling functions that wait for status.
  190.     If the operation (such as WCDMA Acquire Pilot) had ran previously in the same sessions, then
  191. the library would not wait for the log message when the 2nd WCDMA Acquire Pilot was called.
  192.   - Fixed QLIB_FTM_SET_WCDMA_SECONDARY_CHAIN() description error and bug, which primary chain is not enabled with
  193.     (bEnableSecodaryChain == 0)
  194.   - Added the timeout enumeration value QMSL_Timeout_WriteData to be with QLIB_ConfigureTimeOut().  
  195.     This timeout value is used when writing data to a physical layer in QPHONEMS mode.
  196.   - Added functions to query/change FTM mode
  197.      - QLIB_IsFTM_Mode()
  198.  - QLIB_ChangeFTM_BootMode()
  199.  - QLIB_ChangeFTM_ModeRuntime()
  200.   - Fixed a bug in QLIB_DIAG_NV_READ_F, entire user buffer was not passed to embedded side,
  201.     which caused problem with certain NV items.
  202.   - FTM_SET_WCDMA_SECONARY_CHAIN command ID should be 121 instead of 120
  203.   - Removed FTM_TEST_GET_DVGA_LNA, this API doesn't exist on embedded side
  204.   - Changed Rx_AGC data type in CDMA Intelliceiver Calibration API from "unsigned short" to "short"
  205.   - Updated the QLIB_FTM_TX_RX_FREQ_CAL_SWEEP() to include two new additional parameters in the
  206.     request/response structure, FTM_Tx_Rx_Freq_Cal_Sweep_Request_Response
  207.   - Added restrictions so that only certain logs and extended messages could be
  208.     enabled. The following functions are affected:
  209.    - QLIB_DIAG_SetExtendedLogMask()
  210.    - QLIB_DIAG_SetMessageFilter()
  211.    - QLIB_DIAG_GetMultipleLogs()
  212.    - QLIB_DIAG_GetSingleLog()
  213.    - QLIB_DIAG_AddExtendedLogCodes()
  214.    - QLIB_DIAG_AddExtendedLogCode()
  215.    - QLIB_DIAG_SetExtendedLogCode()
  216.   Documentation about the affected extended messages can be found in the comments for QLIB_DIAG_SetMessageFilter()
  217.   Documentation about the affected log messages canbe found in the comments for QLIB_DIAG_SetExtendedLogCode()
  218.   -Removed 2 extra reserved word from the packet definition for FTM_SET_WCDMA_SECONARY_CHAIN command
  219.   - Added QLIB_FTM_AGPS_GET_CTON(), a function to return the C/N value for AGPS.  This function protocol
  220.     is slightly different from the WCDMA and CDMA C/N function, so it is placed into its own function.
  221. 4.24
  222.   - Fixed bug in QLIB_FTM_DETECT_COMMAND_CODE(), in which the underlying 
  223.     function was being called only when the resrouces were not properly 
  224. allocated.  Changed so that underlying function is called when resources are OK.
  225.   - Changed all callback configuration functions to accept a 
  226.     NULL argument for the text callback, in which case the callback would be 
  227. disabled.  This is done to fix a problem that occurs when the application 
  228. is shutting down and the call back function activates resources on the 
  229. client that are not available during shutdown.  Affected functions:
  230. - QLIB_ConfigureCallBacks()
  231. - QLIB_ConfigureEfs2CallBacks()
  232. - QLIB_ConfigureLibraryTextLogCallBack() 
  233.   - Changed FTM_WCDMA_BER_Handover() to fix a bug with the logic.
  234.   - Released all changes made in 4.23.  There were so many engineering builds
  235.     that it makes sense to move to a new version in order to distinguish
  236. the final release.
  237. 4.23
  238.   - Moved all documentation into the help file, Help/QMSL_Help.chm.  The .DOC file is now
  239.     obsolete.   Release notes are only posted in the QLb.h header file.
  240.   - Added QLIB_FTM_LOAD_RF_NV()
  241.   - In QPST mode, the command response message queue was not being cleared after each send sync.
  242.     In other words, the command response queue would build up to its maximum size over time because
  243. each response message was not moved from the queue.  This shouldn't cause problems, but it would
  244. consume more memory than is necessary.
  245.   - Added some extra debug messages to the GSDI Send and Wait function, which is used to handle
  246.     multiple-response commands for security operations such as writing the root key.
  247.   - Added EVDO Rev A Non-signaling commands, 
  248.      - _FTM_EVDO_DEMOD_FWD_WITH_NO_REV()
  249.  - _FTM_EVDO_SET_IDLE()
  250.  - _FTM_EVDO_REV_A_CONF_MAC_FOR_FWD_CC_MAC_FTC()
  251.  - _FTM_EVDO_REV_A_MOD_ACC()
  252.  - _FTM_EVDO_REV_A_MOD_TRA()
  253.  - _FTM_EVDO_REV_A_DEMOD_FWD_WITH_NO_REV()
  254.   - Implmemented QLIB_FTM_EVDO_NS_SetStatisticsState in QLib.cpp to resolve linkage problem
  255.   - Added MediaFLO diag functions:
  256.      - QLIB_MFLO_RST_PLP_STATS()
  257.      - QLIB_MFLO_GET_FLO_STATE()
  258.      - QLIB_MFLO_START_FLO()
  259.      - QLIB_MFLO_GET_FLO_VERSION_INFO()
  260.      - QLIB_MFLO_ACTIVATE_FLOW()
  261.      - QLIB_MFLO_DEACTIVATE_FLOW()
  262.      - QLIB_MFLO_GET_BOUND_FLOW_COUNT()
  263.      - QLIB_MFLO_GET_BOUND_FLOW_LIST()
  264.      - QLIB_MFLO_GET_MLC_INFO()
  265.      - QLIB_MFLO_GET_RSSI_VALUE()
  266.      - QLIB_MFLO_GET_MLC_PLP_STAT_DYN_PARAMS()
  267.      - QLIB_MFLO_SET_RF_CHNL()
  268.      - QLIB_MFLO_GET_RF_CHNL()
  269.      - QLIB_MFLO_RST_MLC_PLP_STATS()
  270.      - QLIB_MFLO_GET_MLC_DYN_PARAMS()
  271.      - QLIB_MFLO_GET_OIS_PLP_STAT()
  272.      - QLIB_MFLO_RST_OIS_PLP_STATv
  273.      - QLIB_MFLO_GET_FLO_SUBSTATE()
  274.      - QLIB_MFLO_GET_ACTIVE_MLC_COUNT()
  275.      - QLIB_MFLO_GET_ACTIVE_MLC_LIST()
  276.      - QLIB_MFLO_GET_FLO_PLP_DYN_PARAMS()
  277.      - QLIB_MFLO_ENABLE_FTAP_PLP_DATA()
  278.      - QLIB_MFLO_ENABLE_FTAP_OIS()
  279.      - QLIB_MFLO_ENABLE_WIC_LIC()
  280.   - Modified the COM port write time out to have 1 MS write time out per byte and a 50ms total timeout
  281.     in the QPHONEMS mode.  This was required to perform download operations over USB.
  282.   - Added QLIB_EfsWriteMem() for writing EFS using a memory pointer instead of a file
  283.   - Added functions for sending AT commands to the phone:
  284.      - QLIB_SendRAW
  285.      - QLIB_SetPacketMode
  286.   - Added QLIB_FTM_GSM_BER_IsTrafficValid(), a function for getting the traffic status durin a GSM
  287.     non-signaling session.
  288.   - Added QLIB_FTM_GSM_ConfigLoopbackType(), a function for configuring the GSM loopback type.
  289.   - Added a mutex to the internal sync and async message queues, to guarantee only one thread is 
  290.     accessing the queue at a time.
  291.   - Added QLIB_FTM_LOAD_RF_NV(), a new function in the FTM Common API, which will load RF Cal NV data 
  292.     from NV storage into the RF Driver.  This is to be used after performing calibration and before
  293. a non-signaling session is started while the phone has remained powered on and not reset
  294. after RF Calibration.
  295.   - Added code to allow the return of the AT command response when QLIB_SendRAW() is called.
  296.   - Removed a call to QLIB_FTM_GSM_BER_ClearStatus(), which was embedded in FTM_GSM_BER_GetRxMetrics()
  297.     
  298.   - Added Changed the logic of QLIB_FTM_GSM_BER_IsTrafficValid() so that call status is modeled after
  299.     the 3GPP document 45.008, which specifies a SACCH accumulator that starts at a value of 40 and
  300. is decremented by 1 for each invalid SACCH CRC and incremented by 2 for each valid SACCH CRC. 
  301.   - Added function QLIB_FTM_GSM_BER_SetSACCH_AccumulatorMax() to set the SACCH accumulator maximum 
  302.     value, which controls the time-out duration for detecting a failed traffic channel.
  303.   - Disabled wait for LOG_FTM2_STOP_GSM_MODE_CNF event (GSM BER stop service) when QLIB_FTM_GSM_BER_Handover()
  304.     is called
  305.   - Fixed linking problem with QLIB_FTM_EGPRS_BER_StartIdleMode().  Internaly 2 extra parameters were being used
  306.     for the .cpp, relative to the prototype declared in QLib.h
  307.   - When QLIB_GetLibraryCapabilities() is called, the EFS is now enabled for both QPST and QPHONEMS modes
  308.   - Added the function QLIB_ConnectServer_UserDefinedTransport(), which allows a connection to be created with
  309.     a user-defined transport layer.   The user defined layer is specified by certain callback functions that
  310. are used to send and receive data.
  311.   - Fixed the "response size" field sent for QLIB_FTM_TX_RX_FREQ_CAL_SWEEP(), the size should have been 12, but
  312.     it was being specified as 16 bytes.  In addition, the PA Range list was being sent as 16-bit numbers instead
  313. of 8-bit numbers.
  314.   - Added text log types, LOG_C_HIGH_LEVEL_START and LOG_C_HIGH_LEVEL_STOP, which will be used to indicate the 
  315.     beginning and end of high level C functions (functions that in turn call other functions).  This will make
  316. it possible to parse the text logs in a more effective manner and give users an idea of exactly what functions
  317. represent a direct call to QMSL.
  318.     As part of this change, LOG_ERR_AHDLC was merged with LOG_INF_AHDLC, and LOG_ERR_DEV was merged with LOG_INF_DEV.
  319.   - Removed call to QLIB_FTM_WCDMA_BER_ClearStatus() for all functions, except QLIB_WCDMA_BER_StartSession
  320.   - Removed call to QLIB_FTM_EGPRS_BER_ClearStatus() for all functions, except FTM_EGPRS_BER_AssignBCCH
  321.   - Added QLIB_FTM_SET_PA_START_DELTA and QLIB_FTM_SET_PA_STOP_DELTA, functions that previously
  322.     where not enabled for GSM FTM.
  323.   - Fixed problem with user defined transport layer, which could occur if the COM port is closed before
  324.     the QLib_DisconnectServer() is called.
  325. 4.22
  326.   - Added code to support CDMA450, CDMA450_EXT,  WCDMA_BC4, WCDMA_BC8 in QLIB_FTM_SET_MODE
  327.   - Added code to clean up some small memory leaks when reporting the list of available COM ports.
  328.   - Changed the connection timout to not include the word QPST, because the timeout 
  329.     can be used for both QPST and QPHONE modes.
  330.      -  In QLib_Defines.h: changed QMSL_Timeout_QPST_Connect to QMSL_Timeout_Connect
  331.   - Changed QLIB_ConnectServerWithWait() to look for a phone only every 100ms, in order to 
  332.     avoid increased CPU consumption and for debugging of a possible memory leak for some
  333. data structures used iwht QPST, to get the phone port configurations
  334.   - Added QLIB_DIAG_READ_ESN_F(), a function to read the ESN NV item.
  335.   - Changed the definition for LOG_DEFAULT to include LOG_FN.  This value is used when auto
  336.     starting the text log file.
  337.   - Fixed the prototype for QLIB_FTM_PMIC_CONFIG_PWR_CTRL_LIMIT(), which did not have a resource
  338.     context handle input
  339.   - Added the mode id for FTM_MODE_WCDMA_RX1, to be used with QLIB_FTM_SET_MODE_ID() to select 
  340.     the diversity receiver for subsequent FTM commands.
  341.   - Added QLIB_FTM_SET_WCDMA_SECONDARY_CHAIN() for enabling/disabling the 2nd WCDMA receiver
  342.   - Fixed a situation in which QLIB_StopLogging() would only reset the text log file, not actually 
  343.     stop the text logging to the file.
  344.   - Added the parameter bIgnore1stRDA to QLIB_FTM_CDMA2000_NS_ClearStatus(), which is an option to force the
  345.     first RDA log to be ignored.
  346.   - Changed all EFS functions, most EFS functions to use the internal diagnostic HDLC path 
  347.     (either QPST or QPHONEMS), instead of using the EFS interface via QPST.  This means that
  348. almost all EFS functions will work in the QPHONEMS mode, but the downside is that only EFS2 operations
  349. are supported.  The functions that will work only with QPST are:
  350. QLIB_DownloadPRL()
  351. QLIB_UploadPRL()
  352. QLIB_DownloadCEFS_File()
  353.   - Added a function to support aborting of EFS operations
  354.   - Changed the size of the internally maintained "asynchronous queue" to 4096 items instead of 512.  This
  355.     will allow for capture of a larger list of asynchronous messages.
  356.   - Added a warning that the GSM BER traffic loopback should be disabled before releasing the
  357.     channel or stopping the GSM BER service, in cases where further GSM BER testing will be 
  358. performed before the mobile is turned off or reset.
  359. 4.21
  360.   - Added a millisecond timer to the structure QMSL_TextLog_struct, which is used to relay logging
  361.     information to a callback function.  This timer indicates the # of milliseconds that have passed
  362. since the beginning of the log file.
  363.   - Added a method to get and set timeout values for diagnostic and software download operations
  364.      - QLIB_ConfigureTimeOut() = set a timeout value
  365.      - QLIB_GetTimeOut() = get a timeout vlaue
  366.      - QMSL_TimeOutType_Enum = enumeration of timeout values
  367.   - Added a method to stop text logging: QLIB_StopLogging()
  368.   - Added software download debug messages to the text logging
  369.      
  370. 4.19
  371.   - Fixed problems with SW Download pointers not being NULLed out, which caused the reference counters for 
  372.     certain objects to not reach zero and free up threads and handles after SW Download operations.
  373.   - Fixed definitions file to be completely "C" compatible.  There were two places where the syntax 
  374.     was in the C++ format.
  375. 4.18
  376.   - Made some changes to the text logging, to print the logging level at the beginning of each line,
  377.     and to not print the time stamp or logging level to the string buffer that is sent to the asynchronous
  378.     message call back handler.
  379.   - Fixed problem with QLIB_FTM_SET_PATH_DELAY(), which would cause problems with negative numbers.  
  380.     The embedded code is using a 32-bit number for the path delay, even though the documentation shows 
  381. that it should be a 16-bit number.  The decision is to keep the 32-bit number because so much of the
  382. embedded code has already been released.
  383.   - Added QLIB_FTM_LOG_StartFTM_Log(), a function to start logging a specific FTM2 log code.
  384.   - Added QLIB_FTM_LOG_StopFTM_Log(), a function disable logging of a specific FTM2 log code
  385.   - Added QLIB_FTM_LOG_GetNext_Log(), a function to returnly received FTM log report, or
  386.     wait until the next log report occurs.
  387.   - Added QLIB_FTM_TX_RX_FREQ_CAL_SWEEP(), which performs the CDMA & WCDMA TX RX Frequency Sweep.
  388.   - Changed the structure of FTM2LogMessage, so that the data element would be an array, instead of
  389.     a single byte.
  390.   - Removed definitions for 2 NV identifiers:  NV_FTM_MODE_I and NV_ESN_I.
  391.  
  392.   - Fixed the error reporting for the Software Download functions.  Since version 4.15, they have 
  393.     been reporting a pass, even if the function failed.
  394.  
  395.   - Fixed CDMA2000 Non-signaling function.  The functions do not work before due to wrong header.
  396.   - Added functions for managing extended log messages:
  397.      - QLIB_DIAG_AddExtendedLogCode
  398.      - QLIB_DIAG_AddExtendedLogCodes
  399.      - QLIB_DIAG_ClearAllLogCodes
  400.      - QLIB_DIAG_GetSingleLog
  401.      - QLIB_DIAG_GetMultipleLogs
  402.   - Added functions for managing dipswitch settings:
  403.      - QLIB_DIAG_GET_DIPSW_F
  404.      - QLIB_DIAG_SET_DIPSW_F
  405.   - Added EVDO non-signaling functions:
  406.      - QLIB_FTM_EVDO_NS_Start
  407.      - QLIB_FTM_EVDO_NS_Stop
  408.      - QLIB_FTM_EVDO_NS_ClearStatus
  409.      - QLIB_FTM_EVDO_NS_GetStatus
  410.      - QLIB_FTM_EVDO_NS_GetPER
  411.   - Fixed a bug with QLIB_FTM_ENABLE_POLAR_REF_CAL
  412.   - Fixed but with QLIB_DIAG_NV_WRITE_FlushBatchQueue(), in which only the first group of items
  413.     fitting into 1500 bytes would be written.  Also added text log information for better
  414. debugging.
  415.   - Added QLIB_ConfigureLibraryTextLogCallBack(), which is used to configure a call back function for
  416.     text messages generated by the QMSL.  After being registered, this function will be called 
  417. each time a text message is being added to the the text log file.
  418.   - Added QLIB_FTM_HSDPA_BLER_Configure_HS_DSCH_HSET(), a function to simplify the HSET setup for
  419.     HSDPA non-signaling.
  420.   - Made a change to the way that QPHONEMS copies data into the user buffer when QLIB_SendSync is called.
  421.     Ensured that the user buffer will not be overrun, by using the "response buffer size" parameter as
  422. the maximum size of data that will be copied.
  423.   - Fixed a problem with the formation of the diagnostic header in QLIB_EFS2_DIAG_CREATE_LINK()
  424.   - Added QLIB_EFS2_DIAG_EXTENDED_INFO(), a function for querying EFS characteristics
  425.   - Fixed a problem with QLIB_FTM_GSM_BER_GetStatus(), which would result in a memory exception
  426.   - Added QLIB_DIAG_NV_WRITE_BatchQueue_SetRO_List(), a function for setting a list of NV items
  427.     that can be read-only, when the function QLIB_DIAG_NV_WRITE_FlushBatchQueue() processes the
  428. "multiple NV Write" queue
  429.   - Changed some of the data types for FTM_DO_GSM_AUTOCAL() from unsigned to signed values.  This
  430.     affects the max_power, min_power, and power targets.
  431.   - Added QLIB_FTM_DO_GSM_AUTOCAL_GetResults(), a function to return the logged results of the
  432.     function QLIB_FTM_DO_GSM_AUTOCAL().
  433.   - Removed low level WCDMA BER functions, but kept the high level ones
  434.      - QLIB_FTM_WCDMA_START_MODE_REQ
  435.      - QLIB_FTM_WCDMA_STOP_MODE_REQ
  436.      - QLIB_FTM_WCDMA_START_IDLE_MODE_REQ
  437.      - QLIB_FTM_WCDMA_ACQUIRE_REQ
  438.      - QLIB_FTM_WCDMA_RMC_DCH_SETUP_REQ
  439.   - Removed low level GSM BER functions, but kept the high level ones
  440.      - QLIB_FTM_GSM_START_MODE_REQ
  441.      - QLIB_FTM_GSM_SELECT_SPECIFIC_BCCH_REQ
  442.      - QLIB_FTM_GSM_START_IDLE_MODE_REQ
  443.      - QLIB_FTM_GSM_CONFIG_LOOPBACK_TYPE_REQ
  444.      - QLIB_FTM_GSM_CHANNEL_ASSIGN_REQ
  445.      - QLIB_FTM_GSM_BER_CHANNEL_ASSIGN_V2_REQ
  446.      - QLIB_FTM_GSM_CHANNEL_RELEASE_REQ
  447.      - QLIB_FTM_GSM_STOP_GSM_MODE_REQ
  448.   - Added QLIB_FTM_WCDMA_BER_GetEventStatus(), an alternative to QLIB_FTM_WCDMA_BER_GetStatus(), which
  449.     returns only status for a single event, rather than the entire WCDMA BER Status structure.
  450.   - Added QLIB_FTM_GSM_BER_GetEventStatus(), an alternative to QLIB_FTM_GSM_BER_GetStatus(), which
  451.     returns only status for a single event, rather than the entire GSM BER Status structure.
  452.   - Fixed a bug with, QLIB_ConnectServerWithWait(), so that now if a valid phone is not found within the
  453.     specified time-out then the return value of the resource context is NULL.
  454.   - Added MediaFLO commands:
  455. - QLIB_FTM_MF_GET_RSSI_CAL_POINT
  456. - QLIB_FTM_MF_GET_RX_RSSI
  457. - QLIB_FTM_MF_GET_AGC_STATE
  458. - QLIB_FTM_MF_WRITE_CAL_DATA
  459. - QLIB_FTM_MF_LNA_SELECT
  460. - QLIB_FTM_MF_RF_SWITCH_CONFIG
  461. - QLIB_FTM_MF_SYNTH_LOCK
  462. - QLIB_FTM_MF_SET_GAIN_STATE
  463. - QLIB_FTM_MF_TUNE_PLL
  464. - QLIB_FTM_MF_GET_IM2
  465.   - Changed the maximum number of simultaneous QMSL connections to 50.
  466.   - Added QLIB_FTM_CDMA2000_NS_Get_FCH_SER_FER(), a function for getting cdma2000 FCH Symbols errors and
  467.     frame errors.
  468. - Fixed QLIB_FTM_GET_ALL_HDET_FROM_TX_SWEEP_CAL() bug
  469. - Added BC14 in QLib_Defines.h for calibration support
  470. - Changed QLIB_FTM_DETECT_COMMAND_CODE header, command code will be returned in parameter list
  471. 4.17
  472.   - Fixed 3 problems with the SW Download Upload QCN file function:
  473.     1. The ignoreModelNumber flag was not being followed correctly.  If the flag was set, 
  474.        the function would still fail if the QCN model did not match the current phone model.
  475.     2. If a callback function was not regsitered for download events, a crash would occur
  476.        because the callback pointer was not initialized to NULL.
  477.     3. If the autoRestore flag was set to false, the final completion event would not be detected.
  478.   - Added implementation back in for QLIB_FTM_EGPRS_BER_StartIdleMode().  It had been removed
  479.     because functionality was merged with QLIB_FTM_EGPRS_BER_AssignBCCH().  After further
  480. review, decided that it should be made available anyways.
  481.   - Changed the FTM Command ID for QLIB_FTM_SET_DVGA_OFFSET, from 112 to 111.  This problem resulted 
  482.     as an incorrect value in an older version of the cdma2000 FTM commands, CL93-V4168-1.
  483.   - Changed the event handler for extended messages to not prepare the text log string, unless 
  484.     logging is enabled
  485.   - Fixed some spellings for the text log messages for QLIB_DIAG_MEMORY_PEEK_F, QLIB_DIAG_MEMORY_PEEK_F, 
  486.     and QLIB_DIAG_SetMessageFilter.
  487.   - Changed the data type for the iDelay parameter in QLIB_FTM_SET_PATH_DELAY to be a signed 
  488.     "short," instead of an "unsigned short"
  489.   - Added 2 functions for transferring PRL files:
  490.       - QLIB_DownloadPRL() to copy PRL from phone to PC
  491.       - QLIB_UploadPRL() to copy PRL from PC to phone
  492.   - Changed the path for all binaries to be HTECommonQLibBIN
  493.   - Changed the name of the binaries as follows:
  494.      
  495.      MSVC 6.0 Release DLL
  496.  ----------------------
  497.      QMSL_MSVC6R.Lib  
  498.      QMSL_MSVC6R.DLL 
  499.  QMSL_Demo_MSVC6R.exe
  500.      MSVC 6.0 Debug  DLL
  501.  ----------------------
  502.      QMSL_MSVC6D.Lib 
  503.      QMSL_MSVC6D.DLL
  504.  QMSL_Demo_MSVC6D.exe
  505.      MSVC 7.0 (.NET) Release DLL
  506.  ----------------------
  507.      QMSL_MSVC7R.Lib  
  508.      QMSL_MSVC7R.DLL 
  509.  QMSL_Demo_MSVC7R.exe
  510.      MSVC 7.0 (.NET) Debug DLL
  511.  ----------------------
  512.      QMSL_MSVC7D.Lib  
  513.      QMSL_MSVC7D.DLL 
  514.  QMSL_Demo_MSVC7D.exe
  515.      MSVC 7.0 (.NET) Release Static Library
  516.  ----------------------
  517.      QMSL_MSVC7R-Static.Lib 
  518.      MSVC 7.0 (.NET) Debug Static Library
  519.  ----------------------
  520.      QMSL_MSVC7D-Static.Lib 
  521. 4.16
  522.   - Changed the iDelay parameter of QLIB_FTM_SET_PATH_DELAY, from "unsigned short*"
  523.     to "unsigned short"
  524.   - Changed the iRSB_A and iRSB_B parameters in QLIB_FTM_DO_CALPATH_RSB from "unsigned short"
  525.     to "unsigned short*"
  526.   - Increased the timout value for error checking of send function, from 200ms to 300ms.  This 
  527.     does not change the timeout of the UART, only the amount of time that is allowed the pass 
  528. when writing data to the UART, before an error is triggered.  The change was needed
  529. because testing of the HP USB/UART converter shows that some write commands took more than
  530. 200ms to execute.
  531.   - Implemented QLIB_FTM_SET_RF_POWER_MODE for 1x Intelliceiver Calibration
  532.   - Fixed EVDO Non-signaling command bugs
  533.   - Completed testing of External Polar Calibration Support:
  534. - QLIB_FTM_BASEBAND_BW_CAL
  535. - QLIB_FTM_SET_OPLL_BW
  536. - QLIB_FTM_SET_TWOTONE_FREQ_OFFSET
  537. - QLIB_FTM_SET_PATH_DELAY
  538.   - Added and tested EGPRS non-signaling commands:
  539. - QLIB_FTM_EGPRS_BER_AssignBCCH
  540. - QLIB_FTM_EGPRS_BER_StartIdleMode
  541. - QLIB_FTM_EGPRS_BER_Configure_DL_TBF
  542. - QLIB_FTM_EGPRS_BER_Configure_UL_TBF
  543. - QLIB_FTM_EGPRS_BER_Establish_SRB_LOOPBACK
  544. - QLIB_FTM_EGPRS_BER_Release_All_TBF
  545. - QLIB_FTM_EGPRS_BER_ClearStatus
  546. - QLIB_FTM_EGPRS_BER_GetStatus
  547. - QLIB_FTM_EGPRS_BER_GetRxMetrics
  548.   - Added HSDPA non-signaling commands, but have not tested yet:
  549. - QLIB_FTM_HSDPA_BER_StartSession
  550. - QLIB_FTM_HSDPA_BLER_Reconfigure_HS
  551. - QLIB_FTM_HSDPA_BLER_Configure_PDSCH
  552. - QLIB_FTM_HSDPA_BLER_Configure_HS_SCCH
  553. - QLIB_FTM_HSDPA_BLER_Configure_HS_DSCH
  554. - QLIB_FTM_HSDPA_BLER_Configure_HS_DPCCH
  555. - QLIB_FTM_HSDPA_BER_ClearStatus
  556. - QLIB_FTM_HSDPA_BER_GetStatus
  557. - QLIB_FTM_HSDPA_BER_StopSession
  558.   - Made extended messages be automatically printed to the QMSL text log, at the LOG_FN level.
  559.   - Added an enumeration to QLib_Defines.h, for the GSM Tx data source type: FTM_GSM_TX_DataSources_Enum
  560.   - Fixed problem with DIAG_NV_WRITE_FlushBatchQueue() and QLIB_DIAG_NV_WRITE_SetBatchMode().  
  561.     After the batch queue is flushed, the NV mode should go back to single instead of batch, 
  562. but it was not doing that.
  563.   - Added feature so that the async call-back will be called when a debug text message is 
  564.     generated by the library.  The async messsage will look like a log messsage (CMD_CODE=16)
  565. with a log_item value of QLIB_TEXT_LOG_CODE (0xFFFF).  The structure for the log 
  566. data is defined by QMSL_TextLog_struct, in QLib_Defines.h
  567.   - Fixed a bug, which could happen while parsing extended messages and the text size is less than the 
  568.     file name size.
  569.   - Added support for QLIB_FTM_CAMERA_SET_SENSOR_ID(), the method for switching between cameras.
  570.   - Added QLIB_FTM_WCDMA_BER_Handover_V2B, a function which handles all of the parameters for the
  571.     handover.  The existing function QLIB_FTM_WCDMA_BER_Handover_V2 does not allow a couple of the 
  572. more obscure values to be changed.
  573.   - Completed testing of the HSDPA BER functions.
  574. 4.15
  575.   - Added the new FTM audio devices for the function QLIB_FTM_AUDIO_SET_PATH()
  576. 16 = SND_DEVICE_FTM_HANDSET
  577. 17 = SND_DEVICE_FTM_HEADSET
  578. 18 = SND_DEVICE_FTM_SPEAKER
  579. 19 = SND_DEVICE_FTM_CARKIT
  580.   - Added QLIB_UploadCEFS_File2(), a function to upload a CEFS file when the phone
  581.     is in download mode, by specifying the ARMPROG ID to be used.
  582.   - Added QLIB_DownloadCEFS_File(), a function to create a CEFS file on the PC, based
  583.     on the mobile's EFS system.
  584.   - Implemented polar calibration commands, but have not finished testing them yet:
  585.     QLIB_FTM_DO_GSM_AUTOCAL
  586.     QLIB_FTM_SET_PATH_DELAY
  587.     QLIB_FTM_ENABLE_POLAR_REF_CAL
  588.     QLIB_FTM_SET_TWOTONE_FREQ_OFFSET
  589.     QLIB_FTM_DO_CALPATH_RSB
  590.     QLIB_FTM_SET_OPLL_BW
  591.     QLIB_FTM_BASEBAND_BW_CAL
  592.   - Completed addition of 1x-EVDO RF commands for RF Cal.
  593. 4.13
  594.   - Included changes made by Robert Tomaszewski for improved support for 
  595.     sending Start/Stop bytes requires for Download Mode
  596.     - added additional argument bStartFlag to QLIB_SendAsync() 
  597.   0 - send data as it is,
  598.   1 - add start/stop bytes to the original data package,
  599. - added function QLIB_SetStartFlag() to tell SendAsync() and others functions which send data
  600.   if it has to add or not start/stop bytes
  601.     That functionality works only in QPhoneMS mode.
  602.   - Added support for other RF modes:
  603. - WCDMA800A, WCDMA1800, MediaFlo
  604.   - Added a feature to automatically create a log file when a file named "QMSL_auto_start_log.txt", 
  605.     exists in the executable folder.  If the file exists, then text data will automatically be logged
  606. to the file "QMSL_Log.txt" in the same folder using the log flags of 0x03 (LOG_FN and LOG_IO).
  607. 4.12
  608.    - Migrated QLIB into QMSL.  Archived the version comments and removed them from this file.
  609. endcode  
  610. note   
  611. Compiler:  Microsoft Visual C++ v6.0 SP4  
  612. *******************************************************************************/
  613. #if !defined(_QLIB_H)
  614. #define _QLIB_H
  615. #include "windows.h"
  616. /**
  617. Establish whether the library is being compiled into a DLL (exporting),
  618. or being included from a client (importing)
  619. When the DLL is built, then QLIB_EXPORTS should be defined
  620. */
  621. #ifdef QLIB_EXPORTS
  622. #define QLIB_API __declspec(dllexport)
  623. #else
  624. #define QLIB_API __declspec(dllimport)
  625. #endif
  626. #if defined(QLIB_STATIC)
  627. #undef QLIB_API
  628. #define QLIB_API
  629. //#define QLIB_API __cdecl
  630. #endif
  631. #ifdef __cplusplus
  632. extern "C" {
  633. #endif 
  634. /******************************************************************************
  635. Callback function definitions
  636. *******************************************************************************/
  637. #if !defined(DIAG_FS_MAX_FILENAME_LEN)
  638. #define DIAG_FS_MAX_FILENAME_LEN      80 /* Specified by EFS2              */
  639. #define DIAG_FS_MAX_PATHNAME_LEN     128 /* Specified by EFS2              */
  640. #endif
  641. #define QLIB_EFS_MAX_FILENAME_LEN DIAG_FS_MAX_PATHNAME_LEN
  642. //! Call back for an EFS directory element 
  643. typedef unsigned char( *EfsDirCB ) 
  644. char name[QLIB_EFS_MAX_FILENAME_LEN],  //defined in DiagEfsPkt.h
  645. unsigned char isFile,
  646. //attributes follow below
  647. unsigned short iAttributeMask,
  648. unsigned char iBufferingOption,
  649. unsigned char iCleanupOption,
  650. unsigned long iCreateDate,
  651. unsigned long iFileSize,
  652. HANDLE hContextID
  653. );
  654. /**
  655. Call back for EFS functions
  656. */
  657. typedef unsigned char (*EfsFileTransferCB)
  658.         (
  659.          char srcname[512],
  660.          char dstname[512],
  661.          int oper,
  662.          int suboper,
  663.          unsigned long bytestransferred,
  664.          unsigned long filesize,
  665.  HANDLE hContextID
  666. );
  667. /**
  668. Call back for general SW Download event( replaces the other non-EFS call backs)
  669. Optional for NV backup/restore and normal download.  Must be used for boot loader and
  670. multimage download
  671. */
  672. typedef unsigned char( *generalSWDownloadCB ) 
  673. (
  674. unsigned char* pEventStructure // type union generalSwDownloadEvent_union, as defined in SoftwareDownload.h
  675. // Not declared explicitly here because general users do not need to 
  676. // include the SWDownload.h file.
  677. );
  678. /**
  679. Call back for receipt of async messages
  680. Optional for NV backup/restore and normal download.  Must be used for boot loader and
  681. multimage download
  682. param iMessageSize = number of bytes in the message
  683. param pMessageBuffer = pointer to a buffer of memory with the message.  This must be copied by the
  684.                         user because after the call back is called, the buffer can be changed at
  685. any time
  686. param hContextID = the same context ID used for function calls on a certain COM port.
  687. */
  688. typedef void( *asyncMessageCB ) 
  689. (
  690. unsigned short iMessageSize,
  691. unsigned char* iMessageBuffer,
  692. HANDLE hContextID
  693. );
  694. /**
  695. Call back for user-defined send (PC to mobile) function.  
  696. To be used with QLIB_ConnectServer_UserDefinedTransport()
  697. param hQMSL_ContextID = the QMSL that is associated with the connection. 
  698. param hUserContextID = the context ID that was passed to QLIB_ConnectServer_UserDefinedTransport()
  699. param iRequestSize = Number of bytes to be sent in the request packet.
  700. param piRequestBytes = Pointer to a buffer of request packet contents.
  701. param piActualWriteSize = to be updated by the user function, the actual # of bytes that were written
  702. return 0 if successful (ERROR_SUCCESS) otherwise, an error code as defined by WINERR.H error codes,
  703.           usually the value of ::GetLastError
  704.      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp
  705. */
  706. typedef unsigned long( *userDefinedSend ) 
  707. (
  708. HANDLE hQMSL_ContextID,
  709. HANDLE hUserContextID,
  710. unsigned long iRequestSize,
  711. unsigned char* piRequestBytes,
  712. unsigned long* piActualWriteSize
  713. );
  714. /**
  715. Call back for user-defined receive (from mobile to PC) function.  
  716. To be used with QLIB_ConnectServer_UserDefinedTransport()
  717. param hQMSL_ContextID = the QMSL that is associated with the connection. 
  718. param hUserContextID = the context ID that was passed to QLIB_ConnectServer_UserDefinedTransport()
  719. param iRequestSize = Number of bytes to be sent in the request packet.
  720. param piRequestBytes = Pointer to a buffer of request packet contents.
  721. param piResponseSize = Pointer to number of bytes received in the response packet
  722. NOTE: when calling this function, the value must be equal to the
  723. maximum size of the receive buffer.  When the function returns, the
  724. value will be the actual number of bytes filled into the receive buffer.
  725. param iResponseBytes = Pointer to a buffer to store the response packet contents.
  726. return 0 if successful (ERROR_SUCCESS) otherwise, an error code as defined by WINERR.H error codes,
  727.           usually the value of ::GetLastError
  728.      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp
  729. */
  730. typedef unsigned long( *userDefinedReceive ) 
  731. (
  732. HANDLE hQMSL_ContextID,
  733. HANDLE hUserContextID,
  734. unsigned long* piResponseSize,
  735. unsigned char* piResponseBytes
  736. );
  737. /**
  738. Call back for user-defined function to flush Tx and Rx buffers.
  739. param hQMSL_ContextID = the QMSL that is associated with the connection. 
  740. param hUserContextID = the context ID that was passed to QLIB_ConnectServer_UserDefinedTransport()
  741. return 0 if successful (ERROR_SUCCESS) otherwise, an error code as defined by WINERR.H error codes,
  742.           usually the value of ::GetLastError
  743.      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/system_error_codes__0-499_.asp
  744. */
  745. typedef unsigned long( *userDefinedFlushTxRx ) 
  746. (
  747. HANDLE hQMSL_ContextID,
  748. HANDLE hUserContextID
  749. );
  750. /******************************************************************************
  751. Connection/Disconnection Functions
  752. *******************************************************************************/
  753. /******************************************************************************/
  754. /**
  755. Connect the server to a certain COM port number
  756. param iComPort = COM port number to use for communication with phone.
  757. This does not open the COM port at the operating system
  758. level until a call is made to the embedded target.
  759. For auto detection, the COM port passed in can be
  760. QLIB_COM_AUTO_DETECT, and the first attached phone will 
  761. be used automatically.
  762. return HANDLE to use for all subsequent QLIB calls that require a handle.  
  763.         If NULL, then no valid phone was found.
  764. *******************************************************************************/
  765. QLIB_API HANDLE QLIB_ConnectServer( unsigned int iComPort );
  766. /******************************************************************************/
  767. /**
  768. Connect the server to a certain COM port number
  769. param iComPort = COM port number to use for communication with phone.
  770. This does not open the COM port at the operating system
  771. level until a call is made to the embedded target.
  772. For auto detection, the COM port passed in can be
  773. QLIB_COM_AUTO_DETECT, and the first attached phone will 
  774. be used automatically.
  775. param iWait_ms = # of milliseconds to wait before an error is considered.
  776. return HANDLE to use for all subsequent QLIB calls that require a handle.  
  777.         If NULL, then no valid phone was found.
  778. *******************************************************************************/
  779. QLIB_API HANDLE QLIB_ConnectServerWithWait( unsigned int iComPort, unsigned long iWait_ms );
  780. /******************************************************************************/
  781. /**
  782. Connect to a specified logical port number.  Before this function is called, 
  783. a logical<-->physical mapping must be created using the function: QLIB_AddPortAliasEntry()
  784. param iLogicalPort = Logical number to create a connection for.
  785. return void 
  786. *******************************************************************************/
  787. QLIB_API HANDLE QLIB_ConnectServer_LogicalPort( unsigned int iLogicalPort );
  788. /******************************************************************************/
  789. /**
  790. Setup a connection using a user-defined transport layer.  The user defined transport
  791. consists of three functions--one to send data, another to receive data, and the last
  792. to flush the Rx buffer.  
  793. These functions will be called by QMSL when QMSL needs to access the physical layer.
  794. The user also has the option of having QMSL to handle the HDLC formatting (including CRC)
  795. seperately for the send and receive packets.
  796.   Before calling this function, the communication channel should be already established
  797. so that QMSL can make calls to the user functions immediately.
  798. Until DisconnectServer() is called, a background thread will be running to continually
  799. read the COM port and check for received data.
  800. This function will automatically set the library into 'QPHONEMS' mode by calling 
  801. QLIB_SetLibraryMode() with a parameter of FALSE.  The user-defined mode is a sub
  802. mode of the the internal engine, QPHONEMS.
  803.  
  804. param hUserHandle = User defined handle, to be passed when the send or receive functions are called.
  805. This value can be any number except for -1 (0xFFFF).  When QLIB_GetComPortNumber()
  806. is called, this value will be returned.
  807. param pUserDefinedSend = User send function, to be called when QMSL will send data to the mobile
  808. param pUserDefinedReceive = User defined receive function, to be called when QMSL will receive data 
  809.                              from the mobile
  810. param pUserDefinedFlushRx = user defined function to flush the rx buffer
  811. param bQMSL_HandlesTxHDLC = TRUE if QMSL is to handle the HDLC tasks when sending a packet,
  812.                              including escape sequences, CRC, and trailing flag.
  813. param bQMSL_HandlesRxHDLC = TRUE if QMSL is to handle the HDLC tasks when receiving a packet, 
  814.  including escape sequences, CRC, and trailing flag.
  815. return void 
  816. *******************************************************************************/
  817. QLIB_API HANDLE QLIB_ConnectServer_UserDefinedTransport( 
  818. HANDLE hUserHandle,
  819. userDefinedSend pUserDefinedSend,
  820. userDefinedReceive pUserDefinedReceive,
  821. userDefinedFlushTxRx pUserDefinedFlushRx,
  822. unsigned char bQMSL_HandlesTxHDLC,
  823. unsigned char bQMSL_HandlesRxHDLC
  824. );
  825. /******************************************************************************/
  826. /**
  827. Pause the receive thread for a specific device context.  This can only be used
  828. when the library is in the QPHONEMS mode, and the sub-mode of user
  829. defined transport layer mode.
  830. This function can be used to prevent QMSL from accessing the COM port during the
  831. time that the operation is paused.
  832. Call QLIB_ResumeDataReceive() to resume operation
  833. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  834. return true if successful, false if failure.
  835. *******************************************************************************/
  836. QLIB_API unsigned char QLIB_PauseDataReceive( HANDLE hResourceContext );
  837. /******************************************************************************/
  838. /**
  839. Resumes receive operations that were paused by calling QLIB_PauseDataReceive().
  840. This can only be used when the library is in the QPHONEMS mode, and the sub-mode, 
  841. of user defined transport layer mode.
  842. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  843. return true if successful, false if failure.
  844. *******************************************************************************/
  845. QLIB_API unsigned char QLIB_ResumeDataReceive( HANDLE hResourceContext );
  846. /******************************************************************************/
  847. /**
  848. Disconnect the server and close the COM port associated with the server.
  849. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  850. return void 
  851. *******************************************************************************/
  852. QLIB_API void QLIB_DisconnectServer( HANDLE hResourceContext );
  853. /******************************************************************************/
  854. /**
  855. Disconnects all servers and closes the COM ports associated with those server.
  856. Normally, this function does not need to be called, because a call to 
  857. QLIB_DisconnectServer() can be done for each reasource that is opened. 
  858. This function is to be used for cases when multiple connections are made to different
  859. COM ports during the lifetime of the application, or in the case of emergency/exception
  860. shut down.
  861. return void 
  862. warning All handles will be invalid after this function is called.
  863. *******************************************************************************/
  864. QLIB_API void QLIB_DisconnectAllServers( void );
  865. /******************************************************************************/
  866. /**
  867. Uses the port list in the system registry to determine which COM ports are available
  868. on the PC and returns the information via iNumPorts and pPortList.  This function
  869. is only tested on Windows XP.
  870. param iNumPorts = input/output, The input value is the maximum number of entries that
  871.    can be added to the pPortList array.  The output value is updated to 
  872.    reflect how many valid ports were found on the system.  
  873. param pPortList = output, byte array.  Each byte indicates a COM port number that is 
  874.                    available on the system.
  875. return true if operation was able to complete successfully and at least one
  876.         valid port is found.
  877. *******************************************************************************/
  878. QLIB_API unsigned char QLIB_GetAllPortList( unsigned short* iNumPorts, unsigned short* pPortList  );
  879. /******************************************************************************/
  880. /**
  881. Uses GetAllPortList() to determine which ports have phones available, then uses
  882. attempts a connection on each of the ports returned.
  883. param iNumPorts = input/output, The input value is the maximum number of entries that
  884.    can be added to the pPortList array.  The output value is updated to 
  885.    reflect how many valid ports were found on the system.  
  886. param pPortList = output, unsigned char array.  Each unsigned char indicates a COM port number that is 
  887.                    available on the system.
  888. param iNumIgnorePorts = # of ports in the "ignore port list."  Zero to check all ports
  889. param pIgnorePortList = a list of port numbers that are to be ignored.  This can speed up
  890.                          the auto detection of ports.
  891. return true if operation was able to complete successfully and at least one
  892.         valid port is found.
  893. warning 1) this function will take about 1 second for each port that is on the system 
  894.          2) All connections will be closed before searching begins.
  895. *******************************************************************************/
  896. QLIB_API unsigned char QLIB_GetAvailablePhonesPortList( 
  897. unsigned short* iNumPorts, unsigned short* pPortList,
  898. unsigned short iNumIgnorePorts, unsigned short* pIgnorePortList );
  899. /******************************************************************************/
  900. /**
  901. Returns the COM port number associated with a specific resource context.  This
  902. can be used to determine the COM port number for a phone that was connected
  903. to automatically.
  904. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  905. param piPhysicalPort = output, physical port number, such as a 6 for COM6
  906. return true if COM port could be determined successfully
  907. *******************************************************************************/
  908. QLIB_API unsigned char QLIB_GetComPortNumber(HANDLE hResourceContext , unsigned short* piPhysicalPort );
  909. /******************************************************************************/
  910. /**
  911. Clears the port alias list.  
  912. The port alias list is a method for mapping a logical port number to a physical
  913. port number.  This allows users to respond to a situation in which USB ports
  914. are mapped to unique numbers, depending on which devices have been installed in 
  915. the past.
  916. An example of a port alias list:
  917.     Logical    Physical
  918.    Port       Port
  919. -------    --------
  920.    1         COM7
  921.    2         COM19
  922.    3         COM6
  923.    4         COM30
  924. The port mapping process can be facilitated by the GetAvailablePhonesPortList() 
  925. function, which returns a list of which ports have a phone installed.  A "calibration"
  926. procedure could be setup, which tells the user to plug one phone into a port, then
  927. records which port the phone is in, then instructs them to plug the phone into the
  928. next USB port, and so on.
  929. During this procedure, the user software would create a logical list of ports 
  930. (like 1,2,3,4) and remember which physical COM port number is associated with 
  931. each logical port.  It is the user's (user of QLIB) responsibility to store this
  932. association in a persistant way (such as the registry or INI file), then when 
  933. their software starts up the software would first call ClearPortAliasList(),
  934. then call AddPortAliasEntry() for each logical/physical port association.
  935. NOTE: It is not necessary to ClearPortAliasList(), if not alias have been created
  936.       in the current run-time session.  In other words, the alias list is empty
  937.   by default, and is only filled in by users of QLIB.
  938. After that, they could call the QLIB_ConnectServer_LogicalPort() function, to
  939. connect to a logical port number that has been configured.
  940. return true if port alias list is successfully cleared.
  941. *******************************************************************************/
  942. QLIB_API unsigned char QLIB_ClearPortAliasList( void );
  943. /******************************************************************************/
  944. /**
  945. Add an entry to the port alias list.  This function should be called once for
  946. each logical/physical port association.
  947. See ClearPortAliasList() for more information about port aliasing
  948. param iLogicalPort = logical port number, user defined number
  949. param iPhysicalPort = physical port number, such as a 6 for COM6
  950. return true if port alias is successfully updated.
  951. *******************************************************************************/
  952. QLIB_API unsigned char QLIB_AddPortAliasEntry(unsigned short iLogicalPort, unsigned short iPhysicalPort );
  953. /******************************************************************************/
  954. /**
  955. Configures call back functions.
  956. If one of the pointers is NULL, then the call back will be disabled for
  957. that call back type.
  958. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  959. param pEfsDirCallback   = Callback for the EfsDirectory() operation
  960. param pGeneralSwDownloadCB = Callback for download events
  961. param pAsyncMessageCB = Callback for filtering async messages
  962. return None
  963. *******************************************************************************/
  964. QLIB_API void QLIB_ConfigureCallBacks
  965. (
  966. HANDLE hResourceContext,
  967. EfsDirCB pEfsDirCallback,
  968. generalSWDownloadCB pGeneralSwDownloadCB,
  969. asyncMessageCB pAsyncMessageCB
  970. );
  971. /******************************************************************************/
  972. /**
  973. Configures EFS2 call back functions.
  974. If one of the pointers is NULL, then the call back will be disabled for
  975. that call back type.
  976. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  977. param pEfsCallback = Callback for general EFS2 operations
  978. param EfsDirCB = Callback for EFS Directory operations
  979. return None
  980. *******************************************************************************/
  981. QLIB_API void QLIB_ConfigureEfs2CallBacks
  982. (
  983. HANDLE hResourceContext,
  984. EfsFileTransferCB pEfsCallback,
  985. EfsDirCB pEfsDirCB
  986. );
  987. /******************************************************************************/
  988. /**
  989. Configure Library Text Message call back function.
  990. The library text message call back is called each time a text message is printed
  991. to the log file.  The call back structure will contain the message level (e.g. LOG_IO
  992. or LOG_FN), and the NULL-terminated string containing the message text.
  993. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  994. param pAsyncMessageCB = Callback for library generated text messages. The "unsigned char*" pointer
  995.                          will be of the structure type: QMSL_TextLog_struct, defined in QLib_Defines.h
  996.  Specify a NULL value to disable this callback.
  997. return None
  998. *******************************************************************************/
  999. QLIB_API void QLIB_ConfigureLibraryTextLogCallBack
  1000. (
  1001. HANDLE hResourceContext,
  1002. asyncMessageCB pAsyncMessageCB
  1003. );
  1004. /******************************************************************************/
  1005. /**
  1006. Configures a specific timeout value.
  1007. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1008. param eTimeOutId = Identifier index of timeout to change, index defined by 
  1009.                     QMSL_TimeOutType_Enum in QLibDefines.h 
  1010. param iNewValue_ms = number of millseconds for timeout value
  1011. return None
  1012. *******************************************************************************/
  1013. QLIB_API unsigned char QLIB_ConfigureTimeOut
  1014. (
  1015. HANDLE hResourceContext,
  1016. unsigned long eTimeOutId,
  1017. unsigned long iNewValue_ms
  1018. );
  1019. /******************************************************************************/
  1020. /**
  1021. Get a specific timeout value.
  1022. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1023. param eTimeOutId = Identifier index of timeout to change, index defined by 
  1024.                     QMSL_TimeOutType_Enum 
  1025. return timeout value in milliseconds
  1026. return None
  1027. *******************************************************************************/
  1028. QLIB_API unsigned long QLIB_GetTimeOut( HANDLE hResourceContext, unsigned long eTimeOutId );
  1029. /******************************************************************************/
  1030. /**
  1031. CDMA ICD, 3.4.123 Diagnostic Protocol Loopback Request/Response
  1032. Pings the phone using the diagnostic command DIAG_PROTOCOL_LOOPBACK_F.
  1033. Additionally verifies the connection using the dignostic version command DIAG_VERNO_F.
  1034. This command has a timeout value that can be checked or modified using the identifier
  1035. QMSL_Timeout_IsPhoneConnected when calling QLIB_ConfigureTimeOut() or QLIB_GetTimeOut()
  1036. The default timeout is 200ms, so that as little time as possible will be spent to wait
  1037. for a phone request in the event that a phone is not present.  Other diagnostic functions
  1038. use a longer timeout, so this function is the only one that should be called until a 
  1039. phone is verified to be on a certain COM port.
  1040. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1041. return Returns true if the phone is connected, false if it is not connected
  1042. *******************************************************************************/
  1043. QLIB_API unsigned char QLIB_IsPhoneConnected(HANDLE hResourceContext );
  1044. /******************************************************************************/
  1045. /**
  1046. CDMA ICD, 2.1.2 Asynchronous data protocol
  1047. Sends a request/response packet.  This allows the user to send any diagnostic
  1048. or FTM command that is available in the protocol documents.
  1049. The request and response packets will be formatted properly for HDLC transmission.
  1050. This function can also be used to send packets to access new FTM functionality
  1051. that is added before the PC library is updated to support that new function
  1052. directly.
  1053. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1054. param iRequestSize = Number of bytes to be sent in the request packet.
  1055. param piRequestBytes = Pointer to a buffer of request packet contents.
  1056. param piResponseSize = Pointer to number of bytes received in the response packet
  1057.                         NOTE: when calling this function, the value must be equal to the
  1058. maximum size of the receive buffer.  When the function returns, the
  1059. value will be the actual number of bytes filled into the receive buffer.
  1060. param iResponseBytes = Pointer to a buffer to store the response packet contents.
  1061. param iTimeout = Number of milliseconds to wait for a timeout.  
  1062. return Returns true if the first byte of the response packet matches
  1063.         the first byte of the request packet, false if it the phone is
  1064. not connected or the first bytes of request and response packets
  1065. do not match.
  1066. *******************************************************************************/
  1067. QLIB_API unsigned char QLIB_SendSync
  1068. (
  1069. HANDLE hResourceContext, 
  1070. short iRequestSize,
  1071. unsigned char* piRequestBytes,
  1072. short* piResponseSize,
  1073. unsigned char* piResponseBytes,
  1074. unsigned long iTimeout
  1075. );
  1076. /******************************************************************************/
  1077. /**
  1078. Sends a asynchronous packet.  Unlike SendSync, this command does not wait for a
  1079. response packet from the phone.
  1080. This command is only usable when the phone is in QPHONEMS mode, not QPST mode
  1081. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1082. param iRequestSize = Number of bytes to be sent in the request packet.
  1083. param piRequestBytes = Pointer to a buffer of request packet contents.
  1084. param iTimeout = Number of milliseconds to wait for a timeout.
  1085. param bStartFlag = 0 - SendASync will send data as it is, 1 - SendASync will add Start and Stop bytes
  1086. return Returns true if the send operation completes successfully.
  1087. *******************************************************************************/
  1088. QLIB_API unsigned char QLIB_SendASync
  1089. (
  1090. HANDLE hResourceContext, 
  1091. unsigned short iRequestSize,
  1092. unsigned char* piRequestBytes,
  1093. unsigned long iTimeout,
  1094. unsigned char bStartFlag
  1095. );
  1096. /******************************************************************************/
  1097. /**
  1098. Sets mode for Send
  1099. This command is only usable when the phone is in QPHONEMS mode, not QPST mode
  1100. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1101. param bStartFlag = 0 - Send will send data as it is, 1 - Send will add Start and Stop bytes
  1102. return Returns last status of StartFlag
  1103. *******************************************************************************/
  1104. QLIB_API unsigned char QLIB_SetStartFlag
  1105. (
  1106. HANDLE hResourceContext, 
  1107. unsigned char bStartFlag
  1108. );
  1109. /******************************************************************************/
  1110. /**
  1111. Sends RAW data.  This allows the user to send any AT 
  1112. command that is available in the protocol documents.
  1113. The message will not be formatt in any way. The user should format message correclty.
  1114. (i.e. AT commant finished with "r" and close string with "")
  1115. This command is only usable when the phone is in QPHONEMS mode, not QPST mode.
  1116. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1117. param iRequestSize = Number of bytes to be sent in the request packet.
  1118. param piRequestBytes = Pointer to a buffer of request packet contents.
  1119. param piResponseSize = Pointer to number of bytes received in the response packet
  1120.                         NOTE: when calling this function, the value must be equal to the
  1121. maximum size of the receive buffer.  When the function returns, the
  1122. value will be the actual number of bytes filled into the receive buffer.
  1123. param iResponseBytes = Pointer to a buffer to store the response packet contents.
  1124. param iTimeout = Number of milliseconds to wait for a timeout.  
  1125. return Returns true response message received, false if it the phone is
  1126. not connected or the time delay has run out.
  1127. *******************************************************************************/
  1128. QLIB_API unsigned char QLIB_SendRAW
  1129. (
  1130. HANDLE hResourceContext, 
  1131. short iRequestSize,
  1132. unsigned char* piRequestBytes,
  1133. short* piResponseSize,
  1134. unsigned char* piResponseBytes,
  1135. unsigned long iTimeout
  1136. );
  1137. /******************************************************************************/
  1138. /**
  1139. Sets packet mode for sending Diagnostic, FTM or RAW data.
  1140. This function sets both phone and Qlib to send data either in Diagnostic or RAW mode.
  1141. This command is only usable when the phone is in QPHONEMS mode, not QPST mode
  1142. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1143. param iPacketMode = QLIB_PacketMode_BothDiag = 0 - both Qlib and phone in Diagnostic/FTM command mode
  1144. (sending Diagnostic/FTM commands via Diagnostic COM port to phones Diagnostic port),
  1145. used to send diagnostic commands via serial cable or diagnostic COM port on USB cable
  1146. QLIB_PacketMode_BothAT = 1 - both Qlib and phone in Data/AT command mode
  1147. (sending AT commands via Diagnostic COM port to phones Diagnostic port),
  1148. used to send AT comands via serial cable
  1149. QLIB_PacketMode_LibAT = 2 - Qlib in Data/At command mode and phone as it is
  1150. (sending AT commands via Diagnostic COM port to phones modem port)
  1151. used to send AT commands via modem COM port on USB cable
  1152. return Returns true if mode switched, false if phone was not connectedor failed switching modes
  1153. *******************************************************************************/
  1154. QLIB_API unsigned char QLIB_SetPacketMode
  1155. (
  1156. HANDLE hResourceContext, 
  1157. unsigned char iPacketMode
  1158. );
  1159. /******************************************************************************/
  1160. /**
  1161. Streaming Download ICD, 3.2.1 19 Hello packet
  1162. This function sends the "hello" packet to the phone, and returns the response
  1163. message, in its entirety, by copying the response packet to a user defined
  1164. buffer.
  1165. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1166. param iVersionNumber = Host shall set this field to indicate the maximum version 
  1167.                         of this protocol that the host supports. The value for this 
  1168. field is 0x03.
  1169. param iCompatibleVersion = Host shall set this field to indicate the lowest version 
  1170.                             of the protocol that it supports. The value for this field 
  1171. is 0x02.
  1172. param iFeatureBits = Host shall set these bits to indicate the negotiated set 
  1173.                       of features requested to be used.
  1174. param pResponseBuffer = The entire response packet, as defined by section 3.2.2 of
  1175.                          the streaming download ICD.
  1176. return true if response packet was successfully returned, false if fail for any reason.
  1177. warning 
  1178. *******************************************************************************/
  1179. QLIB_API unsigned char QLIB_DOWNLOAD_Hello
  1180. HANDLE hResourceContext, 
  1181. unsigned char iVersionNumber,
  1182. unsigned char iCompatibleVersion,
  1183. unsigned char iFeatureBits,
  1184. unsigned char* pResponseBuffer
  1185. );
  1186. /******************************************************************************/
  1187. /**
  1188. Set the state of DTR.  
  1189. This implementation is only defined with the non-QPST server version of the library
  1190. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1191. param bSetDTR_High = true to set DTR High, false to set DTR Low
  1192. return Returns true if the call succeeded, false if it does not
  1193. *******************************************************************************/
  1194. QLIB_API unsigned char QLIB_SetDTR_State( HANDLE hResourceContext, unsigned char bSetDTR_High);
  1195. /******************************************************************************/
  1196. /**
  1197. Set the state of RTS.  
  1198. This implementation is only defined with the non-QPST server version of the library
  1199. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1200. param bSetRTS_High = true to set RTS High, false to set RTS Low
  1201. return Returns true if the call succeeded, false if it does not
  1202. *******************************************************************************/
  1203. QLIB_API unsigned char QLIB_SetRTS_State( HANDLE hResourceContext, unsigned char bSetRTS_High);
  1204. /******************************************************************************/
  1205. /**
  1206. Clears the Rx buffer.  
  1207. This implementation is only defined with the non-QPST server version of the library
  1208. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1209. return Returns true if the call succeeded, false if it does not
  1210. *******************************************************************************/
  1211. QLIB_API unsigned char QLIB_FlushRxBuffer( HANDLE hResourceContext  );
  1212. /******************************************************************************/
  1213. /**
  1214. Set the state of a flag which determines whether the DATA 2 DIAG switch 
  1215. should be attempted when there is a QLIB_IsPhoneConnected() failure.
  1216. param bSwitchData2Daig = true to attempt AT command to change from data mode to diag mode.
  1217. return Always returns true
  1218. *******************************************************************************/
  1219. QLIB_API unsigned char QLIB_SetData2DiagSearch( unsigned char bSwitchData2Daig);
  1220. /******************************************************************************/
  1221. /**
  1222. Returns a NULL terminated string with the version information in the format:
  1223. "QLIB VXX.xx, <MODE>" where XX is the major version # and xx is the minor 
  1224.  version number and <MODE> is either QPST or QPHONEMS, depending upon the
  1225.  library mode
  1226. Examples:
  1227. "QLIB V04.11,QPHONEMS"
  1228. "QLIB V04.11,QPST"
  1229. param psVersion = Buffer to store the version number, 25 bytes should be reserved
  1230.                   for this buffer.
  1231. return void
  1232. *******************************************************************************/
  1233. QLIB_API void QLIB_GetLibraryVersion( char* psVersion );
  1234. /******************************************************************************/
  1235. /**
  1236. Set the library mode--QPST or QPHONEMS.  The default state of the library is to
  1237. use QPHONEMS.  In order to use QPST, this function must be called with 
  1238. bUseQPST set to TRUE.
  1239. param bUseQPST = true to use QPST, false to use QPHONEMS
  1240. return void
  1241. *******************************************************************************/
  1242. QLIB_API void QLIB_SetLibraryMode( unsigned char bUseQPST );
  1243. /******************************************************************************/
  1244. /**
  1245. Returns flags indicating the capabilities of the library
  1246. param pbSupportsDiag         = true if diag/ftm commands are supported
  1247. param pbSupportsEFS          = true if EFS commands are supported
  1248. param pbSupportsSwDownload   = true if software download commands are supported
  1249. param pbUsingQPST            = true if QPST is being used, false if QPHONEMS is used
  1250. return void
  1251. *******************************************************************************/
  1252. QLIB_API void QLIB_GetLibraryCapabilities( 
  1253. unsigned char* pbSupportsDiag, 
  1254. unsigned char* pbSupportsEFS, 
  1255. unsigned char* pbSupportsSwDownload, 
  1256. unsigned char* pbUsingQPST );
  1257. /******************************************************************************/
  1258. /**
  1259. The function checks whether the phone is in FTM mode.
  1260. Depending on the command code ( FTM_COMMAND_59 or FTM_COMMAND75 ), 
  1261. this function uses different methods to check for FTM mode.  
  1262. Method 1:
  1263. If the command code is set to FTM_COMMAND_59, this function reads the NV_FTM_MODE item to check
  1264. whether the phone is in FTM mode.
  1265. Note that MSM6000/6025/6050 and older MSM targets use FTM_COMMAND_59 command code for FTM mode transcation.  
  1266. Method 2:
  1267. If the command code is set to FTM_COMMAND_75, this function issues a CM state info request 
  1268. to query the phone state.  The command is CMLOG_STATE_INFO_F (refer 80-V1294-7, 3.2).  
  1269. General comment:
  1270. The command code should be set by QLIB_FTM_SET_COMMAND_CODE function before this function is called.
  1271. By default, the command code is FTM_COMMAND_75.
  1272. param pbIsFTMMode = output, true(1) if the phone is in FTM mode, 
  1273.              false(0) if the phone is not in FTM mode 
  1274. return true if the function is successful
  1275. *******************************************************************************/
  1276. QLIB_API unsigned char QLIB_IsFTM_Mode(HANDLE hResourceContext, unsigned char *pbIsFTMMode);
  1277. /******************************************************************************/
  1278. /**
  1279. The function changes phone to FTM or ONLINE mode through NV item NV_FTM_MODE method.
  1280. This function reads NV_FTM_MODE first.  If NV_FTM_MODE value equals to bFTMMode, 
  1281. then NV_FTM_MODE will not be changed.  Otherwise, it performs 2 steps
  1282. 1. Change phone to offline mode (QLIB_DIAG_CONTROL_F(MODE_OFFLINE_F))
  1283. 2. Write bFTMmode value to NV item NV_FTM_MODE (453)
  1284. If (bReset == 1), the function returns immediately after reset command is issued.
  1285. param bFTMMode = (1 = FTM mode), (0 = ONLINE mode)  
  1286. param bReset = (1 = Reset after NV write), (0 = No reset after NV write)
  1287. return true if the function is successful
  1288. *******************************************************************************/
  1289. QLIB_API unsigned char QLIB_ChangeFTM_BootMode(HANDLE hResourceContext, unsigned char bFTMmode, unsigned char bReset);
  1290. /******************************************************************************/
  1291. /**
  1292. The function changes the mode to ONLINE or FTM mode using run time method
  1293. The function calls IsFTM_Mode to determines the phone is in FTM mode or not.
  1294. If current mode is not equal to bFTMmode, it will switch mode.
  1295. General comment:
  1296. This function can't be used in MSM6000/6025/6050 and older MSM targets.  As they
  1297. use FTM_COMMAND_59 command code for FTM and DO NOT support runtime swtiching to FTM
  1298. The command code should be set to FTM_COMMAND_75 by QLIB_FTM_SET_COMMAND_CODE function 
  1299. before this function is called.
  1300. By default, the command code is FTM_COMMAND_75.
  1301. param bFTMMode = (1 = FTM mode), (0 = ONLINE mode) 
  1302. return true if the function is successful
  1303. *******************************************************************************/
  1304. QLIB_API unsigned char QLIB_ChangeFTM_ModeRuntime(HANDLE hResourceContext, unsigned char bFTMmode);
  1305. /******************************************************************************
  1306. Text Logging
  1307. *******************************************************************************/
  1308. /******************************************************************************/
  1309. /**
  1310. Function to start logging send/receive data information.  After calling this
  1311. function, the log file will remain open until the ClosePort() or DisconnectServer()
  1312. operations are called.
  1313. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1314. param sLogfile = path to log file that will be created
  1315. return True if file is opened successfully.
  1316. *******************************************************************************/
  1317. QLIB_API unsigned char QLIB_StartLogging( HANDLE hResourceContext, char* sLogFile );
  1318. /******************************************************************************/
  1319. /**
  1320. Function to Stop text logging
  1321. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1322. return True if file is opened successfully.
  1323. *******************************************************************************/
  1324. QLIB_API unsigned char QLIB_StopLogging( HANDLE hResourceContext );
  1325. /******************************************************************************/
  1326. /**
  1327. Function to set log level for text logging (not the same as log records from the phone).
  1328. Log levels are treated as flags and can be added:
  1329. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1330. param uiLogFlags = Mask for text log
  1331. code
  1332. LOG_NOTHING 0x0000 = log nothing
  1333. LOG_IO          0x0001 = data IO (data bytes)
  1334. LOG_FN          0x0002 = function calls with parameters
  1335. LOG_RET         0x0004 = function return data
  1336. LOG_INF         0x0008 = general information (nice to know)
  1337. LOG_ERR         0x0010 = critial error information
  1338. LOG_C_HIGH_LEVEL_START  0x0200 = High level C function start, indicates the begining of a high level C function, which
  1339.                                  calls other low level C functions internal to the library
  1340. LOG_C_HIGH_LEVEL_STOP   0x4000 = High level C function stop
  1341. LOG_IO_AHDLC    0x0020 = HDLC IO tracing (data bytes)
  1342. LOG_FN_AHDLC    0x0040 = HDLC layer function calls
  1343. LOG_RET_AHDLC   0x0080 = HDLC function return data
  1344. LOG_INF_AHDLC   0x0100 = HDLC general information
  1345. LOG_IO_DEV      0x0400 = device IO tracing (data bytes)
  1346. LOG_FN_DEV      0x0800 = device layer function calls
  1347. LOG_RET_DEV     0x1000 = device function return data
  1348. LOG_INF_DEV     0x2000 = device general information
  1349. LOG_DEFAULT     ( LOG_IO | LOG_ERR | LOG_ERR_AHDLC | LOG_ERR_DEV )
  1350. LOG_ALL 0xFFFF // everything
  1351. endcode
  1352. param hResourceContext = Resource context that was returned from the call to QLIB_ConnectServer()
  1353. param uiLogFlags = log flags as listed above
  1354. return True if file is opened successfully.
  1355. (TR@17112004): Added this function. Currently not all of the above
  1356. flags are supported by QLib.
  1357. *******************************************************************************/
  1358. QLIB_API unsigned char QLIB_SetLogFlags( HANDLE hResourceContext, unsigned int uiLogFlags );
  1359. /******************************************************************************
  1360. GSM Diag
  1361. *******************************************************************************/
  1362. /******************************************************************************/
  1363. /**
  1364. GSM Diagnostic IC, 3.2.2/3 Status Request/Response
  1365.   Get the GSM Call status
  1366. param aiIMEI[9] = First byte is length (0 to 15), Next 8 bytes are packed BCD
  1367. #define GSM_DIAG_IMEI_SIZE  9
  1368. param aiIMSI[9] = First byte is length (0 to 15), Next 8 bytes are packed BCD
  1369. #define GSM_DIAG_IMSI_SIZE  9
  1370. param aiLAI[5] = Location area ID. Format:  3bytes, Public Land Mobile Network Identity, 2bytes Location Area Code 
  1371. #define GSM_DIAG_LAI_SIZE   5
  1372. param piCellID = Cell identity
  1373. param piCM_CallState = refer to enumeration cm_call_state_enum:
  1374. code
  1375.                CM_CALL_STATE_NONE = -1, -  FOR INTERNAL USE OF CM ONLY!
  1376.                CM_CALL_STATE_IDLE = 0, -  Call is in idle state - i.e. no call