Microchip® Advanced Software Framework

bnep.h File Reference
#include "btstack_util.h"
#include "btstack_run_loop.h"
#include "gap.h"
#include <stdint.h>

Data Structures

struct  bnep_channel_event
 
struct  bnep_channel_t
 
struct  bnep_multi_filter_t
 
struct  bnep_net_filter_t
 
struct  bnep_service_t
 

Macros

#define MAX_BNEP_MULTICAST_FILTER   8
 
#define MAX_BNEP_MULTICAST_FILTER_OUT   140
 
#define MAX_BNEP_NETFILTER   8
 
#define MAX_BNEP_NETFILTER_OUT   421
 

Typedefs

typedef struct bnep_channel_event bnep_channel_event_t
 

Enumerations

enum  BNEP_CHANNEL_EVENT { BNEP_CH_EVT_READY_TO_SEND }
 
enum  BNEP_CHANNEL_STATE {
  BNEP_CHANNEL_STATE_CLOSED = 1,
  BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_REQUEST,
  BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_RESPONSE,
  BNEP_CHANNEL_STATE_CONNECTED
}
 
enum  BNEP_CHANNEL_STATE_VAR {
  BNEP_CHANNEL_STATE_VAR_NONE = 0,
  BNEP_CHANNEL_STATE_VAR_SND_NOT_UNDERSTOOD = 1 << 0,
  BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_REQUEST = 1 << 1,
  BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_RESPONSE = 1 << 2,
  BNEP_CHANNEL_STATE_VAR_SND_FILTER_NET_TYPE_SET = 1 << 3,
  BNEP_CHANNEL_STATE_VAR_SND_FILTER_NET_TYPE_RESPONSE = 1 << 4,
  BNEP_CHANNEL_STATE_VAR_SND_FILTER_MULTI_ADDR_SET = 1 << 5,
  BNEP_CHANNEL_STATE_VAR_SND_FILTER_MULTI_ADDR_RESPONSE = 1 << 6
}
 

Functions

int bnep_can_send_packet_now (uint16_t bnep_cid)
 Check if a data packet can be send out. More...
 
int bnep_connect (btstack_packet_handler_t packet_handler, bd_addr_t addr, uint16_t l2cap_psm, uint16_t uuid_src, uint16_t uuid_dest)
 Creates BNEP connection (channel) to a given server on a remote device with baseband address. More...
 
void bnep_disconnect (bd_addr_t addr)
 Disconnects BNEP channel with given identifier. More...
 
void bnep_init (void)
 Set up BNEP. More...
 
void bnep_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)
 
uint8_t bnep_register_service (btstack_packet_handler_t packet_handler, uint16_t service_uuid, uint16_t max_frame_size)
 Registers BNEP service, set a maximum frame size and assigns a packet handler. More...
 
void bnep_request_can_send_now_event (uint16_t bnep_cid)
 Request emission of BNEP_CAN_SEND_NOW as soon as possible. More...
 
int bnep_send (uint16_t bnep_cid, uint8_t *packet, uint16_t len)
 Send a data packet. More...
 
int bnep_set_multicast_filter (uint16_t bnep_cid, bnep_multi_filter_t *filter, uint16_t len)
 Set the multicast address filter. More...
 
int bnep_set_net_type_filter (uint16_t bnep_cid, bnep_net_filter_t *filter, uint16_t len)
 Set the network protocol filter. More...
 
void bnep_set_required_security_level (gap_security_level_t security_level)
 Set security level required for incoming connections, need to be called before registering services. More...
 
void bnep_unregister_service (uint16_t service_uuid)
 Unregister BNEP service. More...
 

#define MAX_BNEP_MULTICAST_FILTER   8
#define MAX_BNEP_MULTICAST_FILTER_OUT   140
#define MAX_BNEP_NETFILTER   8
#define MAX_BNEP_NETFILTER_OUT   421

Enumerator
BNEP_CH_EVT_READY_TO_SEND 
Enumerator
BNEP_CHANNEL_STATE_CLOSED 
BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_REQUEST 
BNEP_CHANNEL_STATE_WAIT_FOR_CONNECTION_RESPONSE 
BNEP_CHANNEL_STATE_CONNECTED 
Enumerator
BNEP_CHANNEL_STATE_VAR_NONE 
BNEP_CHANNEL_STATE_VAR_SND_NOT_UNDERSTOOD 
BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_REQUEST 
BNEP_CHANNEL_STATE_VAR_SND_CONNECTION_RESPONSE 
BNEP_CHANNEL_STATE_VAR_SND_FILTER_NET_TYPE_SET 
BNEP_CHANNEL_STATE_VAR_SND_FILTER_NET_TYPE_RESPONSE 
BNEP_CHANNEL_STATE_VAR_SND_FILTER_MULTI_ADDR_SET 
BNEP_CHANNEL_STATE_VAR_SND_FILTER_MULTI_ADDR_RESPONSE 

int bnep_can_send_packet_now ( uint16_t  bnep_cid)

Check if a data packet can be send out.

int bnep_connect ( btstack_packet_handler_t  packet_handler,
bd_addr_t  addr,
uint16_t  l2cap_psm,
uint16_t  uuid_src,
uint16_t  uuid_dest 
)

Creates BNEP connection (channel) to a given server on a remote device with baseband address.

A new baseband connection will be initiated if necessary.

void bnep_disconnect ( bd_addr_t  addr)

Disconnects BNEP channel with given identifier.

void bnep_init ( void  )

Set up BNEP.

void bnep_packet_handler ( uint8_t  packet_type,
uint16_t  channel,
uint8_t *  packet,
uint16_t  size 
)
uint8_t bnep_register_service ( btstack_packet_handler_t  packet_handler,
uint16_t  service_uuid,
uint16_t  max_frame_size 
)

Registers BNEP service, set a maximum frame size and assigns a packet handler.

On embedded systems, use NULL for connection parameter.

void bnep_request_can_send_now_event ( uint16_t  bnep_cid)

Request emission of BNEP_CAN_SEND_NOW as soon as possible.

Note
BNEP_CAN_SEND_NOW might be emitted during call to this function so packet handler should be ready to handle it
Parameters
bnep_cid
int bnep_send ( uint16_t  bnep_cid,
uint8_t *  packet,
uint16_t  len 
)

Send a data packet.

int bnep_set_multicast_filter ( uint16_t  bnep_cid,
bnep_multi_filter_t filter,
uint16_t  len 
)

Set the multicast address filter.

int bnep_set_net_type_filter ( uint16_t  bnep_cid,
bnep_net_filter_t filter,
uint16_t  len 
)

Set the network protocol filter.

void bnep_set_required_security_level ( gap_security_level_t  security_level)

Set security level required for incoming connections, need to be called before registering services.

void bnep_unregister_service ( uint16_t  service_uuid)

Unregister BNEP service.