Skip to content
Snippets Groups Projects
Select Git revision
  • d35e31f76366995600033642df1e479fccb84a79
  • ctx default
  • master protected
  • rahix/bhi160-cleanup
  • schneider/ble-hid
  • schneider/bsec
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/exnostat-remove-gapple
  • schneider/g-watch
  • schneider/ble-time
  • schneider/bonding-fail-if-full
  • schneider/bonding-naming
  • schneider/rng-btle
  • schneider/trng-enable-fix
  • schneider/sdk-0.2.1-12
  • schneider/ble-critical-section
  • schneider/covid-tracing
  • schneider/ble-fixes-2020-3
  • schneider/spo2-playground
  • schneider/mpy-portstate
  • schneider/fix-ble-mac-write
  • v1.15
  • v1.14
  • v1.13
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
40 results

ble_main.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    ble_main.c 30.58 KiB
    /* card10:
     * Copied from lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/fit/fit_main.c
     *
     * Also have a look at lib/sdk/Applications/EvKitExamples/BLE_fit/fit_main.c which has some changes
     * to this file regarding handling of OOB paring data
     *
     * This file contains some application logic taken from the "fit" example.
     *
     * Things have been renamed:
     * fit -> ble
     * Fit -> Ble
     * FIT -> BLE
     */
    /* clang-format off */
    /* clang-formet turned off for easier diffing against orginal file */
    #include <stdio.h>
    #include <string.h>
    #include "wsf_types.h"
    #include "util/bstream.h"
    #include "fs/fs_util.h"
    #include "wsf_msg.h"
    #include "wsf_trace.h"
    #include "hci_api.h"
    #include "l2c_api.h"
    #include "dm_api.h"
    #include "att_api.h"
    #include "smp_api.h"
    #include "app_api.h"
    #include "app_db.h"
    #include "app_ui.h"
    #include "app_hw.h"
    #include "svc_ch.h"
    #include "svc_core.h"
    #include "svc_hrs.h"
    #include "svc_dis.h"
    #include "svc_batt.h"
    #include "svc_rscs.h"
    #include "bas/bas_api.h"
    #include "hrps/hrps_api.h"
    #include "rscp/rscp_api.h"
    #include "profiles/gap_api.h"
    #include "cccd.h"
    #include "ess.h"
    
    #include "ble_api.h"
    #include "epicardium.h"
    #include "api/interrupt-sender.h"
    #include "modules/log.h"
    
    #define SCAN_REPORTS_NUM	16
    
    static bool active;
    static uint8_t advertising_mode = APP_MODE_NONE;
    static uint8_t advertising_mode_target = APP_MODE_NONE;
    static enum ble_event_type ble_event;
    static struct epic_scan_report scan_reports[SCAN_REPORTS_NUM];
    static int scan_reports_head;
    static int scan_reports_tail;
    
    /**************************************************************************************************
      Macros
    **************************************************************************************************/
    
    /*! WSF message event starting value */
    #define BLE_MSG_START               0xA0
    
    /*! WSF message event enumeration */
    enum
    {
      BLE_BATT_TIMER_IND = BLE_MSG_START,                     /*! Battery measurement timer expired */