PAN
The purpose of this document is to give an overview of the Personal Area Networking Profile. PAN profile describes how two or more Bluetooth enabled devices can form an ad-hoc network and how the same mechanism can be used to access a remote network through a network access point.
Terminology and Concepts
PAN Role
Network Access Points - A NAP is a unit that contains one or more Bluetooth radio devices and acts as a bridge, proxy, or router between a Bluetooth network and some other network technology.
Group Ad-hoc Networks - A Bluetooth device that supports the GN service is able to forward ethernet packets to each of the connected Bluetooth devices, the PAN users, as needed.
PAN Users - PANU is the Bluetooth device that uses either the NAP or the GN service. PANU supports the client role for both the NAP and GN roles, and direct PANU to PANU communication.
PAN Scenarios
For the PAN profile, three general scenarios are discussed:
Network Access Points
Group Ad-hoc Networks
PANU-PANU
NAP-PANU
A PANU connects to a NAP in order to gain access to an advertised network service.
GN-PANU
A PANU connects to a GN to create an ad-hoc network with other Bluetooth devices.
PANU-PANU
In this scenario, a point to point connection between two PANUs allows direct communication between these two nodes only.
PAN Profile Stack
The figures below show the protocols and entities used in each of the three roles defined by the PAN profile.
Feature Set
The functions provided by PAN APIs are as below:
Connecting and Disconnecting: Including functions to connect/disconnect PAN.
Setting Filters: Including functions to set filters to control which Network Protocol types shall be filtered and not transmitted.
Sending and Receiving Data: Including functions to send ethernet data.
Provided APIs
This figure shows the relationship between applications, PAN, and Bluetooth Protocol Stack. Above the horizon line is developed by the applications. Below the horizon line is developed by Realtek.
The table below shows a simple description of PAN APIs. PAN related APIs are provided in the sdk\inc\framework\bt\bt_pan.h
.
Header file |
Description |
API Reference |
---|---|---|
bt_pan.h |
Connect PAN, send ethernet data etc. |
Functions
PAN Init
bool bt_pan_init() - Initialize PAN profile.
bool bt_pan_cback_register() - Register PAN event callback.
void app_pan_init(void)
{
bt_sdp_record_add((void *)panu_sdp_record);
bt_pan_init();
bt_pan_cback_register(app_pan_bt_cback);
}
PAN Service Discovery
PAN Connect
bool bt_pan_connect_req() - Initiate a PAN connection to a remote device. Set source PAN role and destination PAN role of the connection.
bool bt_pan_setup_connection_req() - Change source PAN role and destination PAN role of the connection.
bool bt_pan_setup_connection_rsp() - Accept or reject the incoming setup connection request from the remote device.
bool bt_pan_disconnect_req() - Request a PAN disconnection, as shown below.
bool bt_pan_connect_cfm() - Accept or reject the incoming PAN connection from the remote device.
static void app_pan_bt_cback(T_BT_PAN_EVENT event_type, void *event_buf, uint16_t buf_len)
{
T_BT_PAN_EVENT_PARAM *param = event_buf;
T_APP_BR_LINK *p_link;
bool handle = true;
switch (event_type)
{
case BT_PAN_EVENT_CONN_IND:
{
p_link = app_find_br_link(param->pan_conn_ind.bd_addr);
if (p_link != NULL)
{
bt_pan_connect_cfm(p_link->bd_addr, true);
}
}
break;
}
PAN Set Filter
bool bt_pan_filter_net_type_set() - Send a PAN network type filter set message to the remote device.
bool bt_pan_filter_multi_addr_set() - Send a PAN multicast address filter set message to the remote device.
PAN Send Ethernet Packet
bool bt_pan_send() - Send a PAN ethernet packet to the remote device.
Sample Projects
SDK provides a corresponding demo application for developers’ reference in development.The BR/EDR PAN gives a simple example on how to use PAN.