📄 headset_scan.c
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2005
FILE NAME
headset_scan.c
DESCRIPTION
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -