当前位置: 首页 > news >正文

QCC30XX如何查找本地地址码

查找本地地址段/**********************************************************************
Copyright (c) 2016 - 2017 Qualcomm Technologies International, Ltd.
 
 
FILE NAME
    sink_private_data.c
 
DESCRIPTION
    This module works as a container for all private and common data that is used across sink
    qpplication. It provides API to access the data from outside. It interacts with configuration
    entities to read/write configuration data. More over this module contains module specific
    run time data (as a common runtime data for entire sink application), and those data also
    exposed using defined API's
 
 NOTES
      Module does not have any intelligence to manipulate the data, or verify the data or its
      contents ,it is the user to decide hoe to use this data and when to update the data.
*/
 
#include <stdlib.h>
#include <ps.h>
#include <vmtypes.h>
#include <bdaddr.h>
#include <byte_utils.h>
 
#include "sink_private_data.h"
#include "sink_dut.h"
#include "sink_malloc_debug.h"
#include "sink_configmanager.h"
 
#include <local_device.h>
 
#ifdef DEBUG_SINK_PRIVATE_DATA
#define SINK_DATA_DEBUG(x) DEBUG(x)
#define SINK_DATA_ERROR(x) TOLERATED_ERROR(x)
#else
#define SINK_DATA_DEBUG(x)
#define SINK_DATA_ERROR(x)
#endif
 
#ifdef DEBUG_MAIN
    #define MAIN_DEBUG(x) DEBUG(x)
#else
    #define MAIN_DEBUG(x)
#endif
/* Referance to Global Data for sink private module */
typedef struct __sinkdata_globaldata_t
{
    unsigned panic_reconnect:1; /* Are we using panic action? Bit to inidcate panic reconnection action is used  */
    unsigned paging_in_progress:1; /* Bit to indicate that device is curretly paging whilst in connectable state*/
    unsigned powerup_no_connection:1; /* Bit to indicate device has powered and no connections yet */
    unsigned confirmation:1; /* Bit to indicate user auth confirmation status */
    unsigned SinkInitialising:1; /* Bit to indicate sink is in initialising state */
    unsigned PowerOffIsEnabled:1; /* Bit to indicate power off is enabled */
    unsigned debug_keys_enabled:1; /* Bit to indicate debug keys enabled */
    unsigned stream_protection_state:2; /* Holds stream protection state */
    unsigned MultipointEnable:1; /* Bit to indicate multipoint enabled */
    unsigned _spare1_:6;
    unsigned gEventQueuedOnConnection:8; /* variable to hold evet queued while in connection */
    unsigned dfu_access:1;              /* Link Policy expedites DFU data transfer */
    unsigned display_link_keys:1; /* Bit used to indicate if link keys should be displayed */
    unsigned _spare2_:6;
    uint16 NoOfReconnectionAttempts; /* Holdes current number of reconnection attempts */
    uint16 connection_in_progress;  /* flag used to block role switch requests until all connections are complete or abandoned */
#ifdef ENABLE_SQIFVP
    unsigned               partitions_mounted:8;
    unsigned               unused:8;
#endif
    bdaddr                   *linkloss_bd_addr;  /** bdaddr of a2dp device that had the last link loss. */
    tp_bdaddr                *confirmation_addr;
    bdaddr local_bd_addr; /* Local BD Address of the sink device available in ps */
    power_table              *user_power_table;  /* pointer to user power table if available in ps */
}sinkdata_globaldata_t;
 
/* PSKEY for BD ADDRESS */
#define PSKEY_BDADDR   0x0001
#define LAP_MSW_OFFSET 0
#define LAP_LSW_OFFSET 1
#define UAP_OFFSET 2
#define NAP_OFFSET 3
 
/* Global data strcuture element for sink private data */
static sinkdata_globaldata_t gSinkData;
#define GSINKDATA  gSinkData
 
 
/**********************************************************************
***************  External Interface Function Implemetations  **********************
***********************************************************************/
 
/**********************************************************************
        Interfaces for accessing Configurable Items
*/
/**********************************************************************
  Interfaces for Initializing Local Address, which read the local address.
*/
bool  sinkDataInitLocalBdAddrFromPs(void)
{
    bool result = FALSE;
 
    uint16 size = PS_SIZE_ADJ(sizeof(GSINKDATA.local_bd_addr));
    uint16* bd_addr_data = (uint16*)PanicUnlessNew(bdaddr);
 
    BdaddrSetZero(&GSINKDATA.local_bd_addr);
 
    if(size == PsFullRetrieve(PSKEY_BDADDR, bd_addr_data, size))
    {
        GSINKDATA.local_bd_addr.nap = bd_addr_data[NAP_OFFSET];
        GSINKDATA.local_bd_addr.uap = bd_addr_data[UAP_OFFSET];
        GSINKDATA.local_bd_addr.lap = MAKELONG(bd_addr_data[LAP_LSW_OFFSET], bd_addr_data[LAP_MSW_OFFSET]);
 
        SINK_DATA_DEBUG(("CONF: PSKEY_BDADDR [%04x %02x %06lx]\n",
                GSINKDATA.local_bd_addr.nap, GSINKDATA.local_bd_addr.uap, GSINKDATA.local_bd_addr.lap));
        result = TRUE;
    }
    else
    {
        GSINKDATA.local_bd_addr = LocalDeviceGetBdAddr();
    }
    MAIN_DEBUG(("CONF: PSKEY_BDADDR [%04x %02x %06lx]\n",
            GSINKDATA.local_bd_addr.nap, GSINKDATA.local_bd_addr.uap, GSINKDATA.local_bd_addr.lap));
    free(bd_addr_data);
 
    return result;
}
 
/**********************************************************************
  Interfaces for checking reconnect on panic configuration is enabled or not
*/
bool sinkDataIsReconnectOnPanic(void)
{
    bool reconnect_on_panic = FALSE;
    sinkdata_readonly_config_def_t *read_configdata = NULL;
    SINK_DATA_DEBUG(("SinkData:sinkDataIsReconnectOnPanic()\n"));
 
    if (configManagerGetReadOnlyConfig(SINKDATA_READONLY_CONFIG_BLK_ID, (const void **)&read_configdata))
    {
        reconnect_on_panic = read_configdata->ReconnectOnPanic;
        configManagerReleaseConfig(SINKDATA_READONLY_CONFIG_BLK_ID);
    }
    SINK_DATA_DEBUG(("SinkData:reconnect_on_panic = %d \n",reconnect_on_panic));
    return (reconnect_on_panic)?TRUE : FALSE;
}
 
/**********************************************************************
  Interfaces for checking power of after PDL reset configuration is enabled or not
*/
bool sinkDataIsPowerOffAfterPDLReset(void)
{
    bool poweroff_pdl_reset = FALSE;
    sinkdata_readonly_config_def_t *read_configdata = NULL;
    SINK_DATA_DEBUG(("SinkData:sinkDataIsPowerOffAfterPDLReset()\n"));
 
    if (configManagerGetReadOnlyConfig(SINKDATA_READONLY_CONFIG_BLK_ID, (const void **)&read_configdata))
    {
        poweroff_pdl_reset = read_configdata->PowerOffAfterPDLReset;
        configManagerReleaseConfig(SINKDATA_READONLY_CONFIG_BLK_ID);
    }
    SINK_DATA_DEBUG(("SinkData: poweroff_pdl_reset = %d \n",poweroff_pdl_reset));
    return (poweroff_pdl_reset)?TRUE : FALSE;
}
 
/**********************************************************************
  Interfaces  for checking does sink shoule be in discoverable mode all time
  configuration is enabled or not
*/
bool sinkDataIsDiscoverableAtAllTimes(void)
{
    bool discoverable_alltime = FALSE;
    sinkdata_readonly_config_def_t *read_configdata = NULL;
    SINK_DATA_DEBUG(("SinkData:sinkDataIsDiscoverableAtAllTimes()\n"));
 
    if (configManagerGetReadOnlyConfig(SINKDATA_READONLY_CONFIG_BLK_ID, (const void **)&read_configdata))
    {
        discoverable_alltime = read_configdata->RemainDiscoverableAtAllTimes;
        configManagerReleaseConfig(SINKDATA_READONLY_CONFIG_BLK_ID);
    }
    SINK_DATA_DEBUG(("SinkData: discoverable_alltime = %d\n",discoverable_alltime));
    return (discoverable_alltime)?TRUE : FALSE;
}
 
/**********************************************************************
  Interfaces  for checking DisablePowerOffAfterPowerOn configuration is enabled or not
*/
bool sinkDataCheckDisablePowerOffAfterPowerOn(void)
{
    bool disable_poweroff = FALSE;
    sinkdata_readonly_config_def_t *read_configdata = NULL;
    SINK_DATA_DEBUG(("SinkData:sinkDataCheckDisablePowerOffAfterPowerOn()\n"));
 
    if (configManagerGetReadOnlyConfig(SINKDATA_READONLY_CONFIG_BLK_ID, (const void **)&read_configdata))
    {
        disable_poweroff = read_configdata->DisablePowerOffAfterPowerOn;
        configManagerReleaseConfig(SINKDATA_READONLY_CONFIG_BLK_ID);
    }
    SINK_DATA_DEBUG(("SinkData: disable_poweroff = %d\n",disable_poweroff));
    return (disable_poweroff)?TRUE : FALSE;
}
 
