×
Namespaces

Variants
Actions

How to get bluetooth HCI scan enable parameter

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: patrickfrei (16 Nov 2007)
Last edited: hamishwillee (26 Jul 2012)

Contents

Overview

According to the Bluetooth core specification (v. 2.1) there are several HCI configuration parameters (Host Controller Interface Functional Specification). One of them is the "scan_enable"-parameter. It controls whether or not the Bluetooth device will periodically scan for page attempts and/or inquiry requests from other Bluetooth devices. The according values are shown below:

Value Parameter description
0x00: No Scans enabled
0x01: Inquiry Scan enabled / Page Scan always disabled
0x02: Inquiry Scan disabled / Page Scan enabled
0x03: Inquiry Scan enabled / Page Scan enabled
0x04-0xFF Reserved

Prerequisites

Header files:

#include <bttypes.h>
#include <bt_subscribe.h>

Library:

bluetooth.lib

Capabilities:

LocalServices

Description

The following Uint value is provided in bt_subscribe.h:

const TUint KPropertyKeyBluetoothGetScanningStatus = 
(KUidBluetoothPubSubKeyBase + 3);

The following Int32 & Uid values are provided in e32_property.h (included in bt_subscribe.h):

static const TInt32 KUidSystemCategoryValue=0x101f75b6;
static const TUid KUidSystemCategory={KUidSystemCategoryValue};

The following HCI values are provided in hcitypes.h:

enum THCIScanEnable 
{
ENoScansEnabled=0x00,
EInquiryScanOnly=0x01,
EPageScanOnly=0x02,
EInquiryAndPageScan=0x03
};

Example code

The following code retrieves the HCI configuration parameter:

TBuf<50> aScanningStatus;
TInt value;
TInt ret = RProperty::Get(KUidSystemCategory,
KPropertyKeyBluetoothGetScanningStatus, value);
if(KErrNone==ret)
{
switch(value)
{
case ENoScansEnabled:
{
aScanningStatus.Append(_L("No HCI scans enabled"));
break;
}
case EInquiryScanOnly:
{
aScanningStatus.Append(_L("HCI inquiry scan enabled"));
break;
}
case EPageScanOnly:
{
aScanningStatus.Append(_L("HCI page scan enabled"));
break;
}
case EInquiryAndPageScan:
{
aScanningStatus.Append(_L("HCI inquiry and page scan enabled"));
break;
}
default:
{
aScanningStatus.Append(_L("No scanning status available"));
break;
}
}
}
This page was last modified on 26 July 2012, at 03:43.
56 page views in the last 30 days.
×