123 lines
3.7 KiB
C
123 lines
3.7 KiB
C
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2020. All rights reserved.
|
|
*
|
|
* Description: service_bt.h
|
|
*
|
|
* Author: linzhaocheng
|
|
*
|
|
* Create: 2024-7-24
|
|
*--------------------------------------------------------------------------*/
|
|
#ifndef SERVICE_BT_H
|
|
#define SERVICE_BT_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "ble_api.h"
|
|
#include "pthread.h"
|
|
#include "osal_addr.h"
|
|
#include "osal_list.h"
|
|
#include "service_hrsensor.h"
|
|
// #include "bts_def.h"
|
|
|
|
#define HEADSET_COD_1 0x240400
|
|
#define HEADSET_COD_2 0x240404
|
|
#define HEADSET_COD_3 0x240418
|
|
|
|
#define FILE_SEND_FAILE 1U << 0
|
|
#define FILE_SEND_SUCCESS 1U << 1
|
|
#define FILE_SEND_SKIP 1U << 2
|
|
#define FILE_SEND_NOSPACE 1U << 3
|
|
#define FILE_SEND_NOSUPPORT 1U << 4
|
|
|
|
/* 发现设备链表节点 */
|
|
typedef struct
|
|
{
|
|
struct osal_list_head node;
|
|
bd_addr_t bd_addr;
|
|
uint8_t name[BD_NAME_LEN];
|
|
bool isPaired;
|
|
bool isConnected;
|
|
int32_t cod;
|
|
int32_t rssi;
|
|
} found_dev_list_node;
|
|
|
|
typedef struct {
|
|
const char *path;
|
|
const void *buffer;
|
|
uint32_t size;
|
|
} file_append_data_t;
|
|
|
|
typedef struct {
|
|
uint8_t setting_mode;
|
|
uint8_t images_number;
|
|
uint8_t switching_mode;
|
|
} custom_dial_parameter_t;
|
|
|
|
typedef void (*contacts_sync_callback_t)(void);
|
|
void tjd_service_bt_register_contacts_event(contacts_sync_callback_t callback);
|
|
void tjd_service_bt_unregister_contacts_event(void);
|
|
|
|
void tjd_music_mutex_init(void);
|
|
void tjd_music_mutex_deinit(void);
|
|
void tjd_music_mutex_lock(pthread_mutex_t *mutex);
|
|
void tjd_music_mutex_unlock(pthread_mutex_t *mutex);
|
|
void tjd_get_music_mutex(pthread_mutex_t *mutex);
|
|
|
|
void tjd_ble_mutex_init(void);
|
|
void tjd_ble_mutex_deinit(void);
|
|
void tjd_ble_mutex_lock(void);
|
|
void tjd_ble_mutex_unlock(void);
|
|
void tjd_get_ble_mutex(pthread_mutex_t *mutex);
|
|
|
|
void tjd_malloc_lrc_buffer(void);
|
|
void tjd_free_lrc_buffer(void);
|
|
void tjd_get_lrc_buffer(uint8_t *g_pv_lrc_);
|
|
void tjd_set_lrc_buffer_data(uint8_t *value, size_t len);
|
|
|
|
struct osal_list_head * tjd_get_found_dev_list(void);
|
|
void tjd_reset_found_dev_list(void);
|
|
void tjd_update_found_dev_list(void);
|
|
void tjd_update_found_dev_node_rssi(const bd_addr_t *bd_addr, int32_t rssi);
|
|
void tjd_show_found_dev_list(void);
|
|
void tjd_add_node_to_found_dev_list(const bd_addr_t *bd_addr, const uint8_t *name, bool isPaired ,bool isConnected, int32_t cod, int32_t rssi);
|
|
|
|
bool tjd_remove_paired_device(const bd_addr_t *bd_addr);
|
|
void tjd_set_headset_last_connected_addr(bd_addr_t *bd_addr);
|
|
bool tjd_get_headset_last_connected_addr(bd_addr_t *bd_addr);
|
|
|
|
uint8_t tjd_service_bt_scan_start(void);
|
|
uint8_t tjd_service_bt_scan_stop(void);
|
|
uint8_t tjd_service_bt_scan_connect(const bd_addr_t *addr);
|
|
uint8_t tjd_service_bt_is_connect(const bd_addr_t *addr);
|
|
bool tjd_check_bt_is_acl_connected(void);
|
|
|
|
uint8_t tjd_service_snk_connect(void);
|
|
uint8_t tjd_service_snk_disconnect(void);
|
|
|
|
uint8_t tjd_service_file_append(file_append_data_t *filedata);
|
|
uint8_t tjd_service_contact_append(file_append_data_t *filedata);
|
|
|
|
uint8_t tjd_service_send_measurement_data(void);
|
|
uint8_t tjd_service_send_hr_measurement_data(void);
|
|
|
|
uint8_t tjd_service_save_dial_parameter(custom_dial_parameter_t *param);
|
|
|
|
void tjd_service_ble_sync_data_open(void);
|
|
void tjd_service_ble_sync_data_close(void);
|
|
void tjd_service_bt_sync_ephemeris_event(void);
|
|
|
|
uint8_t tjd_service_handle_step_data(void);
|
|
uint8_t tjd_service_handle_excise_data(void);
|
|
uint8_t tjd_service_handle_calorie_data(void);
|
|
|
|
uint8_t tjd_service_send_sport_record_data(void);
|
|
uint8_t tjd_service_send_sport_end_record_data(char * file_name);
|
|
|
|
uint8_t tjd_service_send_current_measurement_data(const send_measure_data_t *measure_data);
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |