META_error_handler.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:8k
源码类别:

MTK

开发平台:

C++ Builder

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *   META_error_handler.cpp
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   Maui META APP
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   META error handler source
  48.  *
  49.  * Author:
  50.  * -------
  51.  *  Andy Ueng (mtk00490)
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * $Revision$
  58.  * $Modtime$
  59.  * $Log$
  60.  * 
  61.  *------------------------------------------------------------------------------
  62.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  63.  *============================================================================
  64.  ****************************************************************************/
  65. #include <windows.h>
  66. #pragma hdrstop
  67. #include "meta.h"
  68. #include "meta_msg.h"
  69. //------------------------------------------------------------------------------
  70. extern HANDLE hForm_PostMsgTarget;
  71. //------------------------------------------------------------------------------
  72. //------------------------------------------------------------------------------
  73. // modified by Andy Ueng
  74. //void error_handler(META_ERR_CODE m_err)
  75. void __stdcall error_handler(META_CNF_ERR_CODE m_err)
  76. // end of modified
  77. {
  78.     switch(m_err)
  79.     {
  80.         case META_CNF_FRAME_ERROR:
  81.                 PostMessage(
  82.                      hForm_PostMsgTarget,
  83.                      WM_META_DLL_ERROR_FRAME_ERROR,
  84.                      0,
  85.                      0
  86.                    );
  87.        break;
  88.         case META_CNF_NO_CALLBACK:
  89.                 PostMessage(
  90.                      hForm_PostMsgTarget,
  91.                      WM_META_DLL_ERROR_NO_CALLBACK,
  92.                      0,
  93.                      0
  94.                    );
  95.        break;
  96.         case META_CNF_PRIMITIVE_ERROR:
  97.                 PostMessage(
  98.                      hForm_PostMsgTarget,
  99.                      WM_META_DLL_ERROR_PRIMITIVE_ERROR,
  100.                      0,
  101.                      0
  102.                    );
  103.        break;
  104.         default:
  105.                 PostMessage(
  106.                      hForm_PostMsgTarget,
  107.                      WM_META_DLL_ERROR_UNDEFINE_ERROR,
  108.                      0,
  109.                      0
  110.                    );
  111. break;
  112.     } // switch
  113. }
  114. //----------------------------------------------------------------------
  115. void META_result_handler(META_RESULT mr)
  116. {
  117.     switch(mr)
  118.     {
  119.         // META DLL functions return value
  120.         case META_SUCCESS:
  121.               // do nothing
  122.              break;
  123.         case META_FAILED:
  124.                 PostMessage(
  125.                      hForm_PostMsgTarget,
  126.                      WM_META_DLL_FAILED,
  127.                      0,
  128.                      0
  129.                    );
  130.              break;
  131.         case META_COMM_FAIL:
  132.                 PostMessage(
  133.                      hForm_PostMsgTarget,
  134.                      WM_META_DLL_COMM_FAIL,
  135.                      0,
  136.                      0
  137.                    );
  138.              break;
  139.         case META_NORESPONSE:
  140.                 PostMessage(
  141.                      hForm_PostMsgTarget,
  142.                      WM_META_DLL_NORESPONSE,
  143.                      0,
  144.                      0
  145.                    );
  146.              break;
  147.         case META_BUFFER_LEN:
  148.                 PostMessage(
  149.                      hForm_PostMsgTarget,
  150.                      WM_META_DLL_BUFFER_LEN,
  151.                      0,
  152.                      0
  153.                    );
  154.              break;
  155.         case META_FILE_BAD:
  156.                 PostMessage(
  157.                      hForm_PostMsgTarget,
  158.                      WM_META_DLL_FILE_BAD,
  159.                      0,
  160.                      0
  161.                    );
  162.              break;
  163.         case META_LID_INVALID:
  164.                 PostMessage(
  165.                      hForm_PostMsgTarget,
  166.                      WM_META_DLL_LID_INVALID,
  167.                      0,
  168.                      0
  169.                    );
  170.              break;
  171.         case META_INTERNAL_DB_ERR:
  172.                 PostMessage(
  173.                      hForm_PostMsgTarget,
  174.                      WM_META_DLL_INTERNAL_DB_ERR,
  175.                      0,
  176.                      0
  177.                    );
  178.              break;
  179.         case META_NO_MEMORY:
  180.                 PostMessage(
  181.                      hForm_PostMsgTarget,
  182.                      WM_META_DLL_NO_MEMORY,
  183.                      0,
  184.                      0
  185.                    );
  186.              break;
  187.         case META_INVALID_ARGUMENTS:
  188.                 PostMessage(
  189.                      hForm_PostMsgTarget,
  190.                      WM_META_DLL_INVALID_ARGUMENTS,
  191.                      0,
  192.                      0
  193.                    );
  194.              break;
  195.         case META_TIMEOUT:
  196.                 PostMessage(
  197.                      hForm_PostMsgTarget,
  198.                      WM_META_DLL_TIMEOUT,
  199.                      0,
  200.                      0
  201.                    );
  202.              break;
  203.         case META_BUSY:
  204.                 PostMessage(
  205.                      hForm_PostMsgTarget,
  206.                      WM_META_DLL_BUSY,
  207.                      0,
  208.                      0
  209.                    );
  210.              break;
  211.        
  212.         //---------------------------------------------------------
  213.         default:
  214.                 PostMessage(
  215.                      hForm_PostMsgTarget,
  216.                      WM_META_DLL_ERROR_UNDEFINE_ERROR,
  217.                      0,
  218.                      0
  219.                    );
  220. break;
  221.     } // switch
  222. }
  223. //------------------------------------------------------------------------------
  224. //------------------------------------------------------------------------------