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

📄 mfw_bt.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:
      /* this function change the parameter of the existing OPP server */
      switch(serv_config.mfw_opp_object.mfw_object_type)
      {
        case MFW_BT_BUFFER:/* object is stored in buffer */
          bt_opp_s_conf.bt_object.bt_object_type = BTI_TYPE_BUFFER;
          bt_opp_s_conf.bt_object.bt_buffer_start = serv_config.mfw_opp_object.mfw_buffer_start;
          bt_opp_s_conf.bt_object.bt_buffer_size = serv_config.mfw_opp_object.mfw_buffer_size;
          break;
        case MFW_BT_PATH:/* object is stored in file system */
          bt_opp_s_conf.bt_object.bt_object_type = BTI_TYPE_PATH;
          /* path of default_business_card of server */
          bt_opp_s_conf.bt_object.bt_path = serv_config.mfw_opp_object.mfw_path;
          /* path of inbox folder in file system of OPP server */
          bt_opp_s_conf.bt_inbox_path = serv_config.mfw_inbox_path;
          break;
        default:
          return MFW_BT_FAIL;
      }
      /* MIME type of object, null-terminated string */
      bt_opp_s_conf.bt_object.bt_object_mime_type = serv_config.mfw_opp_object.mfw_object_mime_type;
      /* name of default_business_card of server */
      bt_opp_s_conf.bt_object.bt_object_name = serv_config.mfw_opp_object.mfw_object_name;
      /* length of default_business_card of server */
      bt_opp_s_conf.bt_object.bt_object_length = serv_config.mfw_opp_object.mfw_object_length;

      switch(btibtp_reconf_profile_opp_s(bt_opp_s_conf))
      {/* BTP_RECONFIG_PROFILE_REQ to BT */
        case BTP_OK:
          return MFW_BT_EXECUTE;
        case BTP_INVALID_PARAMETER:
          return MFW_BT_INVALID_PARA;
        case BTP_NOT_SUPP:
          return MFW_BT_NO_SUPP;
        case BTP_NOT_READY:
          return MFW_BT_NOT_READY;
        case BTP_INT_ERR:
          return MFW_BT_INT_ERR;
        case BTP_MEMORY_ERR:
          return MFW_BT_MEM_ERR;
        case BTP_NOK:
          return MFW_BT_NOK;
      }
    }
    else
      return MFW_BT_FAIL;
  }
  return MFW_BT_FAIL;
}

