Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • card10/firmware
  • annejan/firmware
  • astro/firmware
  • fpletz/firmware
  • gerd/firmware
  • fleur/firmware
  • swym/firmware
  • l/firmware
  • uberardy/firmware
  • wink/firmware
  • madonius/firmware
  • mot/firmware
  • filid/firmware
  • q3k/firmware
  • hauke/firmware
  • Woazboat/firmware
  • pink/firmware
  • mossmann/firmware
  • omniskop/firmware
  • zenox/firmware
  • trilader/firmware
  • Danukeru/firmware
  • shoragan/firmware
  • zlatko/firmware
  • sistason/firmware
  • datenwolf/firmware
  • bene/firmware
  • amedee/firmware
  • martinling/firmware
  • griffon/firmware
  • chris007/firmware
  • adisbladis/firmware
  • dbrgn/firmware
  • jelly/firmware
  • rnestler/firmware
  • mh/firmware
  • ln/firmware
  • penguineer/firmware
  • monkeydom/firmware
  • jens/firmware
  • jnaulty/firmware
  • jeffmakes/firmware
  • marekventur/firmware
  • pete/firmware
  • h2obrain/firmware
  • DooMMasteR/firmware
  • jackie/firmware
  • prof_r/firmware
  • Draradech/firmware
  • Kartoffel/firmware
  • hinerk/firmware
  • abbradar/firmware
  • JustTB/firmware
  • LuKaRo/firmware
  • iggy/firmware
  • ente/firmware
  • flgr/firmware
  • Lorphos/firmware
  • matejo/firmware
  • ceddral7/firmware
  • danb/firmware
  • joshi/firmware
  • melle/firmware
  • fitch/firmware
  • deurknop/firmware
  • sargon/firmware
  • markus/firmware
  • kloenk/firmware
  • lucaswerkmeister/firmware
  • derf/firmware
  • meh/firmware
  • dx/card10-firmware
  • torben/firmware
  • yuvadm/firmware
  • AndyBS/firmware
  • klausdieter1/firmware
  • katzenparadoxon/firmware
  • xiretza/firmware
  • ole/firmware
  • techy/firmware
  • thor77/firmware
  • TilCreator/firmware
  • fuchsi/firmware
  • dos/firmware
  • yrlf/firmware
  • PetePriority/firmware
  • SuperVirus/firmware
  • sur5r/firmware
  • tazz/firmware
  • Alienmaster/firmware
  • flo_h/firmware
  • baldo/firmware
  • mmu_man/firmware
  • Foaly/firmware
  • sodoku/firmware
  • Guinness/firmware
  • ssp/firmware
  • led02/firmware
  • Stormwind/firmware
  • arist/firmware
  • coon/firmware
  • mdik/firmware
  • pippin/firmware
  • royrobotiks/firmware
  • zigot83/firmware
  • mo_k/firmware
