Nordic Thingy:52 v2.2.0
m_ble.h
1 /*
2  Copyright (c) 2010 - 2017, Nordic Semiconductor ASA
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form, except as embedded into a Nordic
12  Semiconductor ASA integrated circuit in a product or a software update for
13  such product, must reproduce the above copyright notice, this list of
14  conditions and the following disclaimer in the documentation and/or other
15  materials provided with the distribution.
16 
17  3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  contributors may be used to endorse or promote products derived from this
19  software without specific prior written permission.
20 
21  4. This software, with or without modification, must only be used with a
22  Nordic Semiconductor ASA integrated circuit.
23 
24  5. Any software provided in binary form under this license must not be reverse
25  engineered, decompiled, modified and/or disassembled.
26 
27  THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
28  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29  OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
30  DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
31  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
36  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
48 #ifndef __THINGY_BLE_H__
49 #define __THINGY_BLE_H__
50 
51 #include <stdint.h>
52 #include <stdbool.h>
53 #include "thingy_config.h"
54 #include "ble.h"
55 
58 typedef enum
59 {
60  thingy_ble_evt_connected,
61  thingy_ble_evt_disconnected,
62  thingy_ble_evt_timeout
64 
67 typedef struct
68 {
69  m_ble_evt_type_t evt_type;
70  void * p_data;
71  uint32_t size;
73 
74 typedef void (*m_ble_evt_handler_t)(m_ble_evt_t * p_evt);
75 
78 typedef void (*m_ble_service_evt_cb_t)(ble_evt_t * p_ble_evt);
79 typedef uint32_t (*m_ble_service_init_cb_t)(bool flash_reinit);
80 
83 typedef struct
84 {
85  m_ble_service_init_cb_t init_cb;
86  m_ble_service_evt_cb_t ble_evt_cb;
88 
91 typedef struct
92 {
93  m_ble_evt_handler_t evt_handler;
94  m_ble_service_handle_t * p_service_handles;
95  uint32_t service_num;
97 
104 uint32_t m_ble_init(m_ble_init_t * p_params);
105 
112 uint32_t m_ble_start(void);
113 
120 uint32_t m_ble_stop(void);
121 
122 #endif
123 
uint32_t m_ble_init(m_ble_init_t *p_params)
Function for initializing the BLE handling module..
m_ble_evt_type_t
BLE event types.
Definition: m_ble.h:58
BLE service handle structure.
Definition: m_ble.h:83
uint32_t m_ble_stop(void)
Function for stopping the BLE handling module.
BLE event structure.
Definition: m_ble.h:67
uint32_t m_ble_start(void)
Function for starting the BLE handling module.
void(* m_ble_service_evt_cb_t)(ble_evt_t *p_ble_evt)
BLE service callback definitions.
Definition: m_ble.h:78
Initialization parameters.
Definition: m_ble.h:91