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.

../../../../../_images/NAP-PANU.png

NAP-PANU

GN-PANU

A PANU connects to a GN to create an ad-hoc network with other Bluetooth devices.

../../../../../_images/GN-PANU.png

GN-PANU

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.

../../../../../_images/Network_Access_Point_Profile_Stack.png

Network Access Point Profile Stack

../../../../../_images/Group_Ad-hoc_Network_Profile_Stack.png

Group Ad-hoc Network Profile Stack

../../../../../_images/PANU_to_PANU_Profile_Stack.png

PANU to PANU Profile Stack

Feature Set

The functions provided by PAN APIs are as below:

  1. Connecting and Disconnecting: Including functions to connect/disconnect PAN.

  2. Setting Filters: Including functions to set filters to control which Network Protocol types shall be filtered and not transmitted.

  3. Sending and Receiving Data: Including functions to send ethernet data.

Provided APIs

This figure shows the relationship between applications, PAN, and Bluetooth host. Above the horizon line is developed by the applications. Below the horizon line is developed by Realtek.

../../../../../_images/bt_pan_struct.png

PAN Struct

The table below shows a simple description of PAN APIs. PAN related APIs are provided in the sdk\inc\framework\bt\bt_pan.h.

PAN API

Header File

Description

API Reference

bt_pan.h

Connect PAN, send ethernet data etc.

Bluetooth PAN Profile

Functions

PAN Init

Initialize PAN profile.
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

Service discover procedure is shown below:

../../../../../_images/PAN_sdp_discovery.png

PAN SDP Discovery

PAN Connect

Initiate a PAN connection to a remote device. Set source PAN role and destination PAN role of the connection, as shown below:
../../../../../_images/PAN_connect_request.png

PAN Connect Request

Change source PAN role and destination PAN role of the connection, as shown below:
../../../../../_images/PAN_setup_connection_req.png

PAN Setup Connection Request

Accept or reject the incoming setup connection request from the remote device, as shown below:
../../../../../_images/PAN_setup_connection_rsp.png

PAN Setup Connection Response

Request a PAN disconnection, as shown below:
../../../../../_images/PAN_disconnect_request.png

PAN Disconnect Request

Accept or reject the incoming PAN connection from the remote device, as shown below:
../../../../../_images/PAN_connect_confirm.png

PAN Connect_confirm

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

Send a PAN network type filter set message to the remote device, as shown below:
../../../../../_images/PAN_filter_net_type_set_req.png

PAN Filter Network Type Set Request

Send a PAN multicast address filter set message to the remote device, as shown below:
../../../../../_images/PAN_filter_multi_addr_set_req.png

PAN Filter Multicast Address Set Request

PAN Send Ethernet Packet

Send a PAN multicast address filter set message to the remote device, as shown below:
../../../../../_images/PAN_send_ethernet_packet.png

PAN Send Ethernet Packet

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.