106 results
Select Git revision
Loading items
Show changes
Showing
with 3769 additions and 220 deletions
#pragma once
#include "epicardium.h"
#include <stdint.h>
#include "wsf_types.h"
#include "att_api.h"
#include "dm_api.h"
#define CARD10_UUID_SUFFIX \
0x42, 0x23, 0x42, 0x23, 0x42, 0x23, 0x42, 0x23, 0x42, 0x23, 0x42, 0x23
#define CARD10_UUID_PREFIX 0x02, 0x23, 0x42
/**************************************************************************************************
Data Types
**************************************************************************************************/
/*! Application message type */
typedef union
{
wsfMsgHdr_t hdr;
dmEvt_t dm;
attsCccEvt_t ccc;
attEvt_t att;
} bleMsg_t;
/**************************************************************************************************
Function Declarations
**************************************************************************************************/
......@@ -11,3 +37,23 @@
/*************************************************************************************************/
void BleStart(void);
/* ATT client module interface. Used by main BLE module */
void bleValueUpdate(attEvt_t *pMsg);
void bleDiscCback(dmConnId_t connId, uint8_t status);
void ble_epic_att_api_init(void);
void ble_epic_att_api_event(attEvt_t *att_event);
void ble_epic_att_api_free_att_write_data(struct epic_att_write *w);
void ble_epic_ble_api_trigger_event(enum epic_ble_event_type type, void *data);
void ble_epic_ble_api_init(void);
void ble_epic_dm_api_event(dmEvt_t *dm_event);
void ble_epic_disc_cfg_complete(void);
void ble_adv_init(void);
void ble_adv_setup(void);
void ble_adv_set_interval(uint32_t interval_ms);
void ble_adv_stop(void);
void ble_adv_start(uint8_t mode);
void ble_adv_discoverable(bool discoverable);
void ble_adv_proc_msg(bleMsg_t *pMsg);
#include <stdint.h>
#include <stdbool.h>
#include "ble_api.h"
#include "wsf_types.h"
#include "util/bstream.h"
#include "app_api.h"
#include "app_cfg.h"
#include "att_api.h"
#include "dm_api.h"
#include "gatt/gatt_api.h"
#include "profiles/gap_api.h"
#include "tipc/tipc_api.h"
#include "os/core.h"
/* card10:
* copied from lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/tag/tag_main.c
* and lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/watch/watch_main.c
*/
/* clang-format off */
/* clang-formet turned off for easier diffing against orginal file */
/**************************************************************************************************
ATT Client Discovery Data
**************************************************************************************************/
static uint16_t s_hdlList[APP_DB_HDL_LIST_LEN];
/*! the Client handle list, s_hdlList[], is set as follows:
*
* ------------------------------- <- BLE_DISC_GATT_START
* | GATT svc changed handle |
* -------------------------------
* | GATT svc changed ccc handle |
* ------------------------------- <- BLE_DISC_GAP_START
* | GAP central addr res handle |
* -------------------------------
* | GAP RPA Only handle |
* ------------------------------- <- BLE_DISC_CTS_START
* | TIPC_CTS_CT_HDL_IDX |
* -------------------------------
* | TIPC_CTS_CT_CCC_HDL_IDX |
* -------------------------------
* | TIPC_CTS_LTI_HDL_IDX |
* -------------------------------
* | TIPC_CTS_RTI_HDL_IDX |
* -------------------------------
*/
/*! Start of each service's handles in the the handle list */
#define BLE_DISC_GATT_START 0
#define BLE_DISC_GAP_START (BLE_DISC_GATT_START + GATT_HDL_LIST_LEN)
#define BLE_DISC_CTS_START (BLE_DISC_GAP_START + GAP_HDL_LIST_LEN)
#define BLE_DISC_HDL_LIST_LEN (BLE_DISC_CTS_START + TIPC_CTS_HDL_LIST_LEN)
/*! Pointers into handle list for each service's handles */
static uint16_t *pBleGattHdlList = &s_hdlList[BLE_DISC_GATT_START];
static uint16_t *pBleGapHdlList = &s_hdlList[BLE_DISC_GAP_START];
static uint16_t *pBleCtsHdlList = &s_hdlList[BLE_DISC_CTS_START];
/* sanity check: make sure handle list length is <= app db handle list length */
extern char wsf_ct_assert[(BLE_DISC_HDL_LIST_LEN <= APP_DB_HDL_LIST_LEN) ? 1 : -1];
/**************************************************************************************************
ATT Client Data
**************************************************************************************************/
/* Default value for GATT service changed ccc descriptor */
static const uint8_t bleGattScCccVal[] = {UINT16_TO_BYTES(ATT_CLIENT_CFG_INDICATE)};
/* List of characteristics to configure */
static const attcDiscCfg_t bleDiscCfgList[] =
{
/* Write: GATT service changed ccc descriptor */
{bleGattScCccVal, sizeof(bleGattScCccVal), (GATT_SC_CCC_HDL_IDX + BLE_DISC_GATT_START)},
{NULL, 0, (GAP_DN_HDL_IDX + BLE_DISC_GAP_START)},
/* Read: GAP central address resolution attribute */
{NULL, 0, (GAP_CAR_HDL_IDX + BLE_DISC_GAP_START)},
/* Read: CTS Current time */
{NULL, 0, (TIPC_CTS_CT_HDL_IDX + BLE_DISC_CTS_START)},
/* Read: CTS Local time information */
{NULL, 0, (TIPC_CTS_LTI_HDL_IDX + BLE_DISC_CTS_START)},
/* Read: CTS Reference time information */
{NULL, 0, (TIPC_CTS_RTI_HDL_IDX + BLE_DISC_CTS_START)},
};
/* Characteristic configuration list length */
#define BLE_DISC_CFG_LIST_LEN (sizeof(bleDiscCfgList) / sizeof(attcDiscCfg_t))
/* sanity check: make sure configuration list length is <= handle list length */
extern char wsf_ct_assert[(BLE_DISC_CFG_LIST_LEN <= BLE_DISC_HDL_LIST_LEN) ? 1 : -1];
/**************************************************************************************************
ATT Client Discovery Data
**************************************************************************************************/
/*! Discovery states: enumeration of services to be discovered */
enum
{
BLE_DISC_GATT_SVC, /* GATT service */
BLE_DISC_GAP_SVC, /* GAP service */
BLE_DISC_SLAVE_CTS_SVC,
BLE_DISC_SVC_MAX /* Discovery complete */
};
/*************************************************************************************************/
/*!
* \brief Process a received ATT indication.
*
* \param pMsg Pointer to ATT callback event message.
*
* \return None.
*/
/*************************************************************************************************/
void bleValueUpdate(attEvt_t *pMsg)
{
if (pMsg->hdr.status == ATT_SUCCESS)
{
/* determine which profile the handle belongs to */
/* GATT */
if (GattValueUpdate(pBleGattHdlList, pMsg) == ATT_SUCCESS)
{
return;
}
/* GAP */
if (GapValueUpdate(pBleGapHdlList, pMsg) == ATT_SUCCESS)
{
return;
}
/* current time */
if (TipcCtsValueUpdate(pBleCtsHdlList, pMsg) == ATT_SUCCESS)
{
return;
}
}
}
/*************************************************************************************************/
/*!
* \brief GAP service discovery has completed.
*
* \param connId Connection identifier.
*
* \return None.
*/
/*************************************************************************************************/
static void bleDiscGapCmpl(dmConnId_t connId)
{
appDbHdl_t dbHdl;
/* if RPA Only attribute found on peer device */
if ((pBleGapHdlList[GAP_RPAO_HDL_IDX] != ATT_HANDLE_NONE) &&
((dbHdl = AppDbGetHdl(connId)) != APP_DB_HDL_NONE))
{
/* update DB */
AppDbSetPeerRpao(dbHdl, TRUE);
}
}
/*************************************************************************************************/
/*!
* \brief Discovery callback.
*
* \param connId Connection identifier.
* \param status Service or configuration status.
*
* \return None.
*/
/*************************************************************************************************/
void bleDiscCback(dmConnId_t connId, uint8_t status)
{
static uint8_t discState;
static const char * const disc_status[] = {
"APP_DISC_INIT", /*!< \brief No discovery or configuration complete */
"APP_DISC_SEC_REQUIRED", /*!< \brief Security required to complete configuration */
"APP_DISC_START", /*!< \brief Service discovery started */
"APP_DISC_CMPL", /*!< \brief Service discovery complete */
"APP_DISC_FAILED", /*!< \brief Service discovery failed */
"APP_DISC_CFG_START", /*!< \brief Service configuration started */
"APP_DISC_CFG_CONN_START", /*!< \brief Configuration for connection setup started */
"APP_DISC_CFG_CMPL" /*!< \brief Service configuration complete */
};
LOG_INFO("ble", "bleDiscCback: %s (%d)", disc_status[status], status);
switch(status)
{
case APP_DISC_INIT:
/* set handle list when initialization requested */
AppDiscSetHdlList(connId, BLE_DISC_HDL_LIST_LEN, s_hdlList);
break;
case APP_DISC_SEC_REQUIRED:
/* request security */
AppSlaveSecurityReq(connId);
break;
case APP_DISC_START:
/* initialize discovery state */
discState = BLE_DISC_GATT_SVC;
GattDiscover(connId, pBleGattHdlList);
break;
case APP_DISC_FAILED:
case APP_DISC_CMPL:
if (status == APP_DISC_FAILED && pAppCfg->abortDisc)
{
if (discState == BLE_DISC_GATT_SVC)
{
/* discovery failed */
AppDiscComplete(connId, APP_DISC_FAILED);
break;
}
}
/* next discovery state */
discState++;
if (discState == BLE_DISC_GAP_SVC)
{
/* discover GAP service */
GapDiscover(connId, pBleGapHdlList);
}
else if (discState == BLE_DISC_SLAVE_CTS_SVC)
{
/* discover current time service */
TipcCtsDiscover(connId, pBleCtsHdlList);
}
else
{
/* discovery complete */
AppDiscComplete(connId, APP_DISC_CMPL);
/* GAP service discovery completed */
bleDiscGapCmpl(connId);
/* start configuration */
AppDiscConfigure(connId, APP_DISC_CFG_START, BLE_DISC_CFG_LIST_LEN,
(attcDiscCfg_t *) bleDiscCfgList, BLE_DISC_HDL_LIST_LEN, s_hdlList);
}
break;
case APP_DISC_CFG_START:
/* start configuration */
AppDiscConfigure(connId, APP_DISC_CFG_START, BLE_DISC_CFG_LIST_LEN,
(attcDiscCfg_t *) bleDiscCfgList, BLE_DISC_HDL_LIST_LEN, s_hdlList);
break;
case APP_DISC_CFG_CMPL:
AppDiscComplete(connId, APP_DISC_CFG_CMPL);
ble_epic_disc_cfg_complete();
break;
case APP_DISC_CFG_CONN_START:
/* no connection setup configuration for this application */
ble_epic_disc_cfg_complete();
break;
default:
break;
}
}
/* clang-format on */
This diff is collapsed.
This diff is collapsed.
#include "ble_api.h"
#include "epicardium.h"
#include "wsf_types.h"
#include "util/bstream.h"
#include "wsf_assert.h"
#include "att_api.h"
#include "epicardium.h"
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <machine/endian.h>
#define CARD10_UUID_SUFFIX \
0x42, 0x23, 0x42, 0x23, 0x42, 0x23, 0x42, 0x23, 0x42, 0x23, 0x42, 0x23
#define CARD10_UUID_PREFIX 0x02, 0x23, 0x42
/*!< \brief Service start handle. */
#define CARD10_START_HDL 0x920
/*!< \brief Service end handle. */
......
#pragma once
/*! enumeration of client characteristic configuration descriptors */
enum
{
BLE_GATT_SC_CCC_IDX, /*! GATT service, service changed characteristic */
BLE_BATT_LVL_CCC_IDX, /*! Battery service, battery level characteristic */
BLE_ESS_TEMP_CCC_IDX, /*! Environmental sensing service, temperature characteristic */
BLE_ESS_HUMI_CCC_IDX, /*! Environmental sensing service, humidity characteristic */
BLE_ESS_PRES_CCC_IDX, /*! Environmental sensing service, pressure characteristic */
HIDAPP_MBI_CCC_HDL, /*! HID Boot Mouse Input characteristic */
HIDAPP_KBI_CCC_HDL, /*! HID Boot Keyboard Input characteristic */
HIDAPP_IN_KEYBOARD_CCC_HDL, /*! HID Input Report characteristic for keyboard inputs */
HIDAPP_IN_MOUSE_CCC_HDL, /*! HID Input Report characteristic for mouse inputs */
HIDAPP_IN_CONSUMER_CCC_HDL, /*! HID Input Report characteristic for consumer control inputs */
BLE_ESS_IAQ_CCC_IDX, /*! Environmental sensing service, IAQ characteristic */
UART_TX_CH_CCC_IDX,
BLE_NUM_CCC_IDX
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "epicardium.h"
/*!< \brief Service start handle. */
#define ESS_START_HDL 0x1000
/*!< \brief Service end handle. */
#define ESS_END_HDL (ESS_MAX_HDL - 1)
enum {
/*!< \brief environmental sensing services service declaration */
ESS_SVC_HDL = ESS_START_HDL,
/*!< \brief temperature characteristic */
ESS_TEMPERATURE_CH_HDL,
ESS_TEMPERATURE_VAL_HDL,
ESS_TEMP_CH_CCC_HDL, /*!< Temperature CCCD */
/*!< \brief humidity characteristic */
ESS_HUMIDITY_CH_HDL,
ESS_HUMIDITY_VAL_HDL,
ESS_HUMI_CH_CCC_HDL, /*!< Humidity CCCD */
/*!< \brief pressure characteristic */
ESS_PRESSURE_CH_HDL,
ESS_PRESSURE_VAL_HDL,
ESS_PRES_CH_CCC_HDL, /*!< Pressure CCCD */
/*!< \brief IAQ/CO2 characteristic */
ESS_IAQ_CH_HDL,
ESS_IAQ_VAL_HDL,
ESS_IAQ_CH_CCC_HDL, /*!< IAQ CCCD */
/*!< \brief Maximum handle. */
ESS_MAX_HDL
};
void bleESS_ccc_update(void);
void bleESS_update_from_bsec_data(struct bsec_sensor_data *data);
......@@ -33,7 +33,7 @@
#include "hci_vs.h"
#include <epicardium.h>
#include "modules/log.h"
#include "os/core.h"
#include "util/bstream.h"
#include "att_api.h"
......
This diff is collapsed.
#pragma once
#include "wsf_types.h"
#include "wsf_os.h"
/* The input report fits in one byte */
#define HIDAPP_KEYBOARD_INPUT_REPORT_LEN 8
#define HIDAPP_MOUSE_INPUT_REPORT_LEN 4
#define HIDAPP_CONSUMER_INPUT_REPORT_LEN 2
#define HIDAPP_OUTPUT_REPORT_LEN 1
#define HIDAPP_FEATURE_REPORT_LEN 1
/* HID Report IDs */
#define HIDAPP_KEYBOARD_REPORT_ID 1
#define HIDAPP_MOUSE_REPORT_ID 2
#define HIDAPP_CONSUMER_REPORT_ID 3
void hid_init(void);
void HidProcMsg(wsfMsgHdr_t *pMsg);
This diff is collapsed.
ble_sources = files(
'ble.c',
'epic_ble_api.c',
'epic_att_api.c',
'stack.c',
'ble_main.c',
'ble_adv.c',
'ble_attc.c',
'profiles/tipc_main.c',
'profiles/gap_main.c',
'svc_dis.c',
'svc_core.c',
'app/app_main.c',
'app/common/app_db.c',
'app/common/app_ui.c',
'bondings.c',
'uart.c',
'card10.c',
'ess.c',
'filetransfer.c',
'hid.c',
'hid_work.c',
)
/*************************************************************************************************/
/*!
* \file
*
* \brief GAP profile.
*
* Copyright (c) 2015-2018 Arm Ltd. All Rights Reserved.
* Arm Ltd. confidential and proprietary.
*
* IMPORTANT. Your use of this file is governed by a Software License Agreement
* ("Agreement") that must be accepted in order to download or otherwise receive a
* copy of this file. You may not use or copy this file for any purpose other than
* as described in the Agreement. If you do not agree to all of the terms of the
* Agreement do not use this file and delete all copies in your possession or control;
* if you do not have a copy of the Agreement, you must contact Arm Ltd. prior
* to any use, copying or further distribution of this software.
*/
/*************************************************************************************************/
#ifndef GAP_API_H
#define GAP_API_H
#include "att_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/*! \addtogroup GAP_PROFILE
* \{ */
/**************************************************************************************************
Macros
**************************************************************************************************/
/*! \brief Enumeration of handle indexes of characteristics to be discovered */
enum
{
GAP_DN_HDL_IDX,
GAP_CAR_HDL_IDX, /*!< \brief Central Address Resolution */
GAP_RPAO_HDL_IDX, /*!< \brief Resolvable Private Address Only */
GAP_HDL_LIST_LEN /*!< \brief Handle list length */
};
/**************************************************************************************************
Function Declarations
**************************************************************************************************/
int GapGetDeviceName(char *buf, size_t buf_size);
void GapClearDeviceName(void);
/*************************************************************************************************/
/*!
* \brief Perform service and characteristic discovery for GAP service. Note that pHdlList
* must point to an array of handles of length \ref GAP_HDL_LIST_LEN. If discovery is
* successful the handles of discovered characteristics and descriptors will be set
* in pHdlList.
*
* \param connId Connection identifier.
* \param pHdlList Characteristic handle list.
*
* \return None.
*/
/*************************************************************************************************/
void GapDiscover(dmConnId_t connId, uint16_t *pHdlList);
/*************************************************************************************************/
/*!
* \brief Process a value received in an ATT read response, notification, or indication
* message. Parameter pHdlList must point to an array of length \ref GAP_HDL_LIST_LEN.
* If the attribute handle of the message matches a handle in the handle list the value
* is processed, otherwise it is ignored.
*
* \param pHdlList Characteristic handle list.
* \param pMsg ATT callback message.
*
* \return \ref ATT_SUCCESS if handle is found, \ref ATT_ERR_NOT_FOUND otherwise.
*/
/*************************************************************************************************/
uint8_t GapValueUpdate(uint16_t *pHdlList, attEvt_t *pMsg);
/*! \} */ /* GAP_PROFILE */
#ifdef __cplusplus
};
#endif
#endif /* GAP_API_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -24,13 +24,17 @@
*/
/* clang-format off */
/* clang-formet turned off for easier diffing against orginal file */
#include "card10-version.h"
#include "wsf_types.h"
#include "att_api.h"
#include "wsf_assert.h"
#include "wsf_trace.h"
#include "util/bstream.h"
#define DIS_MAXSIZE_FWR_ATT 32
#include "svc_dis.h"
#include "svc_cfg.h"
#include <string.h>
/**************************************************************************************************
Macros
......@@ -60,10 +64,10 @@
#define DIS_DEFAULT_SERIAL_NUM_LEN 1
/*! Default firmware revision */
#define DIS_DEFAULT_FW_REV "<git hash>"
#define DIS_DEFAULT_FW_REV CARD10_VERSION
/*! Length of default firmware revision */
#define DIS_DEFAULT_FW_REV_LEN 10
#define DIS_DEFAULT_FW_REV_LEN strlen(CARD10_VERSION)
/*! Default hardware revision */
#define DIS_DEFAULT_HW_REV "1"
......@@ -128,7 +132,7 @@ static const uint16_t disLenFwrCh = sizeof(disValFwrCh);
/* Firmware revision string */
static const uint8_t disUuFwr[] = {UINT16_TO_BYTES(ATT_UUID_FIRMWARE_REV)};
static uint8_t disValFwr[DIS_MAXSIZE_FWR_ATT] = DIS_DEFAULT_FW_REV;
static uint16_t disLenFwr = DIS_DEFAULT_FW_REV_LEN;
static uint16_t disLenFwr;
/* Hardware revision string characteristic */
static const uint8_t disValHwrCh[] = {ATT_PROP_READ, UINT16_TO_BYTES(DIS_HWR_HDL), UINT16_TO_BYTES(ATT_UUID_HARDWARE_REV)};
......@@ -319,6 +323,7 @@ WSF_CT_ASSERT(((sizeof(disList) / sizeof(disList[0])) == DIS_END_HDL - DIS_START
/*************************************************************************************************/
void SvcDisAddGroup(void)
{
disLenFwr = DIS_DEFAULT_FW_REV_LEN;
AttsAddGroup(&svcDisGroup);
}
......