headset_scan.c

来自「BlueLab 3.5.2 单声道耳机源码」· C语言 代码 · 共 142 行

C
142
字号
/****************************************************************************Copyright (C) Cambridge Silicon Radio Ltd. 2005-2006Part of BlueLab 3.6.2-releaseFILE NAME    headset_scan.cDESCRIPTION    NOTES*//****************************************************************************    Header files*/#include "headset_private.h"#include "headset_scan.h"#include <connection.h>#include <hfp.h>/****************************************************************************NAME        headsetEnableConnectable    DESCRIPTION    Make the device connectable RETURNS    void*/void headsetEnableConnectable(hsTaskData *app){    hci_scan_enable scan = hci_scan_enable_off;    /* Set the page scan params */    ConnectionWritePagescanActivity(app->radio.page_scan_interval, app->radio.page_scan_window);    /* Make sure that if we're inquiry scanning we don't disable it */    if (app->inquiry_scan_enabled)        scan = hci_scan_enable_inq_and_page;    else        scan = hci_scan_enable_page;    /* Enable scan mode */    ConnectionWriteScanEnable(scan);    /* Set the flag to indicate we're page scanning */    app->page_scan_enabled = 1;}/****************************************************************************NAME        headsetDisableConnectable    DESCRIPTION    Take device out of connectable mode.RETURNS    void*/void headsetDisableConnectable(hsTaskData *app){    hci_scan_enable scan;    /* Make sure that if we're inquiry scanning we don't disable it */    if (app->inquiry_scan_enabled)        scan = hci_scan_enable_inq;    else        scan = hci_scan_enable_off;    /* Enable scan mode */    ConnectionWriteScanEnable(scan);    /* Set the flag to indicate we're page scanning */    app->page_scan_enabled = 0;}/****************************************************************************NAME        headsetEnableDiscoverable    DESCRIPTION    Make the device discoverable. RETURNS    void*/void headsetEnableDiscoverable(hsTaskData *app){    hci_scan_enable scan = hci_scan_enable_off;    /* Set the inquiry scan params */    ConnectionWriteInquiryscanActivity(app->radio.inquiry_scan_interval, app->radio.inquiry_scan_window);    /* Make sure that if we're page scanning we don't disable it */    if (app->page_scan_enabled)        scan = hci_scan_enable_inq_and_page;    else        scan = hci_scan_enable_inq;    /* Enable scan mode */    ConnectionWriteScanEnable(scan);    /* Set the flag to indicate we're page scanning */    app->inquiry_scan_enabled = 1;}/****************************************************************************NAME        headsetDisableDiscoverable    DESCRIPTION    Make the device non-discoverable. RETURNS    void*/void headsetDisableDiscoverable(hsTaskData *app){    hci_scan_enable scan;        /* Make sure that if we're page scanning we don't disable it */    if (app->page_scan_enabled)        scan = hci_scan_enable_page;    else        scan = hci_scan_enable_off;    /* Enable scan mode */    ConnectionWriteScanEnable(scan);    /* Set the flag to indicate we're page scanning */    app->inquiry_scan_enabled = 0;}

⌨️ 快捷键说明

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