コード例 #1
0
ファイル: vmlog.c プロジェクト: WayWingsDev/testmywatch
void vm_app_name_info(int pcb_id, int res_id, unsigned short* name)
{
    VMINT strlen = vm_wstrlen((VMWSTR)name);
    VMINT i;
    VMCHAR* ascii_name = (VMCHAR*)_vm_kernel_malloc(strlen * 4 + 1);

    for (i=0; i<strlen; i++)
    {
        ascii_name[i*4] = name[i]>>12 & 0x000F;
        ascii_name[i*4+1] = name[i]>>8 & 0x000F;
        ascii_name[i*4+2] = name[i]>>4 & 0x000F;
        ascii_name[i*4+3] = name[i] & 0x000F;
    }

    for (i=0; i<(strlen*4); i++)
    {
        if (ascii_name[i]<=9)
        {
            ascii_name[i] += '0';
           
        }
        else if ((ascii_name[i]>=0x0A) && (ascii_name[i]<=0x0F))
        {
            ascii_name[i] =ascii_name[i]-10 + 'A' ;
        }
        else
        {
        }
    }
    *(ascii_name+i)=0;
    
    MMI_PRINT(MOD_MRE_APP_INFO, TRACE_INFO,"%d:%d:%s", pcb_id, res_id,ascii_name);

	_vm_kernel_free(ascii_name);
}
コード例 #2
0
/*****************************************************************************
* FUNCTION
*	mre_write_line_to_file
* DESCRIPTION
*	Writes line to file 
* PARAMETERS
*	file_name just the name as string in root directory, line as string
* RETURNS
*	MRE_FILE_NOT_WRITTEN if fail, MRE_SCILENT for success
TODO: Remove this. Already defined above.
*****************************************************************************/
VMINT mre_write_line_to_file2 (VMSTR file_name, VMSTR line)
{
	/* local variables */
	VMFILE  file_handle;
	VMCHAR  file_path[MRE_FILE_NAME_SIZE];
	VMWCHAR wfile_name[MRE_FILE_NAME_SIZE];
	VMWCHAR wline[MRE_STR_SIZE_MAX + 1];
    VMUINT written;
	VMUINT  bytes_written;
	VMINT line_bytes;
	
	//const VMINT line_size = sizeof (VMCHAR) * (vm_wstrlen (line)+1); //+2 for new line
	//VMINT line_bytes = sizeof(VMCHAR) * (vm_strlen(line) + 1 )
	//VMSTR line_new[1000];
	//sprintf(line_new,"%s\n", line);

	/* Open file */
	sprintf(file_path,"%c:\\%s",mre_get_drv(),file_name);
	vm_ascii_to_ucs2(wfile_name, MRE_STR_SIZE_MAX, file_path);

	vm_ascii_to_ucs2(wline, MRE_STR_SIZE_MAX, line);
	line_bytes = sizeof(VMWCHAR) *(vm_wstrlen (wline)+1); 

	//g_mre_textbox_text =  (sizeof (VMWCHAR) * (vm_wstrlen (wline)+1));
    //vm_wstrcpy (g_mre_textbox_text, text);

	file_handle = vm_file_open(wfile_name, MODE_APPEND, FALSE);
	if (file_handle < 0){
		file_handle = vm_file_open(wfile_name, MODE_CREATE_ALWAYS_WRITE, FALSE);
	}
	if(file_handle < 0)
	{
		vertical_scrolling_text("Write to file fail....");
	}else{
		/* write to file */
		bytes_written = vm_file_write (file_handle, wline, line_bytes, &written);
		vm_log_debug("%d bytes has been written in file", bytes_written);
		
        if (bytes_written == 0)
        {
            vm_file_close (file_handle);
            return MRE_FILE_NOT_WRITTEN;
        }

	    else 
	    {
		    vm_file_close (file_handle);
			//sprintf (show_text, "Written in file: success");
            //mre_show_text (show_text);
		    return MRE_SCILENT;
	    }
   
	}
	/* Closing file */
	vm_file_close(file_handle);
	return MRE_FILE_NOT_WRITTEN;
}
コード例 #3
0
/*****************************************************************************
 * FUNCTION
 *  mre_write_file
 * DESCRIPTION
 *  This function writes on the file given 
 * PARAMETERS
 *  file name				[IN]      name of file
 * RETURNS
 *	result                  [OUT]     some code for error and success   
*****************************************************************************/
VMINT mre_write_file (VMSTR file_name)
{
	VMFILE f_write; 
	VMCHAR f_name[MRE_STR_SIZE_MAX + 1] ;
    VMWCHAR f_wname[MRE_STR_SIZE_MAX + 1];
    VMINT written_result;
    VMUINT written;
    VMCHAR show_text[MRE_STR_SIZE_MAX + 1];
    vm_log_debug ("mre_write_file function starts with file name : %s ", file_name);
    sprintf (f_name, "%c:\\%s", mre_get_drv(), file_name);
    vm_log_debug("file name : %s", f_name);

	/* string format conversion */
	vm_ascii_to_ucs2 (f_wname, MRE_STR_SIZE_MAX, f_name);

	/* file is opened here */
	f_write = vm_file_open (f_wname, MODE_WRITE, FALSE);
    vm_log_debug("file open hdl : %d", f_write);

	if (f_write < 0)
	{
        return MRE_FILE_OPEN_FAILED;
	}

        written_result = vm_file_write (f_write, 
							//vm_gb2312_string (mre_get_textbox_text ()), 
							mre_get_textbox_text (), 
								sizeof (VMWCHAR) * (vm_wstrlen (mre_get_textbox_text ())+1),  
									& written);
        vm_log_debug("file write result : %d", written_result);
        vm_free (mre_get_textbox_text ());
        if (written_result == 0)
        {
            vm_file_close (f_write);
            return MRE_FILE_NOT_WRITTEN;
        }

	    else 
	    {
		    vm_file_close (f_write);
			sprintf (show_text, "Written in file: success");
            mre_show_text (show_text);
		    return MRE_SCILENT;
	    }
   
    //vm_log_debug ("mre_write_file function exits");
    
}
コード例 #4
0
ファイル: vmtel.c プロジェクト: WayWingsDev/testmywatch
VMINT vm_callout_ex(VMWSTR phnum, VM_CALLOUT_RESPONSE_T callback)
{
	VM_P_HANDLE phandle =  vm_pmng_get_current_handle();
//	VMINT resid = -1;
	
	mmi_ucm_make_call_para_struct  make_call_para;
	VMUINT16 gid = 0;  

	if (vm_pmng_state(phandle) != VM_PMNG_FOREGROUND)
	{
		vm_log_debug("vm_callout: state is not foreground");
		return VM_CALLOUT_ERR_STATE;
	}
#ifdef __MRE_SAL_SIM__
 
	if (vm_sim_card_count() <= 0)
	{
		vm_log_debug("vm_callout: no sim card");
		return VM_CALLOUT_ERR_NO_SIM;
	}
#endif
 
	if (!srv_mode_switch_is_network_service_available())
	{
		vm_log_debug("vm_callout: flight mode");
		return VM_CALLOUT_ERR_FLIGHT;
	}
 
	if (vm_callout_status != VM_CALLOUT_IDEL)
	{
		vm_log_debug("vm_callout: device is busy now");
		return VM_CALLOUT_ERR_BUSY;
	}
	 
	if (phnum == NULL)
	{
		vm_log_debug("vm_callout : the ptr of phnum is NULL");
		return VM_CALLOUT_ERR_PHONE_NUM;
	}
	if ((vm_wstrlen(phnum) <= 0) || (vm_wstrlen(phnum) >= 40))
	{
		vm_log_debug("vm_callout : the len of phnum is error");
		return VM_CALLOUT_ERR_PHONE_NUM;
	}
	if (vm_available_phnum(phnum) == FALSE)
	{
		vm_log_debug("vm_callout : the content of phnum is error");
		return VM_CALLOUT_ERR_PHONE_NUM;
	}
	if (phandle < 0)
	{
		vm_log_debug("vm_callout : phandle is error");
		return VM_CALLOUT_ERR_PROCESS;
	}
	 
	if ((vm_res_save_data(VM_RES_TYPE_CALLOUT, phnum, (vm_wstrlen(phnum) * 2), (void*)callback, phandle)) < 0)
	{
	    VMINT resid = -1;
	    if ((resid = vm_res_findfirst(-1, VM_RES_TYPE_CALLOUT)) != VM_RES_NOT_FIND)
    	{
    		vm_res_release_data(VM_RES_TYPE_CALLOUT, resid);   		
    		vm_res_findclose(VM_RES_TYPE_CALLOUT);    		
    	}
		
		if ((vm_res_save_data(VM_RES_TYPE_CALLOUT, phnum, (vm_wstrlen(phnum) * 2), (void*)callback, phandle)) < 0)
		{
		    vm_log_debug("vm_callout: res save error");
		    return VM_CALLOUT_ERR_NO_RES;
		}
	}

 
	vm_log_debug("vm_callout : before mmi_ucm_init_call_para");
	mmi_ucm_init_call_para(&make_call_para);  
	vm_log_debug("vm_callout : after mmi_ucm_init_call_para");

    switch (vm_sim_get_active_sim_card())
    {
    case 1:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE;
        break;
    case 2:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM2;
        break;
    case 3:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM3;
        break;
    case 4:
        make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM4;
        break;
    default:
        return VM_CALLOUT_ERR_NO_SIM;
    }
    
	make_call_para.ucs2_num_uri = (U16*)phnum;
    
	vm_log_debug("vm_callout : before mmi_ucm_call_launch");
	mmi_ucm_call_launch(gid, &make_call_para);	
	vm_log_debug("vm_callout : after mmi_ucm_call_launch");
	
	return VM_CALLOUT_NO_ERR;
}