diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2026-02-17 11:37:50 -0800 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2026-02-17 11:37:50 -0800 |
| commit | fb1611c0ca99d9e609057c46507be2af8389bb7b (patch) | |
| tree | 646ac568fdad1e6cf9e1f5767295b183bc5c5441 /firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc | |
| parent | 6e952fe110c2a48204c8cb0a836309ab97e5979a (diff) | |
Diffstat (limited to 'firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc')
22 files changed, 2581 insertions, 0 deletions
diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bas.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bas.h new file mode 100644 index 0000000..34b581c --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bas.h @@ -0,0 +1,62 @@ +/** + ****************************************************************************** + * @file bas.h + * @author MCD Application Team + * @brief Header for bas.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __BAS_H +#define __BAS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + BAS_LEVEL_NOT_ENABLED_EVT, + BAS_LEVEL_NOT_DISABLED_EVT, + BAS_LEVEL_READ_EVT +} BAS_Opcode_Notification_evt_t; + +typedef struct +{ + BAS_Opcode_Notification_evt_t BAS_Evt_Opcode; + uint8_t ServiceInstance; +}BAS_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +#define BAS_LEVEL_NOTIFICATION_OPTION 1 + + +/* Exported functions ------------------------------------------------------- */ +void BAS_Init(void); +void BAS_Update_Char(uint16_t UUID, uint8_t service_instance, uint8_t *pPayload); +void BAS_Notification(BAS_Notification_evt_t * pNotification); + +#ifdef __cplusplus +} +#endif + +#endif /*__BAS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bls.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bls.h new file mode 100644 index 0000000..fa11cee --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/bls.h @@ -0,0 +1,102 @@ +/** + ****************************************************************************** + * @file bls.h + * @author MCD Application Team + * @brief Header for bls.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __BLS_H +#define __BLS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + NO_FLAG = 0, + VALUE_UNIT_KILO_PASCAL = (1<<0), /*0 -> Blood pressure systolic, diastolic & Mean values in units of mmHg - if 1 -> in units of kPa*/ + TIME_STAMP_PRESENT = (1<<1), + PULSE_RATE_PRESENT = (1<<2), + USER_ID_PRESENT = (1<<3), + MEASUREMENT_STATUS_PRESENT = (1<<4) +} BLS_Measurement_Flags_t; + +typedef enum +{ + BLS_MEASUREMENT_IND_ENABLED_EVT, + BLS_MEASUREMENT_IND_DISABLED_EVT, +#if (BLE_CFG_BLS_INTERMEDIATE_CUFF_PRESSURE != 0) + BLS_INTERMEDIATE_CUFF_PRESSURE_NOTIF_ENABLED_EVT, + BLS_INTERMEDIATE_CUFF_PRESSURE_NOTIF_DISABLED_EVT, +#endif +} BLS_App_Opcode_Notification_evt_t; + +typedef struct +{ + BLS_App_Opcode_Notification_evt_t BLS_Evt_Opcode; +}BLS_App_Notification_evt_t; + +typedef struct +{ + uint16_t Year; + uint8_t Month; + uint8_t Day; + uint8_t Hours; + uint8_t Minutes; + uint8_t Seconds; +}BLS_TimeStamp_t; + +typedef struct +{ + uint16_t MeasurementValue_Systolic; + uint16_t MeasurementValue_Diastolic; + uint16_t MeasurementValue_Mean; +#if (BLE_CFG_BLS_TIME_STAMP_FLAG != 0) + BLS_TimeStamp_t TimeStamp; +#endif +#if (BLE_CFG_BLS_PULSE_RATE_FLAG != 0) + uint16_t PulseRate; +#endif +#if (BLE_CFG_BLS_USER_ID_FLAG != 0) + uint8_t UserID; +#endif +#if (BLE_CFG_BLS_MEASUREMENT_STATUS_FLAG != 0) + uint16_t MeasurementStatus; +#endif + uint8_t Flags; +}BLS_Value_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void BLS_Init(void); +void BLS_Update_Char(uint16_t UUID, uint8_t *pPayload); +void BLS_App_Notification(BLS_App_Notification_evt_t * pNotification); + +#ifdef __cplusplus +} +#endif + +#endif /*__BLS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/crs_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/crs_stm.h new file mode 100644 index 0000000..9761856 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/crs_stm.h @@ -0,0 +1,72 @@ + +/** + ****************************************************************************** + * @file crs_stm.h + * @author MCD Application Team + * @brief Header for crs_stm.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32XX_CRS_H +#define __STM32XX_CRS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + CRS_NOTIFY_ENABLED_EVT, + CRS_NOTIFY_DISABLED_EVT, + CRS_READ_EVT, + CRS_WRITE_EVT, +} CRS_Opcode_evt_t; + +typedef struct +{ + uint8_t * pPayload; + uint8_t Length; +}CRS_Data_t; + +typedef struct +{ + CRS_Opcode_evt_t CRS_Evt_Opcode; + CRS_Data_t DataTransfered; + uint16_t ConnectionHandle; + uint8_t ServiceInstance; +}CRS_STM_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +#define CRS_MAX_DATA_LEN (BLE_DEFAULT_ATT_MTU - 3) /**< Maximum length of data (in bytes) that can be transmitted to the peer. */ + +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void CRS_STM_Init(void); +void CRS_STM_Notification(CRS_STM_Notification_evt_t *p_Notification); +tBleStatus CRS_STM_Update_Char(uint16_t UUID, uint8_t *p_Payload); + + +#ifdef __cplusplus +} +#endif + +#endif /*__STM32XX_CRS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/dis.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/dis.h new file mode 100644 index 0000000..4b430eb --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/dis.h @@ -0,0 +1,52 @@ +/** + ****************************************************************************** + * @file dis.h + * @author MCD Application Team + * @brief Header for dis.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __DIS_H +#define __DIS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Includes ------------------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +typedef struct +{ + uint8_t *pPayload; + uint8_t Length; +}DIS_Data_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void DIS_Init(void); +tBleStatus DIS_UpdateChar(uint16_t uuid, DIS_Data_t *p_data); + +#ifdef __cplusplus +} +#endif + +#endif /*__DIS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/eds_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/eds_stm.h new file mode 100644 index 0000000..eee5867 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/eds_stm.h @@ -0,0 +1,79 @@ + +/** + ****************************************************************************** + * @file eds_stm.h + * @author MCD Application Team + * @brief Header for stm32xx_enddevicemanagement.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __EDS_STM_H +#define __EDS_STM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ + + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + EDS_STM_NOTIFY_DISABLED_EVT, + EDS_STM_NOTIFY_ENABLED_EVT, +} EDS_STM_Opcode_evt_t; + +typedef struct +{ + uint8_t Device1_Status; + uint8_t Device2_Status; + uint8_t Device3_Status; + uint8_t Device4_Status; + uint8_t Device5_Status; + uint8_t Device6_Status; + }EDS_STM_Status_t; + +typedef struct +{ + uint8_t * pPayload; + uint8_t Length; +}EDS_STM_Data_t; + +typedef struct +{ + EDS_STM_Opcode_evt_t EDS_Evt_Opcode; + EDS_STM_Data_t DataTransfered; + uint16_t ConnectionHandle; + }EDS_STM_App_Notification_evt_t; + + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void EDS_STM_Init( void ); +void EDS_STM_App_Notification(EDS_STM_App_Notification_evt_t * pNotification); +tBleStatus EDS_STM_Update_Char(uint16_t UUID, uint8_t *pPayload); + + +#ifdef __cplusplus +} +#endif + +#endif /*__EDS_STM_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hids.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hids.h new file mode 100644 index 0000000..02af660 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hids.h @@ -0,0 +1,79 @@ +/** + ****************************************************************************** + * @file hids.h + * @author MCD Application Team + * @brief Header for hids.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __HIDS_H +#define __HIDS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Includes ------------------------------------------------------------------*/ + + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + HIDS_REPORT_NOTIFICATION_ENABLED, + HIDS_REPORT_NOTIFICATION_DISABLED, + HIDS_KEYB_INPUT_NOTIFY_ENABLED, + HIDS_KEYB_INPUT_NOTIFY_DISABLED, + HIDS_MOUSE_INPUT_NOTIFY_ENABLED, + HIDS_MOUSE_INPUT_NOTIFY_DISABLED, + HIDS_OUTPUT_REPORT, + HIDS_KEYBOARD_INPUT_REPORT, + HIDS_KEYBOARD_OUTPUT_REPORT, + HIDS_MOUSE_INPUT_REPORT, + HIDS_CONN_HANDLE_EVT, + HIDS_DISCON_HANDLE_EVT +} HIDS_Opcode_Notification_evt_t; + +typedef struct +{ + HIDS_Opcode_Notification_evt_t HIDS_Evt_Opcode; + uint8_t Instance; + uint8_t Index; + uint8_t ReportLength; + uint8_t *pReport; +} HIDS_App_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void HIDS_Init(void); +tBleStatus HIDS_Update_Char(uint16_t UUID, + uint8_t service_instance, + uint8_t Report_Index, + uint8_t report_size, + uint8_t *pPayload); +void HIDS_Notification(HIDS_App_Notification_evt_t *pNotification); + + +#ifdef __cplusplus +} +#endif + +#endif /*__HIDS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hrs.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hrs.h new file mode 100644 index 0000000..741951d --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hrs.h @@ -0,0 +1,99 @@ +/** + ****************************************************************************** + * @file hrs.h + * @author MCD Application Team + * @brief Header for stm32xx_heartrate.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __HRS_H +#define __HRS_H + +#ifdef __cplusplus +extern "C" { +#endif + + /* Includes ------------------------------------------------------------------*/ + /* Exported types ------------------------------------------------------------*/ + typedef enum + { + HRS_HRM_VALUE_FORMAT_UINT16 = 1, + HRS_HRM_SENSOR_CONTACTS_PRESENT = 2, + HRS_HRM_SENSOR_CONTACTS_SUPPORTED = 4, + HRS_HRM_ENERGY_EXPENDED_PRESENT = 8, + HRS_HRM_RR_INTERVAL_PRESENT = 0x10 + } HRS_HrmFlags_t; + + typedef enum + { + HRS_BODY_SENSOR_LOCATION_OTHER = 0, + HRS_BODY_SENSOR_LOCATION_CHEST = 1, + HRS_BODY_SENSOR_LOCATION_WRIST = 2, + HRS_BODY_SENSOR_LOCATION_FINGER = 3, + HRS_BODY_SENSOR_LOCATION_HAND = 4, + HRS_BODY_SENSOR_LOCATION_EAR_LOBE = 5, + HRS_BODY_SENSOR_LOCATION_FOOT = 6 + } HRS_BodySensorLocation_t; + + typedef enum + { + HRS_RESET_ENERGY_EXPENDED_EVT, + HRS_NOTIFICATION_ENABLED, + HRS_NOTIFICATION_DISABLED, + HRS_STM_BOOT_REQUEST_EVT, + } HRS_NotCode_t; + + typedef struct +{ + uint8_t * pPayload; + uint8_t Length; +}HRS_Data_t; + +typedef struct +{ + HRS_NotCode_t HRS_Evt_Opcode; + HRS_Data_t DataTransfered; + uint16_t ConnectionHandle; + uint8_t ServiceInstance; +}HRS_App_Notification_evt_t; + + typedef struct{ + uint16_t MeasurementValue; +#if (BLE_CFG_HRS_ENERGY_EXPENDED_INFO_FLAG == 1) + uint16_t EnergyExpended; +#endif +#if (BLE_CFG_HRS_ENERGY_RR_INTERVAL_FLAG != 0) + uint16_t aRRIntervalValues[BLE_CFG_HRS_ENERGY_RR_INTERVAL_FLAG + BLE_CFG_HRS_ENERGY_EXPENDED_INFO_FLAG]; + uint8_t NbreOfValidRRIntervalValues; +#endif + uint8_t Flags; + }HRS_MeasVal_t; + + /* Exported constants --------------------------------------------------------*/ + /* External variables --------------------------------------------------------*/ + /* Exported macros -----------------------------------------------------------*/ + /* Exported functions ------------------------------------------------------- */ + void HRS_Init(void); + tBleStatus HRS_UpdateChar(uint16_t uuid, uint8_t *p_payload); + void HRS_Notification(HRS_App_Notification_evt_t *pNotification); + +#ifdef __cplusplus +} +#endif + +#endif /*__HRS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hts.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hts.h new file mode 100644 index 0000000..b41f188 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/hts.h @@ -0,0 +1,113 @@ + +/** + ****************************************************************************** + * @file hts.h + * @author MCD Application Team + * @brief Header for shst.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __HTS_H +#define __HTS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Includes ------------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + NO_FLAGS = 0, + VALUE_UNIT_FAHRENHEIT = (1<<0), + SENSOR_TIME_STAMP_PRESENT = (1<<1), + SENSOR_TEMPERATURE_TYPE_PRESENT = (1<<2), +} HTS_TM_Flags_t; + +typedef enum +{ + TT_Armpit = 1, + TT_Body = 2, + TT_Ear = 3, + TT_Finger = 4, + TT_Gastro_intestinal_Tract = 5, + TT_Mouth = 6, + TT_Rectum = 7, + TT_Toe = 8, + TT_Tympanum = 9 +} HTS_Temperature_Type_t; + +typedef enum +{ + HTS_MEASUREMENT_INTERVAL_RECEIVED_EVT, + HTS_MEASUREMENT_IND_ENABLED_EVT, + HTS_MEASUREMENT_IND_DISABLED_EVT, + HTS_MEASUREMENT_INTERVAL_IND_ENABLED_EVT, + HTS_MEASUREMENT_INTERVAL_IND_DISABLED_EVT, + HTS_INTERMEDIATE_TEMPERATURE_NOT_ENABLED_EVT, + HTS_INTERMEDIATE_TEMPERATURE_NOT_DISABLED_EVT, +} HTS_App_Opcode_Notification_evt_t; + +typedef struct +{ + HTS_App_Opcode_Notification_evt_t HTS_Evt_Opcode; +#if (BLE_CFG_HTS_MEASUREMENT_INTERVAL != 0) + uint16_t RangeInterval; +#endif +}HTS_App_Notification_evt_t; + +#if (BLE_CFG_HTS_TIME_STAMP_FLAG != 0) +typedef struct +{ + uint16_t Year; + uint8_t Month; + uint8_t Day; + uint8_t Hours; + uint8_t Minutes; + uint8_t Seconds; +}HTS_TimeStamp_t; +#endif + +typedef struct +{ + uint32_t MeasurementValue; +#if (BLE_CFG_HTS_TIME_STAMP_FLAG != 0) + HTS_TimeStamp_t TimeStamp; +#endif +#if (BLE_CFG_HTS_TEMPERATURE_TYPE_VALUE_STATIC == 0) + HTS_Temperature_Type_t TemperatureType; +#endif + uint8_t Flags; +}HTS_TemperatureValue_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void HTS_Init(void); +tBleStatus HTS_Update_Char(uint16_t UUID, + uint8_t *pPayload); +void HTS_App_Notification(HTS_App_Notification_evt_t * pNotification); + +#ifdef __cplusplus +} +#endif + +#endif /*__HTS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/ias.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/ias.h new file mode 100644 index 0000000..076af5a --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/ias.h @@ -0,0 +1,62 @@ +/** + ****************************************************************************** + * @file ias.h + * @author MCD Application Team + * @brief Header for ias.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __IAS_H +#define __IAS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/* Includes ------------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + IAS_NO_ALERT_EVT, + IAS_MID_ALERT_EVT, + IAS_HIGH_ALERT_EVT +} IAS_App_Opcode_Notification_evt_t; + +typedef struct +{ + IAS_App_Opcode_Notification_evt_t IAS_Evt_Opcode; +}IAS_App_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void IAS_Init(void); +tBleStatus IAS_Update_Char(uint16_t UUID, uint8_t *pPayload); +void IAS_App_Notification(IAS_App_Notification_evt_t *pNotification); + + +#ifdef __cplusplus +} +#endif + +#endif /*__IAS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/lls.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/lls.h new file mode 100644 index 0000000..244af4d --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/lls.h @@ -0,0 +1,63 @@ +/** + ****************************************************************************** + * @file lls.h + * @author MCD Application Team + * @brief Header for lls.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __LLS_H +#define __LLS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Includes ------------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + LLS_NO_ALERT_EVT, + LLS_MID_ALERT_EVT, + LLS_HIGH_ALERT_EVT, + LLS_DISCONNECT_EVT, + LLS_CONNECT_EVT +} LLS_App_Opcode_Notification_evt_t; + +typedef struct +{ + LLS_App_Opcode_Notification_evt_t LLS_Evt_Opcode; +}LLS_App_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void LLS_Init(void); +tBleStatus LLS_Update_Char(uint16_t UUID, uint8_t *pPayload); +void LLS_App_Notification(LLS_App_Notification_evt_t *pNotification); + + +#ifdef __cplusplus +} +#endif + +#endif /*__LLS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/mesh.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/mesh.h new file mode 100644 index 0000000..03a1cad --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/mesh.h @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * @file mesh.h + * @author MCD Application Team + * @brief Header for mesh.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MESH_H +#define __MESH_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Includes ------------------------------------------------------------------*/ + /* Exported types ------------------------------------------------------------*/ + /* Exported constants --------------------------------------------------------*/ + /* External variables --------------------------------------------------------*/ + /* Exported macros -----------------------------------------------------------*/ + /* Exported functions ------------------------------------------------------- */ + void MESH_Init(void); + +#ifdef __cplusplus +} +#endif + +#endif /*__MESH_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/motenv_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/motenv_stm.h new file mode 100644 index 0000000..df9f1b3 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/motenv_stm.h @@ -0,0 +1,177 @@ + +/** + ****************************************************************************** + * @file motenv_stm.h + * @author SRA/AST + * @brief Header for motenv_stm.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef MOTENV_STM_H +#define MOTENV_STM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +/** + * @brief MOTENV Event Opcode definition + */ +typedef enum +{ + /* HW Service Chars related events */ + HW_MOTION_NOTIFY_ENABLED_EVT, + HW_MOTION_NOTIFY_DISABLED_EVT, + HW_ENV_NOTIFY_ENABLED_EVT, + HW_ENV_NOTIFY_DISABLED_EVT, + HW_ENV_READ_EVT, + HW_ACC_EVENT_NOTIFY_ENABLED_EVT, + HW_ACC_EVENT_NOTIFY_DISABLED_EVT, + HW_ACC_EVENT_READ_EVT, + HW_TOF_NOTIFY_ENABLED_EVT, + HW_TOF_NOTIFY_DISABLED_EVT, + HW_TOF_WRITE_EVT, + /* SW Service Chars related events */ + SW_MOTIONFX_NOTIFY_ENABLED_EVT, + SW_MOTIONFX_NOTIFY_DISABLED_EVT, + SW_ECOMPASS_NOTIFY_ENABLED_EVT, + SW_ECOMPASS_NOTIFY_DISABLED_EVT, + SW_ACTIVITY_REC_NOTIFY_ENABLED_EVT, + SW_ACTIVITY_REC_NOTIFY_DISABLED_EVT, + SW_ACTIVITY_REC_READ_EVT, + SW_CARRY_POSITION_NOTIFY_ENABLED_EVT, + SW_CARRY_POSITION_NOTIFY_DISABLED_EVT, + SW_CARRY_POSITION_READ_EVT, + SW_GESTURE_REC_NOTIFY_ENABLED_EVT, + SW_GESTURE_REC_NOTIFY_DISABLED_EVT, + SW_GESTURE_REC_READ_EVT, + SW_PEDOMETER_NOTIFY_ENABLED_EVT, + SW_PEDOMETER_NOTIFY_DISABLED_EVT, + SW_PEDOMETER_READ_EVT, + SW_INTENSITY_DET_NOTIFY_ENABLED_EVT, + SW_INTENSITY_DET_NOTIFY_DISABLED_EVT, + MOTENV_STM_BOOT_REQUEST_EVT, + /* Config Service Chars related events */ + CONFIG_NOTIFY_ENABLED_EVT, + CONFIG_NOTIFY_DISABLED_EVT, + CONFIG_WRITE_EVT, + /* Console Service Chars related events */ + CONSOLE_TERM_NOTIFY_ENABLED_EVT, + CONSOLE_TERM_NOTIFY_DISABLED_EVT, + CONSOLE_STDERR_NOTIFY_ENABLED_EVT, + CONSOLE_STDERR_NOTIFY_DISABLED_EVT, + CONSOLE_TERM_READ_EVT, + CONSOLE_STDERR_READ_EVT +} MOTENV_STM_Opcode_evt_t; + +/** + * @brief MOTENV Event data structure definition + */ +typedef struct +{ + uint8_t *pPayload; + uint8_t Length; +} MOTENV_STM_Data_t; + +/** + * @brief MOTENV Notification structure definition + */ +typedef struct +{ + MOTENV_STM_Opcode_evt_t Motenv_Evt_Opcode; + MOTENV_STM_Data_t DataTransfered; + uint16_t ConnectionHandle; + uint8_t ServiceInstance; +} MOTENV_STM_App_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +/* Exported Variables ------------------------------------------------------- */ +extern uint8_t ToF_BoardPresent; + +/* Exported macros -----------------------------------------------------------*/ +/** + * @brief Motion (Acc-Gyro-Magneto) Char shortened UUID + */ +#define MOTION_CHAR_UUID (0xE000) +/** + * @brief Environmental (Temp-Humidity-Pressure) Char shortened UUID + */ +#define ENV_CHAR_UUID (0x1D00) +/** + * @brief ToF Char shortened UUID + */ +#define TOF_CHAR_UUID (0x0000) +/** + * @brief Acceleration event Char shortened UUID + */ +#define ACC_EVENT_CHAR_UUID (0x0004) +/** + * @brief Sensor Fusion Char shortened UUID + */ +#define MOTION_FX_CHAR_UUID (0x0100) +/** + * @brief E-Compass event Char shortened UUID + */ +#define ECOMPASS_CHAR_UUID (0x0040) +/** + * @brief Activity Recognition Char event Char shortened UUID + */ +#define ACTIVITY_REC_CHAR_UUID (0x0010) +/** + * @brief Carry Position event Char shortened UUID + */ +#define CARRY_POSITION_CHAR_UUID (0x0008) +/** + * @brief Gesture Recognition event Char shortened UUID + */ +#define GESTURE_REC_CHAR_UUID (0x0200) +/** + * @brief Pedometer Char shortened UUID + */ +#define PEDOMETER_CHAR_UUID (0x0001) +/** + * @brief Intensity Detection Char shortened UUID + */ +#define INTENSITY_DET_CHAR_UUID (0x0020) +/** + * @brief Config Char shortened UUID + */ +#define CONFIG_CHAR_UUID (0x0002) +/** + * @brief Console Terminal Char shortened UUID + */ +#define CONSOLE_TERM_CHAR_UUID (0x010E) +/** + * @brief Cosnole Stderr Char shortened UUID + */ +#define CONSOLE_STDERR_CHAR_UUID (0x020E) + +/* Exported functions ------------------------------------------------------- */ +void MOTENV_STM_Init(void); +void MOTENV_STM_App_Notification(MOTENV_STM_App_Notification_evt_t *pNotification); +tBleStatus MOTENV_STM_App_Update_Char(uint16_t UUID, uint8_t payloadLen, uint8_t *pPayload); + + +#ifdef __cplusplus +} +#endif + +#endif /* MOTENV_STM_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/otas_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/otas_stm.h new file mode 100644 index 0000000..627d593 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/otas_stm.h @@ -0,0 +1,108 @@ +/** + ****************************************************************************** + * @file otas_stm.h + * @author MCD Application Team + * @brief Interface to OTA BLE service + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __OTAS_STM_H +#define __OTAS_STM_H + +#ifdef __cplusplus +extern "C" { +#endif + + /* Includes ------------------------------------------------------------------*/ +#include "stm32_wpan_common.h" + + /* Exported defines -----------------------------------------------------------*/ +#define OTAS_STM_RAW_DATA_SIZE (248) + + /* Exported types ------------------------------------------------------------*/ + typedef enum + { + OTAS_STM_BASE_ADDR_ID, + OTAS_STM_RAW_DATA_ID, + OTAS_STM_CONF_ID, + OTAS_STM_CONF_EVENT_ID, + } OTAS_STM_ChardId_t; + + typedef enum + { + OTAS_STM_STOP_ALL_UPLOAD = 0x00, + OTAS_STM_WIRELESS_FW_UPLOAD = 0x01, + OTAS_STM_APPLICATION_UPLOAD = 0x02, + OTAS_STM_UPLOAD_FINISHED = 0x07, + OTAS_STM_CANCEL_UPLOAD = 0x08, + } OTAS_STM_Command_t; + + typedef enum + { + OTAS_STM_REBOOT_CONFIRMED = 0x01, + } OTAS_STM_Indication_Msg_t; + + typedef struct{ + uint8_t *pPayload; + OTAS_STM_ChardId_t ChardId; + uint8_t ValueLength; + } OTA_STM_Notification_t; + + typedef PACKED_STRUCT{ + OTAS_STM_Command_t Command; /**< [0:7] */ + uint8_t Base_Addr[3]; /**< [8:31] */ + } OTA_STM_Base_Addr_Event_Format_t; + + typedef PACKED_STRUCT{ + uint8_t Raw_Data[OTAS_STM_RAW_DATA_SIZE]; + } OTA_STM_Raw_Data_Event_Format_t; + + typedef PACKED_STRUCT{ + aci_gatt_server_confirmation_event_rp0 Conf_Event; + } OTA_STM_Conf_Event_Format_t; + + typedef PACKED_STRUCT{ + OTAS_STM_Indication_Msg_t Conf_Msg; + } OTA_STM_Conf_Char_Format_t; + + /* Exported constants --------------------------------------------------------*/ + /* External variables --------------------------------------------------------*/ + /* Exported macros -----------------------------------------------------------*/ + /* Exported functions ------------------------------------------------------- */ + void OTAS_STM_Notification( OTA_STM_Notification_t *p_notification ); + + /** + * @brief Service initialization + * @param None + * @retval None + */ + void OTAS_STM_Init(void); + + /** + * @brief Characteristic update + * @param ChardId: Id of the characteristic to be written + * @param p_payload: The new value to be written + * @retval Command status + */ + tBleStatus OTAS_STM_UpdateChar(OTAS_STM_ChardId_t ChardId, uint8_t *p_payload); + +#ifdef __cplusplus +} +#endif + +#endif /*__OTAS_STM_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/p2p_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/p2p_stm.h new file mode 100644 index 0000000..11c4606 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/p2p_stm.h @@ -0,0 +1,73 @@ + +/** + ****************************************************************************** + * @file p2p_stm.h + * @author MCD Application Team + * @brief Header for p2p_stm.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __P2PS_STM_H +#define __P2PS_STM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ + + + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + P2PS_STM__NOTIFY_ENABLED_EVT, + P2PS_STM_NOTIFY_DISABLED_EVT, + P2PS_STM_READ_EVT, + P2PS_STM_WRITE_EVT, + P2PS_STM_BOOT_REQUEST_EVT, +} P2PS_STM_Opcode_evt_t; + +typedef struct +{ + uint8_t * pPayload; + uint8_t Length; +}P2PS_STM_Data_t; + +typedef struct +{ + P2PS_STM_Opcode_evt_t P2P_Evt_Opcode; + P2PS_STM_Data_t DataTransfered; + uint16_t ConnectionHandle; + uint8_t ServiceInstance; +}P2PS_STM_App_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void P2PS_STM_Init( void ); +void P2PS_STM_App_Notification(P2PS_STM_App_Notification_evt_t *pNotification); +tBleStatus P2PS_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload); + + +#ifdef __cplusplus +} +#endif + +#endif /*__P2PS_STM_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/svc_ctl.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/svc_ctl.h new file mode 100644 index 0000000..01e921d --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/svc_ctl.h @@ -0,0 +1,171 @@ + +/** + ****************************************************************************** + * @file svc_ctl.h + * @author MCD Application Team + * @brief Header for ble_controller.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/** + * The BLE Controller supports the application to handle services and clients. + * It provides an API to initialize the BLE core Device and a handler mechanism to rout the GATT/GAP events to the + * application. When the ble_controller is used (recommended), the application shall register a callback for each + * Service and each Client implemented. This is already done with the Services and Clients provided in that delivery. + * + A GATT event is relevant to only one Service and/or one Client. When a GATT event is received, it is notified to + * the registered handlers to the BLE controller. When no registered handler acknowledges positively the GATT event, + * it is reported to the application. + * + A GAP event is not relevant to either a Service or a Client. It is sent to the application + * + In case the application does not want to take benefit from the ble_controller, it could bypass it. In that case, + * the application shall: + * - call SVCCTL_Init() to initialize the BLE core device (or implement on its own what is inside that function + * - implement TLHCI_UserEvtRx() which is the notification from the HCI layer to report all events (GATT/GAP). + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __SVCCTL_H +#define __SVCCTL_H + +#ifdef __cplusplus +extern "C" { +#endif + + /* Includes ------------------------------------------------------------------*/ + /* Exported types ------------------------------------------------------------*/ + typedef enum + { + SVCCTL_EvtNotAck, + SVCCTL_EvtAckFlowEnable, + SVCCTL_EvtAckFlowDisable, + } SVCCTL_EvtAckStatus_t; + + typedef enum + { + SVCCTL_UserEvtFlowDisable, + SVCCTL_UserEvtFlowEnable, + } SVCCTL_UserEvtFlowStatus_t; + + typedef SVCCTL_EvtAckStatus_t (*SVC_CTL_p_EvtHandler_t)(void *p_evt); + + /* Exported constants --------------------------------------------------------*/ + /* External variables --------------------------------------------------------*/ + /* Exported macros -----------------------------------------------------------*/ + + /* Exported functions ------------------------------------------------------- */ + /** + * @brief It initializes the BLE core Driver and sends some commands to initialize the BLE core device + * It shall be called before any BLE operation + * + * @param None + * @retval None + */ + void SVCCTL_Init( void ); + + /** + * @brief This API registers a handler to be called when a GATT user event is received from the BLE core device. When + * a Service is created, it shall register a callback to be notified when a GATT event is received from the + * BLE core device. When a GATT event is received, it shall be checked in the handler if the GATT events belongs + * to the Service or not. The handler shall return the correct status depending on the result. As soon as one + * Service handler registered acknowledges positively the GATT event, the ble_controller stops calling the + * registered Service handlers. + * This handler is called in the TL_BLE_HCI_UserEvtProc() context + * + * @param pfBLE_SVC_Service_Event_Handler: This is the Service handler that the ble_controller calls to report a GATT + * event received. If the GATT event belongs to that Service, the callback shall return positively with + * SVCCTL_EvtAckFlowEnable. + * @retval None + */ + void SVCCTL_RegisterSvcHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Service_Event_Handler ); + + /** + * @brief This API registers a handler to be called when a GATT user event is received from the BLE core device. When + * a Client is created, it shall register a callback to be notified when a GATT event is received from the + * BLE core device. When a GATT event is received, it shall be checked in the handler if the GATT events belongs + * to the Client or not. The handler shall return the correct status depending on the result. As soon as one + * Client handler registered acknowledges positively the GATT event, the ble_controller stops calling the + * registered Client handlers. + * This handler is called in the TL_BLE_HCI_UserEvtProc() context + * + * @param pfBLE_SVC_Client_Event_Handler: This is the Client handler that the ble_controller calls to report a GATT + * event received. If the GATT event belongs to that Client, the callback shall return positively with + * SVCCTL_EvtAckFlowEnable. + * @retval None + */ + void SVCCTL_RegisterCltHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Client_Event_Handler ); + + /** + * @brief This API is used to resume the User Event Flow that has been stopped in return of SVCCTL_UserEvtRx() + * + * @param None + * @retval None + */ + void SVCCTL_ResumeUserEventFlow( void ); + + + /** + * @brief This callback is triggered when either + * + a GAP event is received from the BLE core device. + * + a GATT event that has not been positively acknowledged by the registered handler is received from the + * BLE core device. + * The event is returned in a HCI packet. The full HCI packet is stored in a single buffer and is available when + * this callback is triggered. However, an ACI event may be longer than a HCI packet and could be fragmented over + * several HCI packets. The HCI layer only handles HCI packets so when an ACI packet is split over several HCI + * packets, this callback is triggered for each HCI fragment. It is the responsibility of the application to + * reassemble the ACI event. + * This callback is triggered in the TL_BLE_HCI_UserEvtProc() context + * + * @param pckt: The user event received from the BLE core device + * @retval None + */ + SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification( void *pckt ); + + /** + * @brief + * + * + * @param pckt: The user event received from the BLE core device + * @retval SVCCTL_UserEvtFlowStatus_t: SVCCTL_UserEvtFlowEnable when the packet has been processed + * SVCCTL_UserEvtFlowDisable otherwise (the packet is kept in the queue) + */ + SVCCTL_UserEvtFlowStatus_t SVCCTL_UserEvtRx( void *pckt ); + + /** + * @brief This API may be used by the application when the Service Controller is used to add a custom service + * + * + * @param None + * @retval None + */ + void SVCCTL_InitCustomSvc( void ); + + /** + * @brief This API may be overloaded by the application to select a limited list of ble services to initialize. + * It is called by SVCCTL_Init() + * By default, SVCCTL_SvcInit() is implemented to initialize all BLE services which are included in the + * application at build time + * If it is required to initialize only limited part of the BLE service available in the application, + * this API may be used to call the initialization API of the subset of needed services at run time. + * + * @param None + * @retval None + */ + void SVCCTL_SvcInit( void ); + +#ifdef __cplusplus +} +#endif + +#endif /*__SVCCTL_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/template_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/template_stm.h new file mode 100644 index 0000000..c7c5c03 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/template_stm.h @@ -0,0 +1,73 @@ + +/** + ****************************************************************************** + * @file template_stm.h + * @author MCD Application Team + * @brief Header for template_stm.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __TEMPLATE_STM_H +#define __TEMPLATE_STM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ + + + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + TEMPLATE_STM_NOTIFY_ENABLED_EVT, + TEMPLATE_STM_NOTIFY_DISABLED_EVT, + TEMPLATE_STM_READ_EVT, + TEMPLATE_STM_WRITE_EVT, + TEMPLATE_STM_BOOT_REQUEST_EVT, +} TEMPLATE_STM_Opcode_evt_t; + +typedef struct +{ + uint8_t * pPayload; + uint8_t Length; +}TEMPLATE_STM_Data_t; + +typedef struct +{ + TEMPLATE_STM_Opcode_evt_t Template_Evt_Opcode; + TEMPLATE_STM_Data_t DataTransfered; + uint16_t ConnectionHandle; + uint8_t ServiceInstance; +}TEMPLATE_STM_App_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void TEMPLATE_STM_Init( void ); +void TEMPLATE_STM_App_Notification(TEMPLATE_STM_App_Notification_evt_t *pNotification); +tBleStatus TEMPLATE_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload); + + +#ifdef __cplusplus +} +#endif + +#endif /*__TEMPLATE_STM_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/tps.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/tps.h new file mode 100644 index 0000000..0e0ebea --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/tps.h @@ -0,0 +1,46 @@ +/** + ****************************************************************************** + * @file tps.h + * @author MCD Application Team + * @brief Header for tps.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __TPS_H +#define __TPS_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Includes ------------------------------------------------------------------*/ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void TPS_Init(void); +tBleStatus TPS_Update_Char(uint16_t UUID, uint8_t *pPayload); + +#ifdef __cplusplus +} +#endif + +#endif /*__TPS_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/uuid.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/uuid.h new file mode 100644 index 0000000..0ffb875 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/uuid.h @@ -0,0 +1,328 @@ +/** + ****************************************************************************** + * @file uuid.h.h + * @author MCD Application Team + * @brief Header containing the UUIDs of all the services and caharcteristics + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + + +#ifndef _UUID_H_ +#define _UUID_H_ + +/* Descriptor UUIDs */ +#define CHAR_EXTENDED_PROPERTIES_DESCRIPTOR_UUID (0x2900) +#define CHAR_USER_DESCRIPTION_DESCRIPTOR_UUID (0x2901) +#define CLIENT_CHAR_CONFIG_DESCRIPTOR_UUID (0x2902) +#define SERVER_CHAR_CONFIG_DESCRIPTOR_UUID (0x2903) +#define CHAR_PRESENTATION_FORMAT_DESCRIPTOR_UUID (0x2904) +#define CHAR_AGGREGATE_FORMAT_DESCRIPTOR_UUID (0x2905) +#define VALID_RANGE_DESCRIPTOR_UUID (0x2906) +#define EXTERNAL_REPORT_REFERENCE_DESCRIPTOR_UUID (0x2907) +#define REPORT_REFERENCE_DESCRIPTOR_UUID (0x2908) +#define NUMBER_OF_DIGITALS_DESCRIPTOR_UUID (0x2909) +#define VALUE_TRIGGER_SETTING_DESCRIPTOR_UUID (0x290A) +#define ES_CONFIGURATION_DESCRIPTOR_UUID (0x290B) +#define ES_MEASUREMENT_DESCRIPTOR_UUID (0x290C) +#define ES_TRIGGER_SETTING_DESCRIPTOR_UUID (0x290D) +#define TIME_TRIGGER_SETTING_DESCRIPTOR_UUID (0x290E) + +/* UUIDs of Generic Attribute service */ +#define GENERIC_ATTRIBUTE_SERVICE_UUID (0x1801) +#define SERVICE_CHANGED_CHARACTERISTIC_UUID (0x2A05) + +/* UUIDs of immediate alert service */ +#define IMMEDIATE_ALERT_SERVICE_UUID (0x1802) +#define ALERT_LEVEL_CHARACTERISTIC_UUID (0x2A06) + +/* UUIDs for Link Loss service */ +#define LINK_LOSS_SERVICE_UUID (0x1803) +#define LINK_LOSS_ALERT_LEVEL_CHARACTERISTIC_UUID (0x2A06) + +/* UUIDs for TX Power service */ +#define TX_POWER_SERVICE_UUID (0x1804) +#define TX_POWER_LEVEL_CHARACTERISTIC_UUID (0x2A07) + +/* UUIDs for Time service */ +#define CURRENT_TIME_SERVICE_UUID (0x1805) +#define CURRENT_TIME_CHAR_UUID (0x2A2B) +#define LOCAL_TIME_INFORMATION_CHAR_UUID (0x2A0F) +#define REFERENCE_TIME_INFORMATION_CHAR_UUID (0x2A14) + +/* UUIDs for Reference Time Update service */ +#define REFERENCE_UPDATE_TIME_SERVICE_UUID (0x1806) +#define TIME_UPDATE_CONTROL_POINT_CHAR_UUID (0x2A16) +#define TIME_UPDATE_STATE_CHAR_UUID (0x2A17) + +/* UUIDs for Next DST Change service */ +#define NEXT_DST_CHANGE_SERVICE_UUID (0x1807) +#define TIME_WITH_DST_CHAR_UUID (0x2A11) + +/* UUIDs for glucose profile */ +#define GLUCOSE_SERVICE_UUID (0x1808) +#define GLUCOSE_MEASUREMENT_CHAR_UUID (0x2A18) +#define GLUCOSE_MEASUREMENT_CONTEXT_CHAR_UUID (0x2A34) +#define GLUCOSE_FEATURE_CHAR_UUID (0x2A51) +/* Record Access Control Point (RACP) */ +#define GLUCOSE_RACP_CHAR_UUID (0x2A52) + +/* UUIDs for health thermometer profile */ +#define HEALTH_THERMOMETER_SERVICE_UUID (0x1809) +#define TEMPERATURE_MEASUREMENT_CHAR_UUID (0x2A1C) +#define TEMPERATURE_TYPE_CHAR_UUID (0x2A1D) +#define INTERMEDIATE_TEMPERATURE_CHAR_UUID (0x2A1E) +#define MEASUREMENT_INTERVAL_CHAR_UUID (0x2A21) + +/* UUIDs for Device Information Service */ +#define DEVICE_INFORMATION_SERVICE_UUID (0x180A) +#define SYSTEM_ID_UUID (0x2A23) +#define MODEL_NUMBER_UUID (0x2A24) +#define SERIAL_NUMBER_UUID (0x2A25) +#define FIRMWARE_REVISION_UUID (0x2A26) +#define HARDWARE_REVISION_UUID (0x2A27) +#define SOFTWARE_REVISION_UUID (0x2A28) +#define MANUFACTURER_NAME_UUID (0x2A29) +#define IEEE_CERTIFICATION_UUID (0x2A2A) +#define PNP_ID_UUID (0x2A50) + +/* UUIDs for Heart Rate Service */ +#define HEART_RATE_SERVICE_UUID (0x180D) +#define CLIENT_CHARACTERISTIC_CONFIG_DESCRIPTOR_UUID (0x2902) +#define HEART_RATE_MEASURMENT_UUID (0x2A37) +#define SENSOR_LOCATION_UUID (0x2A38) +#define CONTROL_POINT_UUID (0x2A39) + +/* UUIDs for Phone Alert status profile */ +#define PHONE_ALERT_SERVICE_UUID (0x180E) +#define PHONE_ALERT_STATUS_CHARAC_UUID (0x2A3F) +#define RINGER_CNTRL_POINT_CHARAC_UUID (0x2A40) +#define RINGER_SETTING_CHARAC_UUID (0x2A41) + +/* UUIDs for battery service */ +#define BATTERY_SERVICE_UUID (0x180F) +#define BATTERY_LEVEL_CHAR_UUID (0x2A19) + +/* UUIDs for Blood Pressure profile */ +#define BLOOD_PRESSURE_SERVICE_UUID (0x1810) +#define BLOOD_PRESSURE_MEASUREMENT_CHAR_UUID (0x2A35) +#define INTERMEDIATE_CUFF_PRESSURE_CHAR_UUID (0x2A36) +#define BLOOD_PRESSURE_FEATURE_CHAR_UUID (0x2A49) + +/* UUIDs for alert notification profile */ +#define ALERT_NOTIFICATION_SERVICE_UUID (0x1811) +#define SUPPORTED_NEW_ALERT_CATEGORY_CHAR_UUID (0x2A47) +#define NEW_ALERT_CHAR_UUID (0x2A46) +#define SUPPORTED_UNREAD_ALERT_CATEGORY_CHAR_UUID (0x2A48) +#define UNREAD_ALERT_STATUS_CHAR_UUID (0x2A45) +#define ALERT_NOTIFICATION_CONTROL_POINT_CHAR_UUID (0x2A44) + +/* UUIDs for human interface device */ +#define HUMAN_INTERFACE_DEVICE_SERVICE_UUID (0x1812) +#define PROTOCOL_MODE_CHAR_UUID (0x2A4E) +#define REPORT_CHAR_UUID (0x2A4D) +#define REPORT_MAP_CHAR_UUID (0x2A4B) +#define BOOT_KEYBOARD_INPUT_REPORT_CHAR_UUID (0x2A22) +#define BOOT_KEYBOARD_OUTPUT_REPORT_CHAR_UUID (0x2A32) +#define BOOT_MOUSE_INPUT_REPORT_CHAR_UUID (0x2A33) +#define HID_INFORMATION_CHAR_UUID (0x2A4A) +#define HID_CONTROL_POINT_CHAR_UUID (0x2A4C) + +/* UUIDs for scan parameter service */ +#define SCAN_PARAMETER_SERVICE_UUID (0x1813) +#define SCAN_INTERVAL_WINDOW_CHAR_UUID (0x2A4F) +#define SCAN_REFRESH_CHAR_UUID (0x2A31) + +/* UUIDs for running speed and cadence service */ +#define RUNNING_SPEED_CADENCE_SERVICE_UUID (0x1814) +#define RUNNING_SPEED_CADENCE_MEASUREMENT_CHAR_UUID (0x2A53) +#define RUNNING_SPEED_CADENCE_FEATURE_CHAR_UUID (0x2A54) + +/* UUIDs for automation IO service */ +#define AUTOMATION_IO_SERVICE_UUID (0x1815) +#define AUTOMATION_IO_DIGITAL_CHAR_UUID (0x2A56) +#define AUTOMATION_IO_ANALOG_CHAR_UUID (0x2A58) +#define AUTOMATION_IO_AGGREGATE_CHAR_UUID (0x2A5A) + +/* UUIDs for cycling speed and cadence service */ +#define CYCLING_SPEED_CADENCE_SERVICE_UUID (0x1816) +#define CYCLING_SPEED_CADENCE_MEASUREMENT_CHAR_UUID (0x2A5B) +#define CYCLING_SPEED_CADENCE_FEATURE_CHAR_UUID (0x2A5C) + +/* UUIDs for cycling power service */ +#define CYCLING_POWER_SERVICE_UUID (0x1818) +#define CYCLING_POWER_MEASUREMENT_CHAR_UUID (0x2A63) +#define CYCLING_POWER_FEATURE_CHAR_UUID (0x2A65) +#define CYCLING_POWER_SENSOR_LOCATION_CHAR_UUID (0x2A5D) + +/* UUIDs for location and navigation device */ +#define LOCATION_NAVIGATION_SERVICE_UUID (0x1819) +#define LN_FEATURE_UUID (0x2A6A) +#define LOCATION_SPEED_UUID (0x2A67) +#define POSITION_QUALITY_UUID (0x2A69) +#define LN_CONTROL_POINT_UUID (0x2A6B) +#define NAVIGATION_UUID (0x2A68) + +/* UUIDs for environmental sensing profile */ +#define ENVIRONMENTAL_SENSING_SERVICE_UUID (0x181A) +#define DESCRIPTOR_VALUE_CHANGED_UUID (0x2A7D) +#define APPARENT_WIND_DIRECTION_UUID (0x2A73) +#define APPARENT_WIND_SPEED_UUID (0x2A72) +#define DEW_POINT_UUID (0x2A7B) +#define ELEVATION_UUID (0x2A6C) +#define GUST_FACTOR_UUID (0x2A74) +#define HEAT_INDEX_UUID (0x2A7A) +#define HUMIDITY_UUID (0x2A6F) +#define IRRADIANCE_UUID (0x2A77) +#define POLLEN_CONCENTRATION_UUID (0x2A75) +#define RAINFALL_UUID (0x2A78) +#define PRESSURE_UUID (0x2A6D) +#define TEMPERATURE_UUID (0x2A6E) +#define TRUE_WIND_DIRECTION_UUID (0x2A71) +#define TRUE_WIND_SPEED_UUID (0x2A70) +#define UV_INDEX_UUID (0x2A76) +#define WIND_CHILL_UUID (0x2A79) +#define BAROMETRIC_PRESSURE_TREND_UUID (0x2AA3) +#define MAGNETIC_DECLINATION_UUID (0x2A2C) +#define MAGNETIC_FLUX_DENSITY_2D_UUID (0x2AA0) +#define MAGNETIC_FLUX_DENSITY_3D_UUID (0x2AA1) + +/* UUIDs for body composition service */ +#define BODY_COMPOSITION_SERVICE_UUID (0x181B) +#define BODY_COMPOSITION_MEASUREMENT_CHAR_UUID (0x2A9C) +#define BODY_COMPOSITION_FEATURE_CHARAC (0x2A9B) + +/* UUIDs for user data service */ +#define USER_DATA_SERVICE_UUID (0x181C) +#define AERO_HR_LOWER_LIMIT_CHAR_UUID (0x2A7E) +#define AEROBIC_THRESHOLD_CHAR_UUID (0x2A7F) +#define AGE_CHAR_UUID (0x2A80) +#define ANAERO_HR_LOWER_LIMIT_CHAR_UUID (0x2A81) +#define ANAERO_HR_UPPER_LIMIT_CHAR_UUID (0x2A82) +#define ANAEROBIC_THRESHOLD_CHAR_UUID (0x2A83) +#define AERO_HR_UPPER_LIMIT_CHAR_UUID (0x2A84) +#define BIRTH_DATE_CHAR_UUID (0x2A85) +#define DATE_THRESHOLD_ASSESSMENT_CHAR_UUID (0x2A86) +#define EMAIL_ADDRESS_CHAR_UUID (0x2A87) +#define FAT_BURN_HR_LOWER_LIMIT_CHAR_UUID (0x2A88) +#define FAT_BURN_HR_UPPER_LIMIT_CHAR_UUID (0x2A89) +#define FIRST_NAME_CHAR_UUID (0x2A8A) +#define FIVE_ZONE_HR_LIMIT_CHAR_UUID (0x2A8B) +#define GENDER_CHAR_UUID (0x2A8C) +#define HEART_RATE_MAX_CHAR_UUID (0x2A8D) +#define HEIGHT_CHAR_UUID (0x2A8E) +#define HIP_CIRC_CHAR_UUID (0x2A8F) +#define LAST_NAME_CHAR_UUID (0x2A90) +#define MAX_RECO_HEART_RATE_CHAR_UUID (0x2A91) +#define RESTING_HEART_RATE_CHAR_UUID (0x2A92) +#define SPORT_TYPE_CHAR_UUID (0x2A93) +#define THREE_ZONE_HR_LIMIT_CHAR_UUID (0x2A94) +#define TWO_ZONE_HR_LIMIT_CHAR_UUID (0x2A95) +#define VO2_MAX_CHAR_UUID (0x2A96) +#define WAIST_CIRC_CHAR_UUID (0x2A97) +#define WEIGHT_CHAR_UUID (0x2A98) +#define DATABASE_CHANGE_INCREMENT_CHAR_UUID (0x2A99) +#define USER_INDEX_CHAR_UUID (0x2A9A) +#define USER_CONTROL_POINT_CHAR_UUID (0x2A9F) +#define LANGUAGE_CHAR_UUID (0x2AA2) + +/* UUIDs for weight scale profile */ +#define WEIGHT_SCALE_SERVICE_UUID (0x181D) +#define WEIGHT_SCALE_MEASUREMENT_CHAR_UUID (0x2A9D) +#define WEIGHT_SCALE_FEATURE_CHAR_UUID (0x2A9E) + +/* UUIDs for weight scale profile */ +#define BOND_MANAGEMENT_SERVICE_UUID (0x181E) +#define BM_CONTROL_POINT_CHAR_UUID (0x2AA4) +#define BM_FEATURE_CHAR_UUID (0x2AA5) + +/* UUIDs for Internet Support Service */ +#define INTERNET_SUPPORT_SERVICE_UUID (0x1820) + +/* UUIDs for Indoor Positioning Service */ +#define INDOOR_POSITIONING_SERVICE_UUID (0x1821) +#define IP_CONFIGURATION_CHAR_UUID (0x2AAD) +#define IP_LATITUDE_CHAR_UUID (0x2AAE) +#define IP_LONGITUDE_CHAR_UUID (0x2AAF) + +/* UUIDs for HTTP proxy Service */ +#define HTTP_PROXY_SERVICE_UUID (0x1823) +#define HTTP_URI_CHAR_UUID (0x2AB6) +#define HTTP_HEADERS_CHAR_UUID (0x2AB7) +#define HTTP_STATUS_CODE_CHAR_UUID (0x2AB8) +#define HTTP_ENTITY_BODY_CHAR_UUID (0x2AB9) +#define HTTP_CONTROL_POINT_CHAR_UUID (0x2ABA) +#define HTTP_SECURITY_CHAR_UUID (0x2ABB) + +/* UUIDs for Object Transfer Service */ +#define OBJECT_TRANSFER_SERVICE_UUID (0x1825) +#define OTS_FEATURE_CHAR_UUID (0x2ABD) +#define OBJECT_NAME_CHAR_UUID (0x2ABE) +#define OBJECT_TYPE_CHAR_UUID (0x2ABF) +#define OBJECT_SIZE_CHAR_UUID (0x2AC0) +#define OBJECT_PROPERTIES_CHAR_UUID (0x2AC4) +#define OBJECT_ACTION_CONTROL_POINT_CHAR_UUID (0x2AC5) +#define OBJECT_LIST_CONTROL_POINT_CHAR_UUID (0x2AC6) + +/* UUIDs for Zigbee Direct Service */ +#define ZIGBEE_DIRECT_COMM_SERVICE_UUID (0xFFF7) + +/* Custom Services*/ +/* UUIDs for data transfer service */ +#define DT_SERVICE_UUID (0xFE80) +#define DT_TX_CHAR_UUID (0xFE81) +#define DT_RX_CHAR_UUID (0xFE82) +#define DT_THROUGHPUT_CHAR_UUID (0xFE83) + +/* UUIDs for custom battery service */ +#define CUSTOM_BATTERY_SERVICE_UUID (0xF2F0) +#define CUSTOM_BATTERY_LEVEL_CHAR_UUID (0xF2F1) + +/* Custom Services*/ +/* UUIDs for data transfer service */ +#define LED_BUTTON_SERVICE_UUID (0x1A30) +#define LED_CHAR_UUID (0x2B50) +#define BUTTON_CHAR_UUID (0x2B51) +/*UUIDs for End Device Management Service*/ +#define END_DEVICE_MGT_SERVICE_UUID (0x1A40) +#define END_DEVICE_STATUS_CHAR_UUID (0x2B60) + +#define P2P_SERVICE_UUID (0xFE40) +#define P2P_WRITE_CHAR_UUID (0xFE41) +#define P2P_NOTIFY_CHAR_UUID (0xFE42) + +#define HOME_SERVICE_UUID (0xFE90) +#define HOME_WRITE_CHAR_UUID (0xFE91) +#define HOME_NOTIFY_CHAR_UUID (0xFE92) + +#define CAM_SERVICE_UUID (0xFEA0) +#define CAM_WRITE_CHAR_UUID (0xFEA1) +#define CAM_NOTIFY_CHAR_UUID (0xFEA2) + +/* UUIDs for Cable Replacement Service */ +#define CRS_SERVICE_UUID (0xFE60) +#define CRS_TX_CHAR_UUID (0xFE61) +#define CRS_RX_CHAR_UUID (0xFE62) + +/* UUIDs for Apple Notification Center Service */ +#define ANCS_SERVICE_UUID (0xF431) +#define ANCS_NOTIFICATION_SOURCE_CHAR_UUID (0x120D) +#define ANCS_CONTROL_POINT_CHAR_UUID (0xD8F3) +#define ANCS_DATA_SOURCE_CHAR_UUID (0xC6E9) + +/* UUIDs for Apple Media Service start from iOS 8*/ +#define AMS_SERVICE_UUID (0x502B) +#define AMS_REMOTE_COMMAND_CHAR_UUID (0x81D8) +#define AMS_ENTITY_UPDATE_CHAR_UUID (0xABCE) +#define AMS_ENTITY_ATTRIBUTE_CHAR_UUID (0xF38C) +#endif /* _UUID_H_ */ diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/zdd_stm.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/zdd_stm.h new file mode 100644 index 0000000..5d9aa5a --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Inc/zdd_stm.h @@ -0,0 +1,100 @@ + +/** + ****************************************************************************** + * @file zdd_stm.h + * @author MCD Application Team + * @brief Header for zdd_stm.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __ZDD_STM_H +#define __ZDD_STM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ + + + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + /* ZDD P2P Events */ + ZDD_P2P_STM__NOTIFY_ENABLED_EVT, + ZDD_P2P_STM_NOTIFY_DISABLED_EVT, + ZDD_P2P_STM_READ_EVT, + ZDD_P2P_STM_WRITE_EVT, + ZDD_P2P_STM_BOOT_REQUEST_EVT, + /* ZDD Security Events */ + ZDD_SEC_P_256_INDICATE_ENABLED_EVT, + ZDD_SEC_P_256_INDICATE_DISABLED_EVT, + ZDD_SEC_P_256_WRITE_EVT, + ZDD_SEC_CURVE25519_INDICATE_ENABLED_EVT, + ZDD_SEC_CURVE25519_INDICATE_DISABLED_EVT, + ZDD_SEC_CURVE25519_WRITE_EVT, + /* ZDD Commissioning Events */ + ZDD_COMM_FORM_NWK_WRITE_EVT, + ZDD_COMM_JOIN_NWK_WRITE_EVT, + ZDD_COMM_PERMIT_JOIN_WRITE_EVT, + ZDD_COMM_LEAVE_NWK_WRITE_EVT, + ZDD_COMM_STATUS_NOTIFY_ENABLED_EVT, + ZDD_COMM_STATUS_NOTIFY_DISABLED_EVT, + ZDD_COMM_STATUS_READ_EVT, + /* ZDD Tunnelling Events */ + ZDD_TUNN_ZDTS_NPDU_INDICATE_ENABLED_EVT, + ZDD_TUNN_ZDTS_NPDU_INDICATE_DISABLED_EVT, + ZDD_TUNN_ZDTS_NPDU_WRITE_EVT + +} ZDD_STM_Opcode_evt_t; + +typedef struct +{ + uint8_t * pPayload; + uint8_t Length; +}ZDD_STM_Data_t; + +typedef struct +{ + ZDD_STM_Opcode_evt_t ZDD_Evt_Opcode; + ZDD_STM_Data_t DataTransfered; + uint16_t ConnectionHandle; + uint8_t ServiceInstance; +}ZDD_STM_App_Notification_evt_t; + + +/* Exported constants --------------------------------------------------------*/ +#define ZDD_P2P_NOTIFY_CHAR_UUID P2P_NOTIFY_CHAR_UUID /* Temp */ +#define ZDD_SEC_P_256_CHAR_UUID (0xAF42) /* P-256 */ +#define ZDD_SEC_CURVE25519_CHAR_UUID (0xAF43) /* Curve25519 */ +#define ZDD_COMM_STATUS_CHAR_UUID (0x377D) /* Commissioning Status */ +#define ZDD_TUNN_ZDTS_NPDU_CHAR_UUID (0x78FD) /* ZDTS-NPDU */ + +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void ZDD_STM_Init( void ); +void ZDD_STM_App_Notification(ZDD_STM_App_Notification_evt_t *pNotification); +tBleStatus ZDD_STM_App_Update_Char(uint16_t UUID, uint8_t payloadLen, uint8_t *pPayload); + + +#ifdef __cplusplus +} +#endif + +#endif /*__ZDD_STM_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/common_blesvc.h b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/common_blesvc.h new file mode 100644 index 0000000..2cf1552 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/common_blesvc.h @@ -0,0 +1,54 @@ + +/** + ****************************************************************************** + * @file common_blesvc.h + * @author MCD Application Team + * @brief Header for ble modules + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __COMMON_BLESVC_H +#define __COMMON_BLESVC_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "ble_common.h" +#include "ble.h" +#include "dbg_trace.h" + + + +/* Exported types ------------------------------------------------------------*/ +typedef enum +{ + COMSVC_Notification = ( 1 << 0 ), + COMSVC_Indication = ( 1 << 1 ), +} COMSVC_ClientCharConfMask_t; + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ + + +#ifdef __cplusplus +} +#endif + +#endif /*__COMMON_BLESVC_H */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/p2p_stm.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/p2p_stm.c new file mode 100644 index 0000000..15ec975 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/p2p_stm.c @@ -0,0 +1,295 @@ +/** + ****************************************************************************** + * @file p2p_stm.c + * @author MCD Application Team + * @brief Peer to Peer Service (Custom STM) + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Includes ------------------------------------------------------------------*/ +#include "common_blesvc.h" + +/* Private typedef -----------------------------------------------------------*/ +typedef struct{ + uint16_t PeerToPeerSvcHdle; /**< Service handle */ + uint16_t P2PWriteClientToServerCharHdle; /**< Characteristic handle */ + uint16_t P2PNotifyServerToClientCharHdle; /**< Characteristic handle */ +#if(BLE_CFG_OTA_REBOOT_CHAR != 0) + uint16_t RebootReqCharHdle; /**< Characteristic handle */ +#endif +}PeerToPeerContext_t; + +/* Private defines -----------------------------------------------------------*/ +#define UUID_128_SUPPORTED 1 + +#if (UUID_128_SUPPORTED == 1) +#define BM_UUID_LENGTH UUID_TYPE_128 +#else +#define BM_UUID_LENGTH UUID_TYPE_16 +#endif + +#define BM_REQ_CHAR_SIZE (3) + + +/* Private macros ------------------------------------------------------------*/ + +/* Private variables ---------------------------------------------------------*/ +/** + * Reboot Characteristic UUID + * 0000fe11-8e22-4541-9d4c-21edae82ed19 + */ +#if(BLE_CFG_OTA_REBOOT_CHAR != 0) +#if (UUID_128_SUPPORTED == 1) +static const uint8_t BM_REQ_CHAR_UUID[16] = {0x19, 0xed, 0x82, 0xae, + 0xed, 0x21, 0x4c, 0x9d, + 0x41, 0x45, 0x22, 0x8e, + 0x11, 0xFE, 0x00, 0x00}; +#else +static const uint8_t BM_REQ_CHAR_UUID[2] = {0x11, 0xFE}; +#endif +#endif + +/** + * START of Section BLE_DRIVER_CONTEXT + */ +PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") static PeerToPeerContext_t aPeerToPeerContext; + +/** + * END of Section BLE_DRIVER_CONTEXT + */ +/* Private function prototypes -----------------------------------------------*/ +static SVCCTL_EvtAckStatus_t PeerToPeer_Event_Handler(void *Event); + + +/* Functions Definition ------------------------------------------------------*/ +/* Private functions ----------------------------------------------------------*/ + +#define COPY_UUID_128(uuid_struct, uuid_15, uuid_14, uuid_13, uuid_12, uuid_11, uuid_10, uuid_9, uuid_8, uuid_7, uuid_6, uuid_5, uuid_4, uuid_3, uuid_2, uuid_1, uuid_0) \ +do {\ + uuid_struct[0] = uuid_0; uuid_struct[1] = uuid_1; uuid_struct[2] = uuid_2; uuid_struct[3] = uuid_3; \ + uuid_struct[4] = uuid_4; uuid_struct[5] = uuid_5; uuid_struct[6] = uuid_6; uuid_struct[7] = uuid_7; \ + uuid_struct[8] = uuid_8; uuid_struct[9] = uuid_9; uuid_struct[10] = uuid_10; uuid_struct[11] = uuid_11; \ + uuid_struct[12] = uuid_12; uuid_struct[13] = uuid_13; uuid_struct[14] = uuid_14; uuid_struct[15] = uuid_15; \ +}while(0) + +/* Hardware Characteristics Service */ +/* + The following 128bits UUIDs have been generated from the random UUID + generator: + D973F2E0-B19E-11E2-9E96-0800200C9A66: Service 128bits UUID + D973F2E1-B19E-11E2-9E96-0800200C9A66: Characteristic_1 128bits UUID + D973F2E2-B19E-11E2-9E96-0800200C9A66: Characteristic_2 128bits UUID + */ +#define COPY_P2P_SERVICE_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0xfe,0x40,0xcc,0x7a,0x48,0x2a,0x98,0x4a,0x7f,0x2e,0xd5,0xb3,0xe5,0x8f) +#define COPY_P2P_WRITE_CHAR_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0xfe,0x41,0x8e,0x22,0x45,0x41,0x9d,0x4c,0x21,0xed,0xae,0x82,0xed,0x19) +#define COPY_P2P_NOTIFY_UUID(uuid_struct) COPY_UUID_128(uuid_struct,0x00,0x00,0xfe,0x42,0x8e,0x22,0x45,0x41,0x9d,0x4c,0x21,0xed,0xae,0x82,0xed,0x19) + + + +/** + * @brief Event handler + * @param Event: Address of the buffer holding the Event + * @retval Ack: Return whether the Event has been managed or not + */ +static SVCCTL_EvtAckStatus_t PeerToPeer_Event_Handler(void *Event) +{ + SVCCTL_EvtAckStatus_t return_value; + hci_event_pckt *event_pckt; + evt_blecore_aci *blecore_evt; + aci_gatt_attribute_modified_event_rp0 * attribute_modified; + P2PS_STM_App_Notification_evt_t Notification; + + return_value = SVCCTL_EvtNotAck; + event_pckt = (hci_event_pckt *)(((hci_uart_pckt*)Event)->data); + + switch(event_pckt->evt) + { + case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE: + { + blecore_evt = (evt_blecore_aci*)event_pckt->data; + switch(blecore_evt->ecode) + { + case ACI_GATT_ATTRIBUTE_MODIFIED_VSEVT_CODE: + { + attribute_modified = (aci_gatt_attribute_modified_event_rp0*)blecore_evt->data; + if(attribute_modified->Attr_Handle == (aPeerToPeerContext.P2PNotifyServerToClientCharHdle + 2)) + { + /** + * Descriptor handle + */ + return_value = SVCCTL_EvtAckFlowEnable; + /** + * Notify to application + */ + if(attribute_modified->Attr_Data[0] & COMSVC_Notification) + { + Notification.P2P_Evt_Opcode = P2PS_STM__NOTIFY_ENABLED_EVT; + P2PS_STM_App_Notification(&Notification); + } + else + { + Notification.P2P_Evt_Opcode = P2PS_STM_NOTIFY_DISABLED_EVT; + P2PS_STM_App_Notification(&Notification); + } + } + + else if(attribute_modified->Attr_Handle == (aPeerToPeerContext.P2PWriteClientToServerCharHdle + 1)) + { + BLE_DBG_P2P_STM_MSG("-- GATT : LED CONFIGURATION RECEIVED\n"); + Notification.P2P_Evt_Opcode = P2PS_STM_WRITE_EVT; + Notification.DataTransfered.Length=attribute_modified->Attr_Data_Length; + Notification.DataTransfered.pPayload=attribute_modified->Attr_Data; + P2PS_STM_App_Notification(&Notification); + } +#if(BLE_CFG_OTA_REBOOT_CHAR != 0) + else if(attribute_modified->Attr_Handle == (aPeerToPeerContext.RebootReqCharHdle + 1)) + { + BLE_DBG_P2P_STM_MSG("-- GATT : REBOOT REQUEST RECEIVED\n"); + Notification.P2P_Evt_Opcode = P2PS_STM_BOOT_REQUEST_EVT; + Notification.DataTransfered.Length=attribute_modified->Attr_Data_Length; + Notification.DataTransfered.pPayload=attribute_modified->Attr_Data; + P2PS_STM_App_Notification(&Notification); + } +#endif + } + break; + + default: + break; + } + } + break; /* HCI_HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE_SPECIFIC */ + + default: + break; + } + + return(return_value); +}/* end SVCCTL_EvtAckStatus_t */ + + +/* Public functions ----------------------------------------------------------*/ + +/** + * @brief Service initialization + * @param None + * @retval None + */ +void P2PS_STM_Init(void) +{ + + Char_UUID_t uuid16; + + /** + * Register the event handler to the BLE controller + */ + SVCCTL_RegisterSvcHandler(PeerToPeer_Event_Handler); + + /** + * Peer To Peer Service + * + * Max_Attribute_Records = 2*no_of_char + 1 + * service_max_attribute_record = 1 for Peer To Peer service + + * 2 for P2P Write characteristic + + * 2 for P2P Notify characteristic + + * 1 for client char configuration descriptor + + * + */ + COPY_P2P_SERVICE_UUID(uuid16.Char_UUID_128); + aci_gatt_add_service(UUID_TYPE_128, + (Service_UUID_t *) &uuid16, + PRIMARY_SERVICE, +#if (BLE_CFG_OTA_REBOOT_CHAR != 0) + 2+ +#endif + 6, + &(aPeerToPeerContext.PeerToPeerSvcHdle)); + + /** + * Add LED Characteristic + */ + COPY_P2P_WRITE_CHAR_UUID(uuid16.Char_UUID_128); + aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle, + UUID_TYPE_128, &uuid16, + 2, + CHAR_PROP_WRITE_WITHOUT_RESP|CHAR_PROP_READ, + ATTR_PERMISSION_NONE, + GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */ + 10, /* encryKeySize */ + 1, /* isVariable */ + &(aPeerToPeerContext.P2PWriteClientToServerCharHdle)); + + /** + * Add Button Characteristic + */ + COPY_P2P_NOTIFY_UUID(uuid16.Char_UUID_128); + aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle, + UUID_TYPE_128, &uuid16, + 2, + CHAR_PROP_NOTIFY, + ATTR_PERMISSION_NONE, + GATT_NOTIFY_ATTRIBUTE_WRITE, /* gattEvtMask */ + 10, /* encryKeySize */ + 1, /* isVariable: 1 */ + &(aPeerToPeerContext.P2PNotifyServerToClientCharHdle)); + +#if(BLE_CFG_OTA_REBOOT_CHAR != 0) + /** + * Add Boot Request Characteristic + */ + aci_gatt_add_char(aPeerToPeerContext.PeerToPeerSvcHdle, + BM_UUID_LENGTH, + (Char_UUID_t *)BM_REQ_CHAR_UUID, + BM_REQ_CHAR_SIZE, + CHAR_PROP_WRITE_WITHOUT_RESP, + ATTR_PERMISSION_NONE, + GATT_NOTIFY_ATTRIBUTE_WRITE, + 10, + 0, + &(aPeerToPeerContext.RebootReqCharHdle)); +#endif + + + return; +} + +/** + * @brief Characteristic update + * @param UUID: UUID of the characteristic + * @param Service_Instance: Instance of the service to which the characteristic belongs + * + */ +tBleStatus P2PS_STM_App_Update_Char(uint16_t UUID, uint8_t *pPayload) +{ + tBleStatus result = BLE_STATUS_INVALID_PARAMS; + switch(UUID) + { + case P2P_NOTIFY_CHAR_UUID: + + result = aci_gatt_update_char_value(aPeerToPeerContext.PeerToPeerSvcHdle, + aPeerToPeerContext.P2PNotifyServerToClientCharHdle, + 0, /* charValOffset */ + 2, /* charValueLen */ + (uint8_t *) pPayload); + + break; + + default: + break; + } + + return result; +}/* end P2PS_STM_Init() */ + + diff --git a/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c new file mode 100644 index 0000000..bde8a37 --- /dev/null +++ b/firmware/memory_chip_gone/Middlewares/ST/STM32_WPAN/ble/svc/Src/svc_ctl.c @@ -0,0 +1,330 @@ +/** + ****************************************************************************** + * @file svc_ctl.c + * @author MCD Application Team + * @brief BLE Controller + ****************************************************************************** + * @attention + * + * Copyright (c) 2018-2021 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ + + +/* Includes ------------------------------------------------------------------*/ +#include "common_blesvc.h" +#include "cmsis_compiler.h" + +/* Private typedef -----------------------------------------------------------*/ +typedef struct +{ +#if (BLE_CFG_SVC_MAX_NBR_CB > 0) +SVC_CTL_p_EvtHandler_t SVCCTL__SvcHandlerTab[BLE_CFG_SVC_MAX_NBR_CB]; +#endif +uint8_t NbreOfRegisteredHandler; +} SVCCTL_EvtHandler_t; + +typedef struct +{ +#if (BLE_CFG_CLT_MAX_NBR_CB > 0) +SVC_CTL_p_EvtHandler_t SVCCTL_CltHandlerTable[BLE_CFG_CLT_MAX_NBR_CB]; +#endif +uint8_t NbreOfRegisteredHandler; +} SVCCTL_CltHandler_t; + +/* Private defines -----------------------------------------------------------*/ +#define SVCCTL_EGID_EVT_MASK 0xFF00 +#define SVCCTL_GATT_EVT_TYPE 0x0C00 +#define SVCCTL_GAP_DEVICE_NAME_LENGTH 7 + +/* Private macros ------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/** + * START of Section BLE_DRIVER_CONTEXT + */ + +PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") SVCCTL_EvtHandler_t SVCCTL_EvtHandler; +PLACE_IN_SECTION("BLE_DRIVER_CONTEXT") SVCCTL_CltHandler_t SVCCTL_CltHandler; + +/** + * END of Section BLE_DRIVER_CONTEXT + */ + +/* Private functions ----------------------------------------------------------*/ +/* Weak functions ----------------------------------------------------------*/ +void BVOPUS_STM_Init(void); + +__WEAK void BAS_Init( void ) +{ + return; +} + +__WEAK void BLS_Init( void ) +{ + return; +} +__WEAK void CRS_STM_Init( void ) +{ + return; +} +__WEAK void DIS_Init( void ) +{ + return; +} +__WEAK void EDS_STM_Init( void ) +{ + return; +} +__WEAK void HIDS_Init( void ) +{ + return; +} +__WEAK void HRS_Init( void ) +{ + return; +} +__WEAK void HTS_Init( void ) +{ + return; +} +__WEAK void IAS_Init( void ) +{ + return; +} +__WEAK void LLS_Init( void ) +{ + return; +} +__WEAK void TPS_Init( void ) +{ + return; +} +__WEAK void MOTENV_STM_Init( void ) +{ + return; +} +__WEAK void P2PS_STM_Init( void ) +{ + return; +} +__WEAK void ZDD_STM_Init( void ) +{ + return; +} +__WEAK void OTAS_STM_Init( void ) +{ + return; +} +__WEAK void MESH_Init( void ) +{ + return; +} +__WEAK void BVOPUS_STM_Init( void ) +{ + return; +} +__WEAK void SVCCTL_InitCustomSvc( void ) +{ + return; +} + +/* Functions Definition ------------------------------------------------------*/ + +void SVCCTL_Init( void ) +{ + + /** + * Initialize the number of registered Handler + */ + SVCCTL_EvtHandler.NbreOfRegisteredHandler = 0; + SVCCTL_CltHandler.NbreOfRegisteredHandler = 0; + + /** + * Add and Initialize requested services + */ + SVCCTL_SvcInit(); + + return; +} + +__WEAK void SVCCTL_SvcInit(void) +{ + BAS_Init(); + + BLS_Init(); + + CRS_STM_Init(); + + DIS_Init(); + + EDS_STM_Init(); + + HIDS_Init(); + + HRS_Init(); + + HTS_Init(); + + IAS_Init(); + + LLS_Init(); + + TPS_Init(); + + MOTENV_STM_Init(); + + P2PS_STM_Init(); + + ZDD_STM_Init(); + + OTAS_STM_Init(); + + BVOPUS_STM_Init(); + + MESH_Init(); + + SVCCTL_InitCustomSvc(); + + return; +} + +/** + * @brief BLE Controller initialization + * @param None + * @retval None + */ +void SVCCTL_RegisterSvcHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Service_Event_Handler ) +{ +#if (BLE_CFG_SVC_MAX_NBR_CB > 0) + SVCCTL_EvtHandler.SVCCTL__SvcHandlerTab[SVCCTL_EvtHandler.NbreOfRegisteredHandler] = pfBLE_SVC_Service_Event_Handler; + SVCCTL_EvtHandler.NbreOfRegisteredHandler++; +#else + (void)(pfBLE_SVC_Service_Event_Handler); +#endif + + return; +} + +/** + * @brief BLE Controller initialization + * @param None + * @retval None + */ +void SVCCTL_RegisterCltHandler( SVC_CTL_p_EvtHandler_t pfBLE_SVC_Client_Event_Handler ) +{ +#if (BLE_CFG_CLT_MAX_NBR_CB > 0) + SVCCTL_CltHandler.SVCCTL_CltHandlerTable[SVCCTL_CltHandler.NbreOfRegisteredHandler] = pfBLE_SVC_Client_Event_Handler; + SVCCTL_CltHandler.NbreOfRegisteredHandler++; +#else + (void)(pfBLE_SVC_Client_Event_Handler); +#endif + + return; +} + +__WEAK SVCCTL_UserEvtFlowStatus_t SVCCTL_UserEvtRx( void *pckt ) +{ + hci_event_pckt *event_pckt; + evt_blecore_aci *blecore_evt; + SVCCTL_EvtAckStatus_t event_notification_status; + SVCCTL_UserEvtFlowStatus_t return_status; + uint8_t index; + + event_pckt = (hci_event_pckt*) ((hci_uart_pckt *) pckt)->data; + event_notification_status = SVCCTL_EvtNotAck; + + switch (event_pckt->evt) + { + case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE: + { + blecore_evt = (evt_blecore_aci*) event_pckt->data; + + switch ((blecore_evt->ecode) & SVCCTL_EGID_EVT_MASK) + { + case SVCCTL_GATT_EVT_TYPE: +#if (BLE_CFG_SVC_MAX_NBR_CB > 0) + /* For Service event handler */ + for (index = 0; index < SVCCTL_EvtHandler.NbreOfRegisteredHandler; index++) + { + event_notification_status = SVCCTL_EvtHandler.SVCCTL__SvcHandlerTab[index](pckt); + /** + * When a GATT event has been acknowledged by a Service, there is no need to call the other registered handlers + * a GATT event is relevant for only one Service + */ + if (event_notification_status != SVCCTL_EvtNotAck) + { + /** + * The event has been managed. The Event processing should be stopped + */ + break; + } + } +#endif +#if (BLE_CFG_CLT_MAX_NBR_CB > 0) + /* For Client event handler */ + event_notification_status = SVCCTL_EvtNotAck; + for(index = 0; index <SVCCTL_CltHandler.NbreOfRegisteredHandler; index++) + { + event_notification_status = SVCCTL_CltHandler.SVCCTL_CltHandlerTable[index](pckt); + /** + * When a GATT event has been acknowledged by a Client, there is no need to call the other registered handlers + * a GATT event is relevant for only one Client + */ + if (event_notification_status != SVCCTL_EvtNotAck) + { + /** + * The event has been managed. The Event processing should be stopped + */ + break; + } + } +#endif + break; + + default: + break; + } + } + break; /* HCI_HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE_SPECIFIC */ + + default: + break; + } + + /** + * When no registered handlers (either Service or Client) has acknowledged the GATT event, it is reported to the application + * a GAP event is always reported to the application. + */ + switch (event_notification_status) + { + case SVCCTL_EvtNotAck: + /** + * The event has NOT been managed. + * It shall be passed to the application for processing + */ + return_status = SVCCTL_App_Notification(pckt); + break; + + case SVCCTL_EvtAckFlowEnable: + return_status = SVCCTL_UserEvtFlowEnable; + break; + + case SVCCTL_EvtAckFlowDisable: + return_status = SVCCTL_UserEvtFlowDisable; + break; + + default: + return_status = SVCCTL_UserEvtFlowEnable; + break; + } + + return (return_status); +} + + |