/**********************************************************************
  Interfaces  for checking pairing mode on connection failure configuration is enabled or not
*/
bool sinkDataEntrePairingModeOnConFailure(void)
{
    bool failuretoconnect = FALSE;
    sinkdata_readonly_config_def_t *read_configdata = NULL;
    SINK_DATA_DEBUG(("SinkData:sinkDataPairingModeOnConnectionFailure()\n"));
 
    if (configManagerGetReadOnlyConfig(SINKDATA_READONLY_CONFIG_BLK_ID, (const void **)&read_configdata))
    {
        failuretoconnect = read_configdata->EnterPairingModeOnFailureToConn;
        configManagerReleaseConfig(SINKDATA_READONLY_CONFIG_BLK_ID);
    }
    SINK_DATA_DEBUG(("SinkData: failuretoconnect = %d\n",failuretoconnect));
    return (failuretoconnect)?TRUE : FALSE;
}
 
/**********************************************************************
  Interfaces for checking Power Off OnlyIf VReg Enble is low configuration is enabled or not
*/
bool sinkDataIsPowerOffOnlyIfVRegEnlow(void)
{
    bool vreg_enlow = FALSE;
    sinkdata_readonly_config_def_t *read_configdata = NULL;
    SINK_DATA_DEBUG(("SinkData:sinkDataIsPowerOffOnlyIfVRegEnlow()\n"));
 
    if (configManagerGetReadOnlyConfig(SINKDATA_READONLY_CONFIG_BLK_ID, (const void **)&read_configdata))
    {
        vreg_enlow = read_configdata->PowerOffOnlyIfVRegEnLow;
        configManagerReleaseConfig(SINKDATA_READONLY_CONFIG_BLK_ID);
    }
    SINK_DATA_DEBUG(("SinkData: vreg_enlow = %d\n",vreg_enlow));
    return (vreg_enlow)?TRUE : FALSE;
}
 
/**********************************************************************/
bool sinkDataAllowAutomaticPowerOffWhenCharging(void)
{
    bool power_off_when_charging = FALSE;
    sinkdata_readonly_config_def_t *read_configdata = NULL;
    SINK_DATA_DEBUG(("SinkData:sinkDataAllowAutomaticPowerOffWhenCharging()\n"));
 
    if (configManagerGetReadOnlyConfig(SINKDATA_READONLY_CONFIG_BLK_ID, (const void **)&read_configdata))
    {
        power_off_when_charging = read_configdata->AllowAutomaticPowerOffWhenCharging;
        configManagerReleaseC
http://www.lryc.cn/news/357106.html

相关文章:

  • 基于 DCT 的图像滤波
  • spdlog日志库源码:自定义异常类spdlog_ex
  • 3.每日LeetCode-数组类,爬楼梯(Go,Java,Python)
  • 单节点11.2.0.3参数文件恢复到RAC11.2.0.4启动失败
  • Windows电脑高颜值桌面便利贴,便签怎么设置
  • 代码随想录35期Day54-Java
  • Ubuntu使用sudo命令
  • 三方语言中调用, Go Energy GUI编译的dll动态链接库CEF
  • Go微服务: Grpc服务注册在Consul的示例(非Go-Micro)
  • Java+Swing+Mysql实现飞机订票系统
  • 2024 rk
  • Java实现多张图片合并保存到pdf中
  • 揭秘智慧校园:可视化技术引领教育新篇章
  • 基础9 探索图形化编程的奥秘:从物联网到工业自动化
  • RPC-----RCF
  • StarRocks中,这些配置项是表属性的一部分
  • Activity->Activity生命周期
  • 乐鑫ESP串口驱动安装,安装cp210x驱动
  • Django缓存
  • Python 元组
  • JAVA面试题大全(十八)
  • 如何利用Firebase Hosting来托管网站
  • 揭秘“循环消费”模式:消费即收益,购物新体验
  • 图片怎样在线改像素大小?电脑快速修改图片大小的方法
  • SELINUX=enforcing时无法启动httpd服务的解决方案(semanage命令以及setroubleshoot-server插件的妙用)
  • 【C++】list的使用方法和模拟实现
  • 【物联网实战项目】STM32C8T6+esp8266/mqtt+dht11+onenet+uniapp
  • Pyhton 二叉树层级遍历
  • Flutter 中的 FadeTransition 小部件:全面指南
  • 缓存存储器:性能提升的关键