BLE_TYQ_BJQ_CH584M/APP/include/multiCentral.h

112 lines
3.6 KiB
C
Raw Normal View History

2024-12-07 17:09:36 +08:00
/***
* @Author: mbw
* @Date: 2024-12-03 11:13:13
* @LastEditors: mbw && 1600520629@qq.com
* @LastEditTime: 2024-12-06 14:47:52
* @FilePath: \ble_-tyq_-bjq_-ch584-m\APP\include\multiCentral.h
* @Description:
* @
* @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
*/
2024-12-03 11:11:30 +08:00
/********************************** (C) COPYRIGHT *******************************
* File Name : multiCentral.h
* Author : WCH
* Version : V1.0
* Date : 2018/11/12
* Description :
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#ifndef MULTICENTRAL_H
#define MULTICENTRAL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
* INCLUDES
*/
/*********************************************************************
* CONSTANTS
*/
// Simple BLE Observer Task Events
2024-12-07 17:09:36 +08:00
// 定义设备启动事件的常量
2024-12-03 11:11:30 +08:00
#define START_DEVICE_EVT 0x0001
2024-12-07 17:09:36 +08:00
// 定义启动发现过程事件的常量
2024-12-03 11:11:30 +08:00
#define START_DISCOVERY_EVT 0x0002
2024-12-07 17:09:36 +08:00
// 定义启动扫描过程事件的常量
2024-12-03 11:11:30 +08:00
#define START_SCAN_EVT 0x0004
2024-12-07 17:09:36 +08:00
// 定义启动服务发现事件的常量
2024-12-03 11:11:30 +08:00
#define START_SVC_DISCOVERY_EVT 0x0008
2024-12-07 17:09:36 +08:00
// 定义启动参数更新事件的常量
2024-12-03 11:11:30 +08:00
#define START_PARAM_UPDATE_EVT 0x0010
2024-12-07 17:09:36 +08:00
// 定义启动读或写操作事件的常量
2024-12-03 11:11:30 +08:00
#define START_READ_OR_WRITE_EVT 0x0020
2024-12-07 17:09:36 +08:00
// 定义启动读取RSSI事件的常量
2024-12-03 11:11:30 +08:00
#define START_READ_RSSI_EVT 0x0040
2024-12-07 17:09:36 +08:00
// 定义建立连接超时事件的常量
2024-12-03 11:11:30 +08:00
#define ESTABLISH_LINK_TIMEOUT_EVT 0x0080
2024-12-07 17:09:36 +08:00
// 定义启动写入CCCD客户端特性配置描述符事件的常量
2024-12-03 11:11:30 +08:00
#define START_WRITE_CCCD_EVT 0x0100
#define CONNECT0_ITEM 0
2024-12-07 17:09:36 +08:00
#define CONNECT1_ITEM 1
// #define CONNECT2_ITEM 2
// #define CONNECT3_ITEM 3
// #define CONNECT4_ITEM 4
// #define CONNECT5_ITEM 5
// #define CONNECT6_ITEM 6
// #define CONNECT7_ITEM 7
2024-12-03 11:11:30 +08:00
/*********************************************************************
* MACROS
*/
typedef struct
{
uint8_t taskID; // Task ID for internal task/event processing
uint16_t connHandle; // Connection handle of current connection
uint8_t state; // Application state
uint8_t peerAddr[B_ADDR_LEN];
uint8_t discState; // Discovery state
uint8_t procedureInProgress; // GATT read/write procedure state
uint16_t svcStartHdl; // Discovered service start handle
uint16_t svcEndHdl; // Discovered service end handle
uint16_t charHdl; // Discovered characteristic handle
uint16_t cccHdl; // client characteristic configuration discovery handle
} centralConnItem_t;
typedef struct
{
uint8_t peerAddr[B_ADDR_LEN];
} peerAddrDefItem_t;
/*********************************************************************
* FUNCTIONS
*/
/*
* Task Initialization for the BLE Application
*/
extern void Central_Init(void);
/*
* Task Event Processor for the BLE Application
*/
extern uint16_t Central_ProcessEvent(uint8_t task_id, uint16_t events);
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* MULTICENTRAL_H */