frameworks_bluetooth/feature/include/feature_bluetooth.h

103 lines
3.6 KiB
C

/*
* This file is auto-generated by jsongensource.py, Do not modify it directly!
*/
/*
* Copyright (C) 2023 Xiaomi Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef FEATURE_BLUETOOTH_CONSTANT_H_
#define FEATURE_BLUETOOTH_CONSTANT_H_
#include "bluetooth.h"
#include "bt_list.h"
#include "feature_exports.h"
typedef enum {
A2DP_SINK,
A2DP_SOURCE,
HFP_AG,
HFP_HF,
HID_DEVICE,
PAN_USE,
MAX_FEATURE_ID,
} feature_bluetooth_profile_t;
typedef enum {
ON_ADAPTER_STATE_CHANGE,
ON_DISCOVERY_RESULT,
ON_BOND_STATE_CHANGE,
A2DPSINK_ON_CONNECT_STATE_CHANGE,
AVRCPCONTROL_ELEMENT_ATTRIBUTE_CALLBACK,
} feature_bluetooth_callback_t;
typedef enum {
FEATURE_BLUETOOTH,
FEATURE_BLUETOOTH_BT,
FEATURE_BLUETOOTH_A2DPSINK,
FEATURE_BLUETOOTH_AVRCPCONTROL,
} feature_bluetooth_feature_type_t;
typedef struct {
FeatureInstanceHandle* feature_ins;
FtCallbackId on_adapter_state_changed_cb_id;
} feature_bluetooth_bluetooth_callbacks_t;
typedef struct {
FeatureInstanceHandle* feature_ins;
FtCallbackId on_discovery_result_cb_id;
FtCallbackId on_bond_state_changed_cb_id;
} feature_bluetooth_bluetooth_bt_callbacks_t;
typedef struct {
FeatureInstanceHandle* feature_ins;
FtCallbackId a2dp_sink_connection_state_cb_id;
} feature_bluetooth_a2dp_sink_callbacks_t;
typedef struct {
FeatureInstanceHandle* feature_ins;
FtCallbackId avrcp_control_element_attribute_cb_id;
} feature_bluetooth_avrcp_control_callbacks_t;
typedef struct {
FtCallbackId feature_callback_id;
void* feature;
void* data;
} callback_info_t;
typedef struct {
uv_mutex_t mutex;
bt_list_t* feature_bluetooth_callbacks;
bt_list_t* feature_bluetooth_bt_callbacks;
bt_list_t* feature_a2dp_sink_callbacks;
bt_list_t* feature_avrcp_control_callbacks;
uint32_t created_features;
} feature_bluetooth_features_info_t;
void feature_bluetooth_deal_callback(int status, void* data);
void feature_bluetooth_remove_callback(int status, void* data);
void feature_bluetooth_post_task(FeatureInstanceHandle handle, FtCallbackId callback_id, void* data);
char* StringToFtString(const char* str);
void feature_bluetooth_init_bt_ins(feature_bluetooth_feature_type_t feature, FeatureProtoHandle handle);
void feature_bluetooth_uninit_bt_ins(feature_bluetooth_feature_type_t feature, FeatureProtoHandle handle);
bt_instance_t* feature_bluetooth_get_bt_ins(FeatureInstanceHandle feature);
void feature_bluetooth_add_feature_callback(FeatureInstanceHandle handle, feature_bluetooth_feature_type_t feature_type);
void feature_bluetooth_free_feature_callback(FeatureInstanceHandle handle, feature_bluetooth_feature_type_t feature_type);
void feature_bluetooth_set_feature_callback(FeatureInstanceHandle handle, FtCallbackId callback_id, feature_bluetooth_callback_t callback_type);
FtCallbackId feature_bluetooth_get_feature_callback(FeatureInstanceHandle handle, feature_bluetooth_callback_t callback_type);
void feature_bluetooth_callback_init(bt_instance_t* bt_ins);
void feature_bluetooth_callback_uninit(bt_instance_t* bt_ins);
#endif // FEATURE_BLUETOOTH_CONSTANT_H_