/*
+----------------------------------------------------------------------+
| PROJECT : MMI-Framework (8445)     MODULE  : MFW_BT                  |
| STATE   : code                     ROUTINE : bt_reconf_profile_syn_s   |
+----------------------------------------------------------------------+

  PURPOSE : reconfigure a BT SYNC profile in server mode

*/
T_MFW_BT_RESULT_BT bt_reconf_profile_syn_s (T_MFW_BT_SERVICE_TYPE service,
                                          T_MFW_BT_SUBTYPE_DEV subtype,
                                  T_MFW_BT_SYN_OBJECT_STORE_LIST list_availabe_objects,
                                  T_MFW_BT_SYNC_SERVER_CONFIG mfw_config)
{
  T_BTI_SYNC_SERVER_CONFIG bt_config;
  T_BTI_SYN_OBJECT_STORE_LIST bt_list_sync_objects;
  TRACE_FUNCTION ("bt_reconf_profile_syn_s()");

  memset(&bt_config,0,sizeof(bt_config));
  bt_list_sync_objects = (T_BTI_SYN_OBJECT_STORE_LIST)list_availabe_objects;

  if(service EQ MFW_BT_SYNC)
  {
    switch(mfw_config.mfw_syn_srv_mode)
    {
      case MFW_BT_SYNC_GEN_MODE:
        /* general SYNC server mode, for devices
        which are made discoverable continuously or for no
        specific conditions */
        bt_config.bt_sync_srv_mode = mfw_config.mfw_syn_srv_mode;
        break;
      case MFW_BT_SYNC_INIT_MODE:
        /* limited inquiry scan for devices which
        are made discoverable only for a limited period of time or
        for specific conditions */
        bt_config.bt_sync_srv_mode = mfw_config.mfw_syn_srv_mode;
        break;
      default:
        return MFW_BT_FAIL;
    }
    switch(mfw_config.mfw_syn_srv_auth_mode)
    {
      case MFW_BT_SYNC_INIT_AUTH_MODE:
        /* server initiates authentication */
        bt_config.bt_sync_aut_mode = mfw_config.mfw_syn_srv_auth_mode;
        break;
      case MFW_BT_SYNC_NO_INIT_AUTH_MODE:
        /* server does not initiate authentication*/
        bt_config.bt_sync_aut_mode = mfw_config.mfw_syn_srv_auth_mode;
        break;
      default:
        return MFW_BT_FAIL;
    }

    switch(btibtp_reconf_profile_sync_req_serv(bt_list_sync_objects,bt_config))
    { /* BTP_RECONFIG_PROFILE_REQ to BT */
      case BTP_OK:
        return MFW_BT_EXECUTE;
      case BTP_INVALID_PARAMETER:
        return MFW_BT_INVALID_PARA;
      case BTP_NOT_SUPP:
        return MFW_BT_NO_SUPP;
      case BTP_NOT_READY:
        return MFW_BT_NOT_READY;
      case BTP_INT_ERR:
        return MFW_BT_INT_ERR;
      case BTP_MEMORY_ERR:
        return MFW_BT_MEM_ERR;
      case BTP_NOK:
        return MFW_BT_NOK;
    }
  }
  return MFW_BT_FAIL;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8445)        MODULE  : MFW_BT             |
| STATE   : code                        ROUTINE : bt_deinit_profile  |
+--------------------------------------------------------------------+

  PURPOSE : deinitialize a BT profile, not stop of profile application

*/
T_MFW_BT_RESULT_BT bt_deinit_profile (T_MFW_BT_SERVICE_TYPE service,T_MFW_BT_SUBTYPE_DEV subtype)
{
  TRACE_FUNCTION ("bt_deinit_profile()");

  if((service EQ MFW_BT_HEADSET) OR
     (service EQ MFW_BT_DIAL_UP) OR
     (service EQ MFW_BT_FAX_GW)  OR
     (service EQ MFW_BT_OPP)  OR
     (service EQ MFW_BT_SYNC))
  {
    if((subtype EQ MFW_BT_CLIENT) OR
       (subtype EQ MFW_BT_SERVER) OR
       (subtype EQ MFW_BT_NO_SUBTYPE))
    {
      switch(btibtp_deinit_profile_req((T_BTI_DEVICE_TYPE)service,(T_BTI_DEVICE_SUBTYP)subtype))
      { /* BTP_DEINIT_PROFILE_REQ to BT */
        case BTP_OK:
          return MFW_BT_EXECUTE;
        case BTP_INVALID_PARAMETER:
          return MFW_BT_INVALID_PARA;
        case BTP_NOT_SUPP:
          return MFW_BT_NO_SUPP;
        case BTP_NOT_READY:
          return MFW_BT_NOT_READY;
        case BTP_INT_ERR:
          return MFW_BT_INT_ERR;
        case BTP_MEMORY_ERR:
          return MFW_BT_MEM_ERR;
        case BTP_NOK:
          return MFW_BT_NOK;
      }
    }
  }
  return MFW_BT_FAIL;
}

/*
+-----------------------------------------------------------------------+
| PROJECT : MMI-Framework (8445)    MODULE  : MFW_BT                    |
| STATE   : code                    ROUTINE : bt_reconfig_profile_hsg_cl|
+-----------------------------------------------------------------------+

  PURPOSE : reconfigure a BT profile headset in client mode

*/
T_MFW_BT_RESULT_BT bt_reconfig_profile_hsg_cl (T_MFW_BT_SERVICE_TYPE service,
                                     T_MFW_BT_HSG_CLIENT_CONFIG config)
{
  T_BTI_HSG_CLIENT_CONF bt_config;

  TRACE_FUNCTION ("bt_reconfig_profile_hsg_cl()");

  memset(&bt_config,0,sizeof(bt_config));

  if(service EQ MFW_BT_HEADSET)
  {/* reconfiguration is only accepted when no outgoing call is in processing */
    switch(config.config_mode)
    {
      case MFW_BT_AUTO_OUTG_DEF_CONN_OFF:
        bt_config.config_mode = BTI_AUTO_OUTG_DEF_CONN_OFF;
        break;
      case MFW_BT_AUTO_OUTG_DEF_CONN_ON:
        bt_config.config_mode = BTI_AUTO_OUTG_DEF_CONN_ON;
        break;
    }

    bt_config.security = config.security;

    switch(btibtp_reconfig_profile_req_cl((T_BTI_DEVICE_TYPE)service,bt_config))
    { /* BTP_RECONF_PROFILE_REQ to BT */
      case BTP_OK:
        return MFW_BT_EXECUTE;
      case BTP_INVALID_PARAMETER:
        return MFW_BT_INVALID_PARA;
      case BTP_NOT_SUPP:
        return MFW_BT_NO_SUPP;
      case BTP_NOT_READY:
        return MFW_BT_NOT_READY;
      case BTP_INT_ERR:
        return MFW_BT_INT_ERR;
      case BTP_MEMORY_ERR:
        return MFW_BT_MEM_ERR;
      case BTP_NOK:
        return MFW_BT_NOK;
    }
  }
  return MFW_BT_FAIL;
}

/*
+--------------------------------------------------------------------------+
| PROJECT : MMI-Framework (8445)     MODULE  : MFW_BT                      |
| STATE   : code                     ROUTINE : bt_reconfig_profile_hsg_serv|
+--------------------------------------------------------------------------+

  PURPOSE : reconfigure a BT headset profile in server mode

*/
T_MFW_BT_RESULT_BT bt_reconfig_profile_hsg_serv (T_MFW_BT_SERVICE_TYPE service,
                                  T_MFW_BT_HSG_SERVER_CONFIG mfw_config)
{
  T_BTI_HSG_SERVER_CONF bt_config;

  TRACE_FUNCTION ("bt_reconfig_profile_hsg_serv()");

  memset(&bt_config,0,sizeof(bt_config));

  if(service EQ MFW_BT_HEADSET)
  {
    bt_config.conn_config = mfw_config.serv_con_conf;
    /* length scan of connection requests of remote headsets *
    /* default value: MFW_BT_CONN_SCAN_TIME_DEFAULT_VALUE */
    bt_config.conn_time = mfw_config.conn_time;
    /* period between 2 scans of connection of remote headsets */
    /* default value: MFW_BT_CONN_SCAN_BREAK_DEFAULT_VALUE */
    bt_config.conn_break= mfw_config.conn_break;
    /* number of phone number in phone list */
    bt_config.nb_phone = mfw_config.nb_phone;
    /* phone number list of remote headset */
    memcpy(bt_config.phon_list,mfw_config.mfw_phone_list,sizeof(mfw_config.mfw_phone_list));
    /* associatd key list of  remote headset */
    memcpy(bt_config.key_list,mfw_config.mfw_key_list,sizeof(mfw_config.mfw_key_list));

    bt_config.security = mfw_config.security;

    switch(btibtp_reconfig_profile_req_serv((T_BTI_DEVICE_TYPE)service,bt_config))
    {/* BTP_INIT_PROFILE_REQ to BT */
      case BTP_OK:
        return MFW_BT_EXECUTE;
      case BTP_INVALID_PARAMETER:
        return MFW_BT_INVALID_PARA;
      case BTP_NOT_SUPP:
        return MFW_BT_NO_SUPP;
      case BTP_NOT_READY:
        return MFW_BT_NOT_READY;
      case BTP_INT_ERR:
        return MFW_BT_INT_ERR;
      case BTP_MEMORY_ERR:
        return MFW_BT_MEM_ERR;
      case BTP_NOK:
        return MFW_BT_NOK;
    }
  }
  return MFW_BT_FAIL;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8445)    MODULE  : MFW_BT                 |
