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

📄 mfw_bt.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:
      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_init_profile_dun|
+--------------------------------------------------------------------+

  PURPOSE : configure and initialize a BT dialup profile

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

  TRACE_FUNCTION ("bt_init_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_init_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_init_profile_dun()");
        return MFW_BT_FAIL;
    }

    switch(btibtp_init_profile_dun_req((T_BTI_DEVICE_TYPE)service,dun_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_init_profile_fax|
+--------------------------------------------------------------------+

  PURPOSE : configure and initialize a BT fax gateway profile

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

  TRACE_FUNCTION ("bt_init_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_init_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_init_profile_fax()");
        return MFW_BT_FAIL;
    }

    switch(btibtp_init_profile_fax_req((T_BTI_DEVICE_TYPE)service,fax_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_init_profile_opp|
+--------------------------------------------------------------------+

  PURPOSE : configure and initialize a BT OPP client or server
*/
T_MFW_BT_RESULT_BT bt_init_profile_opp (T_MFW_BT_SERVICE_TYPE service,
                                        T_MFW_BT_SUBTYPE_DEV subtype,
                                        T_MFW_BT_OPP_SERVER_CONFIG serv_config)
{
  T_BTI_OPP_SERVER_CONFIG bt_opp_s_conf;

  TRACE_FUNCTION ("bt_init_profile_opp()");

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

  if(service EQ MFW_BT_OPP)
  {
    if(subtype EQ MFW_BT_CLIENT)
    {
      switch(btibtp_init_profile_opp_cl())
      {/* 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;
      }
    }
    else if(subtype EQ MFW_BT_SERVER)
    {
      /* mode of OPP server:
         MFW_BT_OPP_NO_MODE: no OPP server mode
         MFW_BT_OPP_SILENT_MODE: OPP server stores objects as files without alerting the user
         MFW_BT_OPP_FILE_MODE: OPP server stores objects as files with alerting user
         MFW_BT_OPP_BUFFER_MODE: OPP server asks for a buffer to store the each object
      */

      switch(serv_config.mfw_opp_mode)
      {
        case MFW_BT_OPP_NO_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_NO_OPP_MODE;
          break;
        case MFW_BT_OPP_BUFFER_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_BUFFER_MODE;
          break;
        case MFW_BT_OPP_FILE_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_FILE_MODE;
          break;
        case MFW_BT_OPP_SILENT_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_OPP_SILENT_FILE_MODE;
          break;
        default:
          return MFW_BT_FAIL;
      }
      /* this function change the parameter of the existing OPP server */
      /* initalizing of an OBEX server and service, registration in SDP and enabling of OPP server took place
      after switching power on */
      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_init_profile_opp_s(bt_opp_s_conf))
      {/* 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;
      }
    }
    else
      return MFW_BT_FAIL;
  }
  return MFW_BT_FAIL;
}

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

  PURPOSE : configure and initialize a BT SYNC profile in server mode

*/
T_MFW_BT_RESULT_BT bt_init_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_init_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)
  {
    if(subtype EQ MFW_BT_SERVER)
    {
      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, the server is in connectable mode; the Sync
          client connects the server and starts the synchronization */
          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; the server is in connectable and pairable mode */
          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_init_profile_sync_req_serv(bt_list_sync_objects,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;
      }
    }
    else
      return MFW_BT_FAIL;
  }
  return MFW_BT_FAIL;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8445)      MODULE  : MFW_BT               |
| STATE   : code                      ROUTINE : bt_reconf_profile_opp|
+--------------------------------------------------------------------+

  PURPOSE : reconfigure a BT OPP in server mode
*/
T_MFW_BT_RESULT_BT bt_reconf_profile_opp (T_MFW_BT_SERVICE_TYPE service,
                                        T_MFW_BT_SUBTYPE_DEV subtype,
                                        T_MFW_BT_OPP_SERVER_CONFIG serv_config)
{
  T_BTI_OPP_SERVER_CONFIG bt_opp_s_conf;

  TRACE_FUNCTION ("bt_init_profile_opp()");

  memset(&bt_opp_s_conf,0,sizeof(bt_opp_s_conf));
  if(service EQ MFW_BT_OPP)
  {
    if(subtype EQ MFW_BT_SERVER)
    {
      /* mode of OPP server:
         MFW_BT_OPP_NO_MODE: no OPP server mode
         MFW_BT_OPP_SILENT_MODE: OPP server stores objects as fileswithout alerting the user
         MFW_BT_OPP_FILE_MODE: OPP server stores objects as fileswith alerting user
         MFW_BT_OPP_BUFFER_MODE: OPP server asks for a buffer to store the each object
      */
      switch(serv_config.mfw_opp_mode)
      {
        case MFW_BT_OPP_NO_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_NO_OPP_MODE;
          break;
        case MFW_BT_OPP_BUFFER_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_BUFFER_MODE;
          break;
        case MFW_BT_OPP_FILE_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_OPP_EVENT_FILE_MODE;
          break;
        case MFW_BT_OPP_SILENT_MODE:
          bt_opp_s_conf.bt_opp_mode = BTI_OPP_SILENT_FILE_MODE;
          break;
        default:
          return MFW_BT_FAIL;
      }

⌨️ 快捷键说明

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