⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mfw_bta.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417)         $Workfile:: mfw_bta.c       $|
| $Author: root $Revision: 1.1.1.1 $|
| CREATED: 04.01.01                     $Modtime:: 4.01.01 15:14    $|
| STATE  : code                                                      |
+--------------------------------------------------------------------+

   MODULE  : MFW_BTA

   PURPOSE : This modul contains the additional functions for BT management.

*/
#define ENTITY_MFW

#include "mfw_sys.h"

#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"

#include "prim.h"
#include "p_btp.h"

#include "bti.h"
#include "bti_btp.h"
#include "mfw_mfw.h"
#include "mfw_acie.h"
#include "mfw_bt.h"
#include "mfw_bta.h"

#include <string.h>

/* TI BT header */
#ifdef BT_INTERFACE
#include "rv_general.h"
#include "hsg_general.h"
#include "hsg_messages.h"
#include "rvm_api.h"
#include "bmi_api.h"

/*#ifdef PCA_6350*/
#include "pca_gw_mmi.h"
/*#endif*/
#endif /* BT_INTERFACE */

#ifdef _SIMULATION_
#include "bti_win.h"
#endif

/* global used structures */
T_MFW_BT_SERVICE_LST found_headset;        /* list with found devices (headset) */
T_MFW_BT_DEVICE_LST service_list;          /* list with service id's related to a bd_addr */
T_MFW_BT_SERVICE_LST found_dial_up;        /* list with found services (dial_up) */
T_MFW_BT_SERVICE_LST found_fax;            /* list with found services (fax) */
T_MFW_BT_SERVICE_LST found_opp;            /* list with found services (OPP) */
T_MFW_BT_SERVICE_LST found_sync;           /* list with found services (SYNC) */
T_MFW_BT_SERVICE_LST found_sync_cmd;       /* list with found services (SYNC_CMD) */
T_MFW_BT_AUTHORIZATION_LIST authorized_devices_list; /* list of authorized devices */

char receiv_object_name[MFW_BT_OPP_OBJECT_NAME_MAX_LEN];/* static buffer for object name: limited with 256 characters */
char receiv_object_mime_type[MFW_BT_OPP_OBJECT_MIME_MAX_LEN];/* static buffer for MIME type of object: limited with 256 characters */
char receiv_sync_object_mime_type[MFW_BT_OPP_OBJECT_MIME_MAX_LEN];/* static buffer for MIME type of object: limited with 256 characters */
char sync_object_name[MFW_BT_OPP_OBJECT_NAME_MAX_LEN];/* static buffer for object name: limited with 256 characters */
char sync_object_location_id[MFW_BT_SYNC_OBJECT_IDENTIFIER];/* static buffer for sync object path on server: limited with 256 characters */

#ifdef _SIMULATION_
#define MFW_BT_OPP_BUFFER_LENGTH 10
static unsigned char server_syn_object[MFW_BT_OPP_BUFFER_LENGTH];
static  char mfw_test_syn_obj[] = {'v', 'C', 'a', 'l', '\0'};
static  char mfw_test_opp_obj_name[] = {'v', 'C', 'a', 'r', 'd', '\0'};
static  char hsg_default_name [] ={'H', 'S', 'G', '1', '\0'};
static  char client_obj_name [] ={'C', 'l', 'i', 'e', 'n', 't', '\0'};
static unsigned char server_business_card[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for the pulled server card */
static  char server_default_name [] ={'S', 'e', 'r', 'v', 'e', 'r', '\0'};
static unsigned char server_buffer[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for received client objects at the server  */
static unsigned char client_buffer[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for pushed client objects  */
static unsigned char client_business_card[MFW_BT_OPP_BUFFER_LENGTH];/* temporary field for his own client card */
#endif
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8445)         MODULE: MFW_BTA              |
| STATE  : code                         ROUTINE: bta_response_cb     |
+--------------------------------------------------------------------+

   PURPOSE : Response Callback Handler (receive bt primitive directly)
             Note that the input paramter opc will be casted to USHORT
             as Bluetooth is currently still using 16bit opcodes.

*/
GLOBAL BOOL bta_response_cb (ULONG opc, void * data)
{
  T_MFW_BT_PROFILE_CREATE_CNF *profile_create_cnf;
  T_MFW_BT_PROFILE_DELETE_CNF *profile_delete_cnf;
  T_MFW_BT_SERVICE_LST *id_ptr;
  T_MFW_BT_DEVICE_LST *idd_ptr;
  T_MFW_BT_SERVICE_ID *service_id;
  T_MFW_BT_DEVICE_ID *dev_id;
  T_MFW_BT_SERVICE_ID *help_id;
  T_MFW_BT_DEVICE_ID *help_serv_id;
  T_MFW_BT_PROFILE_CNF *profile_cnf_data;
  T_MFW_BT_PIN_IND *pin_indication;
  T_MFW_BT_DEV_PAIR_IND *pair_indication;
  T_MFW_BT_DEVICE_IND *device_indication;
  T_MFW_BT_SERVICE_IND *service_indication;
  T_MFW_BT_REST_CONFIG *restore_configuration;
  T_MFW_BT_DISCON_DUN_FAX_IND *disc_dun_fax_ind;
  T_MFW_BT_CALL_STATUS_DUN_FAX *dun_call_state;
  T_MFW_BT_AUTHORIZATION_IND *authorization_ind;
  T_MFW_BT_OPP_PUT_CNF *opp_put_cnf;
  T_MFW_BT_OPP_PUSH_CNF *opp_obj_push_cnf;
  T_MFW_BT_OPP_PULL_CNF *opp_obj_pull_cnf;
  T_MFW_BT_SERVICE_SEARCH_CNF *search_conf;
  T_MFW_BT_DEVICE_SEARCH_CNF *dev_search_conf;
  T_MFW_BT_CONNECT_IND *connect_ind;
  T_MFW_BT_CONNECT_INF *connect_inf;
  T_MFW_BT_CONNECT_CNF *connect_cnf;
  T_MFW_BT_DISCONNECT_CNF *disconnect_cnf;
  T_MFW_BT_DISCON_DUN_FAX_CNF *discon_dun_fax_cnf;
  T_MFW_BT_DISCONNECT_IND *disconnect_ind;
  T_MFW_BT_TRANSFER_AUDIO_OUT_CNF *audio_out_cnf;
  T_MFW_BT_TRANSFER_AUDIO_IN_CNF *audio_in_cnf;
  T_MFW_BT_OPP_PUT_IND *opp_put_ind;
  T_MFW_BT_SRV_SYNC_CNF *srv_sync_cnf;
  T_MFW_BT_SRV_SYNC_AUTH_IND * srv_sync_auth;
  T_MFW_BT_SRV_SYNC_PULL_IND * srv_sync_pull_ind;
  T_MFW_BT_SRV_SYNC_PUSH_IND * srv_sync_push_ind;
  T_MFW_BT_SRV_SYNC_PUSH_CNF * srv_sync_push_cnf;
  U8 len;
  T_MFW_BT_CHNG_LOCAL_NAME *c_loc_name;
  T_MFW_BT_READ_LOCAL_NAME *r_loc_name;
  T_MFW_BT_REMOTE_DEV_INFO_RES *rem_dev_info;
  T_MFW_BT_CHNG_CONNECTABLE_MODE *chng_cmode;
  T_MFW_BT_CHNG_DISCOVERABLE_MODE *chng_dmode;
  T_MFW_BT_READ_BD_ADDR *r_bd_addr;
/*#ifdef PCA_6350*/
  T_MFW_BT_PCA_GW_STATUS_CFM *pca_gw_status;
  T_MFW_BT_PCA_GW_LINK_MONITORING *pca_link_mon;
  T_MFW_BT_PCA_GW_CALL_MONITORING *pca_call_mon;
  T_MFW_BT_PCA_GW_HANGUP_CFM *pca_hangup;
/*#endif*/ /*PCA_6350*/

/* Cartman added begin */
  T_MFW_BT_HSG_HEADSET_CONNECTION_IND *hsg_headset_connection_ind;
  T_MFW_BT_HSG_SPECIFIC_CMD_CFM *hsg_specific_cmd_cfm;
  T_MFW_BT_HSG_SAVE_LIST_CNF *hsg_save_list_cnf;
/* Cartman added end */

#ifdef _SIMULATION_

  T_MFW_BT_SUBTYPE_DEV subtyp;
  T_MFW_BT_SERVICE_TYPE service;
  T_MFW_BT_SYNC_OBJECT syn_pull_obj, syn_push_obj;
  T_MFW_BT_SYN_PASSWD mfw_sync_password[MFW_BT_PIN_MAX_LEN];
  char * mfw_sync_password_ptr;
  char j;
  U8 headset_id, default_security;
  T_MFW_BT_BD_ADDR client_address[MFW_BT_ADDR_MAX_LEN];
  T_MFW_BT_BD_ADDR hsg_address[MFW_BT_ADDR_MAX_LEN];
  T_MFW_BT_BD_ADDR server_address[MFW_BT_ADDR_MAX_LEN];
  T_MFW_BT_BD_ADDR remote_address[MFW_BT_ADDR_MAX_LEN];
  T_MFW_BT_SYN_OBJECT_STORE mfw_obj;
  T_MFW_BT_SYNC_COMMAND mfw_syn_action;
  T_MFW_BT_SYNC_SERVER_CONFIG syn_serv_config;
  T_MFW_BT_SYN_OBJECT_STORE_ITEM mfw_obj_list, mfw_obj_list1;
  T_MFW_BT_SYN_OBJECT_STORE_LIST mfw_obj_list_ptr, mfw_obj_list_ptr1;
  T_MFW_BT_HSG_CLIENT_CONFIG client_config;
  T_MFW_BT_HSG_SERVER_CONFIG server_conf;
  T_MFW_BT_HSG_PHONE_NUMBER test_mfw_phone_list[4][30];
  T_MFW_BT_HSG_KEY_LIST test_mfw_key_list[1];
  T_MFW_BT_HSG_NAME hsg_name[MFW_BT_HSG_NAME_MAX_LEN];
  T_MFW_BT_PRIORITY priority;
  T_MFW_BT_CNF_ID headset_cnf_id;
  BOOL rem_audio_ctr_supp_hsg;
  BOOL mfw_keep_connection_opp;
  T_MFW_BT_HEADSET_INFO hs_info;
  U16 new_value;
  T_MFW_BT_PARAM_NUMBER nb;
  T_MFW_BT_CHANGE_PARA type;
  T_MFW_BT_DUN_CONFIG dun_filter;
  T_MFW_BT_FAX_CONFIG fax_filter;
  T_MFW_BT_OPP_SERVER_CONFIG serv_config;
  T_MFW_BT_OPP_PUT_RES opp_put_res;
  T_MFW_BT_OPP_OBJECT receiv_obj, opp_push_obj, opp_pull_obj;
  T_MFW_BT_PIN pin_code[MFW_BT_PIN_MAX_LEN];
  T_MFW_BT_PIN_MODE pin_mode;
  T_MFW_BT_RESULT_BT result_bt;
  T_MFW_BT_PAIRABLE_MODE pair_mode;
  T_MFW_BT_DEV_PAIR_LIST pairing_list;
  T_MFW_BT_AUTHORIZATION_MASK auth_mask;
  T_MFW_BT_AUTHORIZATION_MODE auth_mode;
  T_MFW_BT_SECURITY_MODE sec_mode;

#endif

  TRACE_FUNCTION ("mfw_bta:bta_response_cb()");

  switch ((USHORT) opc)
  {
    case BTP_PROFILE_CREATE_CNF:
      MALLOC(profile_create_cnf, sizeof(T_MFW_BT_PROFILE_CREATE_CNF));
      profile_create_cnf->profile = ((T_BTP_PROFILE_CREATE_CNF *)data)->device;
      bt_signal(BT_CREATE_PROFILE_CNF, profile_create_cnf);
      MFREE(profile_create_cnf);
      return TRUE;

    case BTP_PROFILE_DELETE_CNF:
      MALLOC(profile_delete_cnf, sizeof(T_MFW_BT_PROFILE_DELETE_CNF));
      profile_delete_cnf->profile = ((T_BTP_PROFILE_DELETE_CNF *)data)->device;
      bt_signal(BT_DELETE_PROFILE_CNF, profile_delete_cnf);
      MFREE(profile_delete_cnf);
      return TRUE;

    case BTP_INIT_PROFILE_CNF:
      /* BTI confirms initialization of profile */
      MALLOC(profile_cnf_data, sizeof(T_MFW_BT_PROFILE_CNF));
      memset(profile_cnf_data, 0, sizeof(T_MFW_BT_PROFILE_CNF));
      profile_cnf_data->service = ((T_BTP_INIT_PROFILE_CNF *)data)->device;
      profile_cnf_data->result_bd = ((T_BTP_INIT_PROFILE_CNF *)data)->result;
      profile_cnf_data->action = ((T_BTP_INIT_PROFILE_CNF *)data)->action;
      profile_cnf_data->subtype = ((T_BTP_INIT_PROFILE_CNF *)data)->subtype;
      profile_cnf_data->mfw_opp_mode = ((T_BTP_INIT_PROFILE_CNF *)data)->opp_mode;
      profile_cnf_data->mfw_sync_mode = ((T_BTP_INIT_PROFILE_CNF *)data)->sync_serv_mode;
      profile_cnf_data->mfw_syn_aut_mode = ((T_BTP_INIT_PROFILE_CNF *)data)->sync_init_auth;
      bt_signal(BT_INIT_PROFILE_CNF, profile_cnf_data);
#ifdef _SIMULATION_
      if(profile_cnf_data->service EQ MFW_BT_SYNC)
      {
        TRACE_EVENT_P4("init cnf = %d, %d, %d, %d", profile_cnf_data->service, profile_cnf_data->subtype, profile_cnf_data->mfw_sync_mode, profile_cnf_data->mfw_syn_aut_mode);
      }
      else
      {
        TRACE_EVENT_P2("init cnf = %d, %d", profile_cnf_data->service, profile_cnf_data->subtype);
      }
#endif
      MFREE(profile_cnf_data);
      return TRUE;

    case BTP_DEINIT_PROFILE_CNF:
      /* BTI confirms deinitialization of profile */
      MALLOC(profile_cnf_data, sizeof(T_MFW_BT_PROFILE_CNF));
      memset(profile_cnf_data, 0, sizeof(T_MFW_BT_PROFILE_CNF));
      profile_cnf_data->service = ((T_BTP_DEINIT_PROFILE_CNF *)data)->device;
      profile_cnf_data->result_bd = ((T_BTP_DEINIT_PROFILE_CNF *)data)->result;
      profile_cnf_data->subtype = ((T_BTP_DEINIT_PROFILE_CNF *)data)->subtype;
      profile_cnf_data->mfw_opp_mode = ((T_BTP_DEINIT_PROFILE_CNF *)data)->opp_mode;
      profile_cnf_data->mfw_sync_mode = ((T_BTP_DEINIT_PROFILE_CNF *)data)->sync_serv_mode;
      profile_cnf_data->mfw_syn_aut_mode = ((T_BTP_DEINIT_PROFILE_CNF *)data)->sync_init_auth;
      bt_signal(BT_DEINIT_PROFILE_CNF, profile_cnf_data);
#ifdef _SIMULATION_
      if(profile_cnf_data->service EQ MFW_BT_SYNC)
      {
        TRACE_EVENT_P4("deinit cnf = %d, %d, %d, %d", profile_cnf_data->service, profile_cnf_data->subtype, profile_cnf_data->mfw_sync_mode, profile_cnf_data->mfw_syn_aut_mode);
      }
      else
      {
        TRACE_EVENT_P2("deinit cnf = %d, %d", profile_cnf_data->service, profile_cnf_data->subtype);
      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -