Skip to content

Commit

Permalink
changed few name add updated write
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoincorrect committed Mar 17, 2021
1 parent e422cf7 commit 95cbc22
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 210 deletions.
16 changes: 0 additions & 16 deletions Embedded_system/smart_mask/src/ble/app_ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "ble_conn_params.h"
#include "ble_err.h"
#include "ble_hci.h"
#include "ble_lbs.h"
#include "ble_srv_common.h"
#include "nrf_ble_gatt.h"
#include "nrf_ble_qwr.h"
Expand Down Expand Up @@ -65,8 +64,6 @@
#define MAX_CONN_PARAMS_UPDATE_COUNT 3
// Sensors Measurement Service instance
BLE_SMS_DEF(m_sms);
// LED Button Service instance
BLE_LBS_DEF(m_lbs);
// GATT module instance
NRF_BLE_GATT_DEF(m_gatt);
// Context for the Queued Write module.*/
Expand Down Expand Up @@ -233,11 +230,6 @@ static void services_init(void)
err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
APP_ERROR_CHECK(err_code);

// Initialize LBS.
// lbs_init.led_write_handler = m_app_ble_conf->led_write_handler;
// err_code = ble_lbs_init(&m_lbs, &lbs_init);
// APP_ERROR_CHECK(err_code);

// Initialize SMS.
sms_init.sensor_ctrl_write_cb = m_app_ble_conf->sensor_ctrl_write;

Expand Down Expand Up @@ -315,7 +307,6 @@ static void advertising_start(void)
err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
APP_ERROR_CHECK(err_code);

// bsp_board_led_on(ADVERTISING_LED);
NRF_LOG_INFO("ADVERTISING");
}

Expand All @@ -334,21 +325,15 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
case BLE_GAP_EVT_CONNECTED:
NRF_LOG_INFO("Connected");
// bsp_board_led_on(CONNECTED_LED);
// bsp_board_led_off(ADVERTISING_LED);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
APP_ERROR_CHECK(err_code);
// err_code = app_button_enable();
APP_ERROR_CHECK(err_code);
break;

case BLE_GAP_EVT_DISCONNECTED:
NRF_LOG_INFO("Disconnected");
// bsp_board_led_off(CONNECTED_LED);
m_conn_handle = BLE_CONN_HANDLE_INVALID;
// err_code = app_button_disable();
//APP_ERROR_CHECK(err_code);
advertising_start();
break;

Expand Down Expand Up @@ -433,7 +418,6 @@ ret_code_t app_ble_init(app_ble_conf_t * app_ble_conf)
{
m_app_ble_conf = app_ble_conf;
app_ble_conf->ble_conn_handle = &m_conn_handle;
app_ble_conf->ble_lbs = &m_lbs;
app_ble_conf->ble_sms = &m_sms;
ble_stack_init();
gap_params_init();
Expand Down
13 changes: 12 additions & 1 deletion Embedded_system/smart_mask/src/ble/app_ble.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#ifndef __app_ble_h__
#define __app_ble_h__

/*************************
* Includes
************************/

#include "ble_lbs.h"
#include "ble_sms.h"
#include "sdk_errors.h"

/*************************
* Typedefs
************************/

typedef struct
{
ble_sms_sensor_ctrl_write_cb sensor_ctrl_write;
uint16_t * ble_conn_handle;
ble_sms_t * ble_sms;
ble_lbs_t * ble_lbs;
} app_ble_conf_t;

/*************************
* Function Declarations
************************/

ret_code_t app_ble_init(app_ble_conf_t * app_ble_conf);

bool app_ble_is_connected(void);
Expand Down
Loading

0 comments on commit 95cbc22

Please sign in to comment.