mmi_graph_file_download.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:7k
源码类别:
MTK
开发平台:
C++ Builder
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * MMI_graph_file_download.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * MMI graph file download source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #pragma hdrstop
- #include "mmi_graph_file_download.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #include "man_active.h"
- static MMIFILE* mmi_file_ptr;
- bool IsRunning_MMIData = false;
- META_RESULT MetaResult_MMIData;
- //===========================================================================
- MMIFILE::MMIFILE( void )
- {
- IsRunning = false;
- ConfirmCallback = 0;
- }
- //---------------------------------------------------------------------------
- MMIFILE::~MMIFILE( )
- {
- IsRunning = false;
- ConfirmCallback = 0;
- }
- //---------------------------------------------------------------------------
- void MMIFILE::Confirm( int confirm_state )
- {
- if(!IsRunning) return;
- if(ConfirmCallback==0) return;
- ConfirmState = confirm_state;
- ActiveMan->SetActiveFunction( ConfirmCallback );
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- META_RESULT MMIFILE::REQ_Read_From_FAT( const char *FAT_filepath_para, const char *local_filepath_para )
- {
- mmi_file_ptr = this;
- IsRunning = true;
- MetaResult_MMIData = META_FAT_Open_r(m_META_HANDLE_Obj.Get_MainHandle(), FAT_filepath_para , FAT_OPEN_READ, &fs_handle_graph_file, MMI_DATA_TOKEN);
- if(MetaResult_MMIData!=META_SUCCESS)
- {
- // Confirm( STATE_MMI_GRAPH_FILE_UPLOAD_FAIL );
- return MetaResult_MMIData;
- }
- MetaResult_MMIData = META_FAT_Read_To_File_r(m_META_HANDLE_Obj.Get_MainHandle(), fs_handle_graph_file, local_filepath_para, NULL, NULL, MMI_DATA_TOKEN);
- if(MetaResult_MMIData!=META_SUCCESS)
- {
- // Confirm( STATE_MMI_GRAPH_FILE_UPLOAD_FAIL );
- return MetaResult_MMIData;
- }
- MetaResult_MMIData = META_FAT_Close_r(m_META_HANDLE_Obj.Get_MainHandle(), &fs_handle_graph_file, MMI_DATA_TOKEN);
- if(MetaResult_MMIData!=META_SUCCESS)
- {
- // Confirm( STATE_MMI_GRAPH_FILE_UPLOAD_FAIL );
- return MetaResult_MMIData;
- }
- return MetaResult_MMIData;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- META_RESULT MMIFILE::REQ_Write_To_FAT(int file_count )
- {
- mmi_file_ptr = this;
- IsRunning_MMIData = true;
- for(int i=0; i<file_count; i++)
- {
- MetaResult_MMIData = META_FAT_Open_r(m_META_HANDLE_Obj.Get_MainHandle(), FAT_filepath[i] , FAT_OPEN_WRITE, &fs_handle_graph_file, MMI_DATA_TOKEN);
- if(MetaResult_MMIData!=META_SUCCESS)
- {
- IsRunning_MMIData = false;
- return MetaResult_MMIData;
- }
- MetaResult_MMIData = META_FAT_Write_By_File_r(m_META_HANDLE_Obj.Get_MainHandle(), fs_handle_graph_file, local_filepath[i], NULL, NULL, MMI_DATA_TOKEN);
- if(MetaResult_MMIData!=META_SUCCESS)
- {
- IsRunning_MMIData = false;
- return MetaResult_MMIData;
- }
- MetaResult_MMIData = META_FAT_Close_r(m_META_HANDLE_Obj.Get_MainHandle(), &fs_handle_graph_file, MMI_DATA_TOKEN);
- if(MetaResult_MMIData!=META_SUCCESS)
- {
- IsRunning_MMIData = false;
- return MetaResult_MMIData;
- }
- }
- IsRunning_MMIData = false;
- return MetaResult_MMIData;
- }
- //================================================================================================
- void MMIFILE::Req_FATGetFileInfo(char *FAT_file_path, char *FAT_file_type)
- {
- if( (MetaResult_MMIData = META_FAT_Find_Start_r(m_META_HANDLE_Obj.Get_MainHandle(), FAT_file_path, FAT_file_type, FAT_FIND_FILE_RECURSIVE, &fs_handle, &MMIDataToken)) == META_SUCCESS )
- {
- do{
- META_FAT_Find_GetFileInfo(fs_handle, filepath, sizeof(filepath), &filesize);
- // lbFATMMIData->Items->Add(filepath);
- }while( META_SUCCESS == META_FAT_Find_Next(fs_handle) );
- META_FAT_Find_Close(&fs_handle);
- }
- if(MetaResult_MMIData != META_SUCCESS)
- {Confirm(STATE_MMIDATA_FAIL);}
- }