|
Contiki 3.x
|
Files | |
| file | ble-core.c |
| Basic BLE functions. | |
| file | ble-core.h |
| Basic BLE functions. | |
| file | ble-mac.c |
| A MAC protocol implementation that uses nRF52 IPSP implementation as a link layer. | |
| file | ble-mac.h |
| A MAC protocol implementation that uses nRF52 IPSP implementation as a link layer. | |
Macros | |
| #define | APP_ADV_TIMEOUT 0 |
| Time for which the device must be advertising in non-connectable mode (in seconds). More... | |
| #define | APP_ADV_ADV_INTERVAL MSEC_TO_UNITS(333, UNIT_0_625_MS) |
| The advertising interval. More... | |
| #define | BLE_MAC_MAX_INTERFACE_NUM 1 |
| Maximum number of interfaces, i.e., connection to master devices. | |
Functions | |
| static void | ble_evt_dispatch (ble_evt_t *p_ble_evt) |
| SoftDevice BLE event callback. More... | |
| void | ble_stack_init (void) |
| Initialize and enable the BLE stack. | |
| void | ble_get_mac (uint8_t addr[8]) |
| Return device EUI64 MAC address. More... | |
| void | ble_advertising_init (const char *name) |
| Initialize BLE advertising data. More... | |
| void | ble_advertising_start (void) |
| Start BLE advertising. | |
| void | ble_gap_addr_print (const ble_gap_addr_t *addr) |
| Print GAP address. More... | |
| static void | on_ble_evt (ble_evt_t *p_ble_evt) |
| Function for handling the Application's BLE Stack events. More... | |
| static ble_mac_interface_t * | ble_mac_interface_lookup (ble_ipsp_handle_t *handle) |
| Lookup interface by IPSP connection. More... | |
| static ble_mac_interface_t * | ble_mac_interface_add (eui64_t *peer, ble_ipsp_handle_t *handle) |
| Add IPSP connection to the interface table. More... | |
| static void | ble_mac_interface_delete (ble_mac_interface_t *interface) |
| Remove interface from the interface table. More... | |
| static uint32_t | ble_mac_ipsp_evt_handler_irq (ble_ipsp_handle_t *p_handle, ble_ipsp_evt_t *p_evt) |
| Callback registered with IPSP to receive asynchronous events from the module. More... | |
| static ble_ipsp_handle_t * | find_handle (const linkaddr_t *addr) |
| Lookup IPSP handle by peer address. More... | |
| static int | send_to_peer (ble_ipsp_handle_t *handle) |
| Send packet on a given IPSP handle. More... | |
Variables | |
| static ble_gap_adv_params_t | m_adv_params |
| Parameters to be passed to the stack when starting advertising. More... | |
| process_event_t | ble_event_interface_added |
| This event is broadcast when BLE connection is established. More... | |
| process_event_t | ble_event_interface_deleted |
| This event is broadcast when BLE connection is destroyed. More... | |
| static volatile int | busy_tx |
| Flag is set to 1 when the driver is busy transmitting a packet. More... | |
| static volatile int | busy_rx |
| Flag is set to 1 when there is a received packet pending. More... | |
| const struct mac_driver | ble_ipsp_mac_driver |
| BLE over IPSP MAC driver structure. | |
| const struct mac_driver | ble_ipsp_mac_driver |
| BLE over IPSP MAC driver structure. | |
| process_event_t | ble_event_interface_added |
| This event is broadcast when a new IPSP connection is established. More... | |
| process_event_t | ble_event_interface_deleted |
| This event is broadcast when a IPSP connection is deleted. More... | |
| #define APP_ADV_ADV_INTERVAL MSEC_TO_UNITS(333, UNIT_0_625_MS) |
The advertising interval.
This value can vary between 100ms to 10.24s).
Definition at line 70 of file ble-core.c.
Referenced by ble_advertising_init().
| #define APP_ADV_TIMEOUT 0 |
Time for which the device must be advertising in non-connectable mode (in seconds).
0 disables timeout.
Definition at line 69 of file ble-core.c.
Referenced by ble_advertising_init().
| void ble_advertising_init | ( | const char * | name | ) |
Initialize BLE advertising data.
| name | Human readable device name that will be advertised |
Definition at line 132 of file ble-core.c.
References APP_ADV_ADV_INTERVAL, APP_ADV_TIMEOUT, m_adv_params, and NULL.
Referenced by main().
|
static |
SoftDevice BLE event callback.
| [in] | p_ble_evt | Bluetooth stack event. |
Definition at line 228 of file ble-core.c.
References on_ble_evt().
Referenced by ble_stack_init().
| void ble_gap_addr_print | ( | const ble_gap_addr_t * | addr | ) |
Print GAP address.
| addr | a pointer to address |
Definition at line 187 of file ble-core.c.
Referenced by on_ble_evt().
| void ble_get_mac | ( | uint8_t | addr[8] | ) |
Return device EUI64 MAC address.
| addr | pointer to a buffer to store the address |
Definition at line 116 of file ble-core.c.
Referenced by main().
|
static |
Add IPSP connection to the interface table.
This function binds IPSP connection with peer address.
| peer | a pointer to eui64 address |
| handle | a pointer to IPSP handle |
| a | pointer to an interface structure on success |
| NULL | if interface table is full |
Definition at line 133 of file ble-mac.c.
References ble_event_interface_added, BLE_MAC_MAX_INTERFACE_NUM, NULL, and process_post().
Referenced by ble_mac_ipsp_evt_handler_irq().
|
static |
Remove interface from the interface table.
| interface | a pointer to interface |
Definition at line 152 of file ble-mac.c.
References ble_event_interface_deleted, NULL, and process_post().
Referenced by ble_mac_ipsp_evt_handler_irq().
|
static |
Lookup interface by IPSP connection.
| handle | a pointer to IPSP handle. |
| a | pointer to interface structure |
| NULL | if no interface has been found for a given handle |
Definition at line 109 of file ble-mac.c.
References BLE_MAC_MAX_INTERFACE_NUM, and NULL.
Referenced by ble_mac_ipsp_evt_handler_irq().
|
static |
Callback registered with IPSP to receive asynchronous events from the module.
| [in] | p_handle | Pointer to IPSP handle. |
| [in] | p_evt | Pointer to specific event, generated by IPSP module. |
Definition at line 169 of file ble-mac.c.
References ble_mac_interface_add(), ble_mac_interface_delete(), ble_mac_interface_lookup(), busy_rx, busy_tx, NULL, PACKETBUF_SIZE, and process_poll().
|
static |
Lookup IPSP handle by peer address.
| addr | a pointer to eui64 address. |
| a | pointer to IPSP handle on success |
| NULL | if an IPSP handle for given address haven't been found |
Definition at line 276 of file ble-mac.c.
References BLE_MAC_MAX_INTERFACE_NUM, linkaddr_cmp(), and NULL.
|
static |
Function for handling the Application's BLE Stack events.
| [in] | p_ble_evt | Bluetooth stack event. |
Definition at line 202 of file ble-core.c.
References ble_advertising_start(), and ble_gap_addr_print().
Referenced by ble_evt_dispatch().
|
static |
Send packet on a given IPSP handle.
| handle | a pointer to IPSP handle. |
Definition at line 294 of file ble-mac.c.
References packetbuf_datalen(), and packetbuf_dataptr().
| process_event_t ble_event_interface_added |
This event is broadcast when a new IPSP connection is established.
This event is broadcast when a new IPSP connection is established.
Definition at line 70 of file ble-mac.c.
Referenced by ble_mac_interface_add().
| process_event_t ble_event_interface_added |
This event is broadcast when BLE connection is established.
This event is broadcast when a new IPSP connection is established.
Definition at line 70 of file ble-mac.c.
Referenced by ble_mac_interface_add().
| process_event_t ble_event_interface_deleted |
This event is broadcast when a IPSP connection is deleted.
This event is broadcast when a IPSP connection is deleted.
Definition at line 71 of file ble-mac.c.
Referenced by ble_mac_interface_delete().
| process_event_t ble_event_interface_deleted |
This event is broadcast when BLE connection is destroyed.
This event is broadcast when a IPSP connection is deleted.
Definition at line 71 of file ble-mac.c.
Referenced by ble_mac_interface_delete().
|
static |
Flag is set to 1 when there is a received packet pending.
Definition at line 88 of file ble-mac.c.
Referenced by ble_mac_ipsp_evt_handler_irq().
|
static |
Flag is set to 1 when the driver is busy transmitting a packet.
Definition at line 87 of file ble-mac.c.
Referenced by ble_mac_ipsp_evt_handler_irq().
|
static |
Parameters to be passed to the stack when starting advertising.
Definition at line 72 of file ble-core.c.
Referenced by ble_advertising_init(), and ble_advertising_start().
1.8.6