作为主设备去连接其他蓝牙设备
This commit is contained in:
6
Makefile
6
Makefile
@ -245,8 +245,7 @@ INCLUDES := \
|
||||
-Iinclude_lib/media/aispeech/enc/include \
|
||||
-Icpu/br28/audio_hearing \
|
||||
-Iinclude_lib/media/cvp \
|
||||
-Iapps/earphone/xtell_Sensor \
|
||||
-Iapps/earphone/remote_control/ \
|
||||
-Iapps/earphone/xtell_remote_control \
|
||||
-I$(SYS_INC_DIR) \
|
||||
|
||||
|
||||
@ -616,8 +615,7 @@ c_SRC_FILES := \
|
||||
|
||||
# 定义需要自动搜索 .c 文件的目录列表
|
||||
C_SRC_DIRS := \
|
||||
apps/earphone/remote_control \
|
||||
apps/earphone/xtell_Sensor \
|
||||
apps/earphone/xtell_remote_control \
|
||||
|
||||
# 使用 shell 的 find 命令递归查找所有 .c 文件
|
||||
# foreach 遍历 C_SRC_DIRS 中的每一个目录
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* @brief 处理Type A卡片事件。
|
||||
* @brief 处理Type A卡片事件。uid:8位数组
|
||||
* @details
|
||||
* 该函数执行ISO/IEC 14443 Type A卡片的完整激活流程,包括:
|
||||
* 1. 初始化读卡器以支持Type A协议。
|
||||
@ -34,7 +34,7 @@
|
||||
* 5. 操作结束后关闭RF场。
|
||||
* @return 无。
|
||||
*/
|
||||
void TYPE_A_EVENT(void)
|
||||
void TYPE_A_EVENT(char* uid)
|
||||
{
|
||||
unsigned char result;
|
||||
int i;
|
||||
@ -75,6 +75,7 @@ void TYPE_A_EVENT(void)
|
||||
xlog("-> UID = ");
|
||||
for (i = 0; i < PICC_A.UID_Length; i++)
|
||||
{
|
||||
uid[i] = PICC_A.UID[i];
|
||||
xlog("%02X", PICC_A.UID[i]);
|
||||
}
|
||||
xlog("\r\n");
|
||||
@ -45,7 +45,7 @@
|
||||
#include "default_event_handler.h"
|
||||
#include "debug.h"
|
||||
#include "system/event.h"
|
||||
#include "../remote_control/nvs.h"
|
||||
#include "../nvs/nvs.h"
|
||||
#if (JL_EARPHONE_APP_EN)
|
||||
#include "rcsp_adv_bluetooth.h"
|
||||
#endif
|
||||
@ -300,7 +300,7 @@ static const char *const phy_result[] = { // PHY速率类型字符串
|
||||
};
|
||||
|
||||
// --- 接口操作结构体 ---
|
||||
static const struct ble_client_operation_t client_operation = {
|
||||
const struct ble_client_operation_t client_operation = {
|
||||
.scan_enable = bt_ble_scan_enable,
|
||||
.disconnect = ble_disconnect,
|
||||
.get_buffer_vaild = get_buffer_vaild_len,
|
||||
@ -1,5 +1,5 @@
|
||||
#include "RC_app_main.h"
|
||||
#include "nvs.h"
|
||||
#include "task_func.h"
|
||||
#include "./nvs/nvs.h"
|
||||
#include "timer.h"
|
||||
#include "system/includes.h"
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
// 外部函数声明
|
||||
// =================================================================================
|
||||
extern void TYPE_V_EVENT(char* uid);
|
||||
|
||||
extern void TYPE_A_EVENT(char* uid);
|
||||
|
||||
// =================================================================================
|
||||
// 静态函数声明
|
||||
@ -41,7 +41,7 @@ static void rc_ble_state_set_disconnected(void);
|
||||
static RC_Context_t g_rc_context; // 全局上下文实例
|
||||
static u16 g_rfid_timer_id = 0; // RFID 定时器ID
|
||||
static u16 g_ble_timer_id = 0; // BLE 定时器ID
|
||||
|
||||
extern const struct ble_client_operation_t client_operation;
|
||||
|
||||
// =================================================================================
|
||||
// 核心回调函数 (Core Callback Handlers)
|
||||
@ -54,8 +54,11 @@ void rc_rfid_callback_handler(void *priv)
|
||||
{
|
||||
u8 uid[UID_LENGTH] = {0};
|
||||
|
||||
TYPE_V_EVENT((char *)uid);
|
||||
|
||||
//读id卡
|
||||
// TYPE_V_EVENT((char *)uid);
|
||||
TYPE_A_EVENT((char *)uid);
|
||||
|
||||
//是否有rfid卡靠近
|
||||
u8 is_new_data = 0;
|
||||
for (int i = 0; i < UID_LENGTH; i++) {
|
||||
if (uid[i] != 0x00) {
|
||||
@ -65,7 +68,7 @@ void rc_rfid_callback_handler(void *priv)
|
||||
}
|
||||
|
||||
if (!is_new_data) {
|
||||
return;
|
||||
return; //没有rfid卡靠近,返回
|
||||
}
|
||||
|
||||
rc_log("New RFID card detected.\n");
|
||||
@ -73,7 +76,7 @@ void rc_rfid_callback_handler(void *priv)
|
||||
RFID_Device_Type_t device_type = get_rfid_device_type(uid);
|
||||
|
||||
switch (device_type) {
|
||||
case RFID_DEVICE_TYPE_MAIN_BOARD:
|
||||
case RFID_DEVICE_TYPE_MAIN_BOARD: //船主板上的rfid卡
|
||||
rc_log("Device is Main Board. Storing MAC...\n");
|
||||
if (ble_hid_is_connected()) {
|
||||
// 先停止扫描和连接尝试,实现断开
|
||||
Reference in New Issue
Block a user