QCC3034连接 iphone会出现断开情况
需要修改内容如下:
/*
Copyright (c) 2004 - 2016 Qualcomm Technologies International, Ltd.
*/
/*!
@file
@ingroup sink_app
@brief
Handles link policy and role switch settings across all devices/profiles
*/
/****************************************************************************
Header files
*/
#include "sink_private_data.h"
#include "sink_main_task.h"
#include "sink_private_data_config_def.h"
#include "sink_link_policy.h"
#include "sink_statemanager.h"
#include "sink_devicemanager.h"
#include "sink_swat.h"
#include "sink_audio_routing.h"
#include <sink.h>
#ifdef ENABLE_PBAP
#include <bdaddr.h>
#include "sink_pbap.h"
#endif
#ifdef ENABLE_PEER
/* headers required for sending DM_HCI_QOS_SETUP_REQ */
#include <vm.h>
#include <app/bluestack/types.h>
#include <app/bluestack/bluetooth.h>
#include <app/bluestack/hci.h>
#include <app/bluestack/dm_prim.h>
#endif
/* Lower power table for HFP SLC */
static const lp_power_table lp_powertable_default[2]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_passive, 0, 0, 0, 0, 30}, /* Passive mode 30 seconds */
{lp_sniff, 800, 800, 2, 1, 0 } /* Enter sniff mode (500mS)*/
};
/* Lower power table for HFP when an audio connection is open */
static const lp_power_table lp_powertable_sco[2]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_passive, 0, 0, 0, 0, 30}, /*Passive mode 30 seconds */
{lp_sniff, 160, 160, 2, 1, 0} /* Enter sniff mode (100mS)*/
};
static const lp_power_table lp_powertable_a2dp_default[2]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_active, 0, 0, 0, 0, 10}, /* Active mode 10 seconds */
{lp_sniff, 800, 800, 2, 1, 0 } /* Enter sniff mode (500mS)*/
};
/* Lower power table for A2DP. */
static const lp_power_table lp_powertable_a2dp_stream_sink[]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_passive, 0, 0, 0, 0, 0} /* Go into passive mode and stay there */
};
/* Lower power table for A2DP. */
static const lp_power_table lp_powertable_a2dp_stream_source[]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_active, 0, 0, 0, 0, 0} /* Go into active mode and stay there */
};
#if defined ENABLE_PBAP || defined ENABLE_GAIA
/* Power table for PBAP or GAIA DFU access. */
static const lp_power_table lp_powertable_data_access[]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_active, 0, 0, 0, 0, 0} /* Go into active mode and stay there */
};
#endif /* defined ENABLE_PBAP || defined ENABLE_GAIA */
#ifdef ENABLE_AVRCP
/* Lower power table for AVRCP */
static const lp_power_table lp_powertable_avrcp[]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_active, 0, 0, 0, 0, AVRCP_ACTIVE_MODE_INTERVAL}, /* Go into active mode for 10 seconds*/
{lp_sniff, 800, 800, 2, 1, 0 }
};
#endif
#ifdef ENABLE_SUBWOOFER
static const lp_power_table lp_powertable_subwoofer[2]=
{
/* mode, min_interval, max_interval, attempt, timeout, duration */
{lp_active, 0, 0, 0, 0, 10}, /* Active mode 10 seconds */
{lp_sniff, 160, 160, 2, 1, 0} /* Enter sniff mode (100mS)*/
};
#endif
#ifdef DEBUG_LP
#define LP_DEBUG(x) DEBUG(x)
#else
#define LP_DEBUG(x)
#endif
static uint16 linkPolicyNumberPhysicalConnections (void)
{
uint16 connections = 0;
Sink sink_pri, sink_sec, sink_a2dp_pri, sink_a2dp_sec;
/* obtain any hfp link sinks */
HfpLinkGetSlcSink(hfp_primary_link, &sink_pri);
HfpLinkGetSlcSink(hfp_secondary_link, &sink_sec);
/* obtain sinks for any a2dp links */
sink_a2dp_pri = A2dpSignallingGetSink(getA2dpLinkDataDeviceId(a2dp_primary));
sink_a2dp_sec = A2dpSignallingGetSink(getA2dpLinkDataDeviceId(a2dp_secondary));
/* if primary hfp exists then check its role */
if (sink_pri)
{
connections++;
}
/* if secondary hfp connection then check its role */
if (sink_sec)
{
connections++;
}
/* if primary a2dp exists and it is not the same device as pri or sec hfp connections */
if (sink_a2dp_pri && !deviceManagerIsSameDevice(a2dp_primary, hfp_primary_link) && !deviceManagerIsSameDevice(a2dp_primary, hfp_secondary_link))
{
connections++;
}
/* if secondary a2dp exists and it is not the same device as pri or sec hfp connections */
if (sink_a2dp_sec && !deviceManagerIsSameDevice(a2dp_secondary, hfp_primary_link) && !deviceManagerIsSameDevice(a2dp_secondary, hfp_secondary_link))
{
connections++;
}
LP_DEBUG(("LP: Number of physical connections = %u\n", connections ));
return connections;
}
/****************************************************************************
NAME
linkPolicyUseDefaultSettings
DESCRIPTION
set the link policy based on no a2dp streaming or sco
RETURNS
void
*/
static void linkPolicyUseDefaultSettings(Sink sink)
{
/* Set up our sniff sub rate params for SLC */
power_table *userPowerTable = sinkDataGetUserPowerTable();
ssr_params_t slc_params;
sinkDataGetSsrSlcParams(&slc_params);
ConnectionSetSniffSubRatePolicy(sink, slc_params.max_remote_ssr_latency, slc_params.min_remote_ssr_tim