Files
BLV_C1F_Module/BasicCode/Drive/BLE/include/multiCentral.h

98 lines
3.3 KiB
C
Raw Normal View History

/********************************** (C) COPYRIGHT *******************************
* File Name : multiCentral.h
* Author : WCH
* Version : V1.0
* Date : 2018/11/12
* Description :
*******************************************************************************/
#ifndef MULTICENTRAL_H
#define MULTICENTRAL_H
#include "gattprofile.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*********************************************************************
* INCLUDES
*/
#define PERIPHERAL_DEVICE_MAX_NUM 30
/*********************************************************************
* CONSTANTS
*/
// Simple BLE Observer Task Events
#define START_DEVICE_EVT 0x0001
#define START_DISCOVERY_EVT 0x0002
#define START_SCAN_EVT 0x0004
#define START_SVC_DISCOVERY_EVT 0x0008
#define START_PARAM_UPDATE_EVT 0x0010
#define START_READ_OR_WRITE_EVT 0x0020
#define START_READ_RSSI_EVT 0x0040
#define ESTABLISH_LINK_TIMEOUT_EVT 0x0080
#define CONNECT0_ITEM 0
#define CONNECT1_ITEM 1
#define CONNECT2_ITEM 2
/*********************************************************************
* MACROS
*/
#define CENTRAL_CONNECTING 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define CENTRAL_IDLE 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef struct
{
uint8 taskID; // Task ID for internal task/event processing
uint16 connHandle; // Connection handle of current connection
uint8 state; // Application state
//uint8 connecting; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>־
uint8 peerAddr[B_ADDR_LEN];
uint8 discState; // Discovery state
uint8 procedureInProgress; // GATT read/write procedure state
uint16 svcStartHdl; // Discovered service start handle
uint16 svcEndHdl; // Discovered service end handle
uint16 charHdl; // Discovered characteristic handle
} centralConnItem_t;
typedef struct
{
uint8 peerAddr[B_ADDR_LEN];
} peerAddrDefItem_t;
extern BLE_DEVICE_CONFIG* Ble_Device_Head;
/*********************************************************************
* FUNCTIONS
*/
/*
* Task Initialization for the BLE Application
*/
extern void Central_Init( void );
/*
* Task Event Processor for the BLE Application
*/
extern uint16 Central_ProcessEvent( uint8 task_id, uint16 events );
void Clear_Connecting_flg(u8* addr);
void Set_Connecting_flg(u8* addr);
void BLE_Send_Task(void);
void Device_Add_List(BLE_DEVICE_CONFIG* Device_node); //<2F><><EFBFBD><EFBFBD><E8B1B8><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD>
uint8 IS_Empty_Connection(u8 device_type, u8 device_addr); //<2F><>ѯָ<D1AF><D6B8><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8 Connect_Peripheral_Device(u8 device_type, u8 device_addr); //<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>
uint8 Disconnect_Peripheral_Device(u8 device_type, u8 device_addr); //<2F>Ͽ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>
void Peripheral_Notify_Control(u8 device_type, u8 device_addr, u8 notify_id, u8 state); //<2F>򿪻<EFBFBD><F2BFAABB>ر<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD><E8B1B8>֪ͨ
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* MULTICENTRAL_H */