| STATE   : code                    ROUTINE : bt_reconfig_profile_dun|
+--------------------------------------------------------------------+

  PURPOSE : reconfigure a BT profile

*/
T_MFW_BT_RESULT_BT bt_reconfig_profile_dun (T_MFW_BT_SERVICE_TYPE service,
                                     T_MFW_BT_DUN_CONFIG dun_filter)
{
  T_BTI_DUN_CONF dun_config;

  TRACE_FUNCTION ("bt_reconfig_profile_dun()");

  memset(&dun_config,0,sizeof(dun_config));

  if(service EQ MFW_BT_DIAL_UP )
  {/* show status of BT link - informs if a serial port is opened between DUN-DT and DUN-GW */
    if((dun_filter.link_event EQ BTI_DUN_LINK_MONIT_ON) OR
       (dun_filter.link_event EQ BTI_DUN_LINK_MONIT_OFF))
    {
      dun_config.link_filter = dun_filter.link_event;
    }
    else
    {
        TRACE_EVENT ("Error:bt_reconfig_profile_dun()");
        return MFW_BT_FAIL;
    }
    /* show status of data call */
    if((dun_filter.call_event EQ BTI_DUN_CALL_MONIT_ON) OR
       (dun_filter.call_event EQ BTI_DUN_CALL_MONIT_OFF))
    {
      dun_config.call_filter = dun_filter.call_event;
    }
    else
    {
        TRACE_EVENT ("Error:bt_reconfig_profile_dun()");
        return MFW_BT_FAIL;
    }

    switch(btibtp_reconf_profile_dun_req((T_BTI_DEVICE_TYPE)service,dun_config))
    { /* BTP_RECONF_PROFILE_REQ to BT */
      case BTP_OK:
        return MFW_BT_EXECUTE;
      case BTP_INVALID_PARAMETER:
        return MFW_BT_INVALID_PARA;
      case BTP_NOT_SUPP:
        return MFW_BT_NO_SUPP;
      case BTP_NOT_READY:
        return MFW_BT_NOT_READY;
      case BTP_INT_ERR:
        return MFW_BT_INT_ERR;
      case BTP_MEMORY_ERR:
        return MFW_BT_MEM_ERR;
      case BTP_NOK:
        return MFW_BT_NOK;
    }
  }
  return MFW_BT_FAIL;
}

/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8445)    MODULE  : MFW_BT                 |
| STATE   : code                    ROUTINE : bt_reconfig_profile_fax|
+--------------------------------------------------------------------+

  PURPOSE : reconfigure a BT profile

*/
T_MFW_BT_RESULT_BT bt_reconfig_profile_fax (T_MFW_BT_SERVICE_TYPE service,
                                     T_MFW_BT_FAX_CONFIG fax_filter)
{
  T_BTI_FAX_CONF fax_config;

  TRACE_FUNCTION ("bt_reconfig_profile_fax()");

  memset(&fax_config,0,sizeof(fax_config));

  if(service EQ MFW_BT_FAX_GW )
  {/* show status of BT link - informs if a serial port is opened between FAX-DT and FAX-GW */
    if((fax_filter.link_event EQ BTI_FAX_LINK_MONIT_ON) OR
       (fax_filter.link_event EQ BTI_FAX_LINK_MONIT_OFF))
    {
      fax_config.link_filter = fax_filter.link_event;
    }
    else
    {
        TRACE_EVENT ("Error:bt_reconfig_profile_fax()");
        return MFW_BT_FAIL;
    }
    /* show status of data call */
    if((fax_filter.call_event EQ BTI_FAX_CALL_MONIT_ON) OR
       (fax_filter.call_event EQ BTI_FAX_CALL_MONIT_OFF))
    {
      fax_config.call_filter = fax_filter.call_event;
    }
    else
    {
        TRACE_EVENT ("Error:bt_reconfig_profile_fax()");
        return MFW_BT_FAIL;

⌨️ 快捷键说明

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