#include <hardware/bluetooth.h>


/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * 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 ANDROID_INCLUDE_BLUETOOTH_H
#define ANDROID_INCLUDE_BLUETOOTH_H

#include <stdbool.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>

#include "avrcp/avrcp.h"
#include "bluetooth/uuid.h"
#include "raw_address.h"

/**
 * The Bluetooth Hardware Module ID
 */

#define BT_HARDWARE_MODULE_ID "bluetooth"
#define BT_STACK_MODULE_ID "bluetooth"

/** Bluetooth profile interface IDs */
#define BT_PROFILE_HANDSFREE_ID "handsfree"
#define BT_PROFILE_HANDSFREE_CLIENT_ID "handsfree_client"
#define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp"
#define BT_PROFILE_ADVANCED_AUDIO_SINK_ID "a2dp_sink"
#define BT_PROFILE_SOCKETS_ID "socket"
#define BT_PROFILE_HIDHOST_ID "hidhost"
#define BT_PROFILE_HIDDEV_ID "hiddev"
#define BT_PROFILE_PAN_ID "pan"
#define BT_PROFILE_MAP_CLIENT_ID "map_client"
#define BT_PROFILE_SDP_CLIENT_ID "sdp"
#define BT_PROFILE_GATT_ID "gatt"
#define BT_PROFILE_AV_RC_ID "avrcp"
#define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl"
#define BT_PROFILE_HEARING_AID_ID "hearing_aid"

/** Bluetooth Device Name */
typedef struct { uint8_t name[249]; } __attribute__((packed)) bt_bdname_t;

/** Bluetooth Adapter Visibility Modes*/
typedef enum {
  BT_SCAN_MODE_NONE,
  BT_SCAN_MODE_CONNECTABLE,
  BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
} bt_scan_mode_t;

/** Bluetooth Adapter State */
typedef enum { BT_STATE_OFF, BT_STATE_ON } bt_state_t;

/** Bluetooth Adapter Input Output Capabilities which determine Pairing/Security
 */
typedef enum {
  BT_IO_CAP_OUT,    /* DisplayOnly */
  BT_IO_CAP_IO,     /* DisplayYesNo */
  BT_IO_CAP_IN,     /* KeyboardOnly */
  BT_IO_CAP_NONE,   /* NoInputNoOutput */
  BT_IO_CAP_KBDISP, /* Keyboard display */
  BT_IO_CAP_MAX,
  BT_IO_CAP_UNKNOWN = 0xFF /* Unknown value */
} bt_io_cap_t;

/** Bluetooth Error Status */
/** We need to build on this */

typedef enum {
  BT_STATUS_SUCCESS,
  BT_STATUS_FAIL,
  BT_STATUS_NOT_READY,
  BT_STATUS_NOMEM,
  BT_STATUS_BUSY,
  BT_STATUS_DONE, /* request already completed */
  BT_STATUS_UNSUPPORTED,
  BT_STATUS_PARM_INVALID,
  BT_STATUS_UNHANDLED,
  BT_STATUS_AUTH_FAILURE,
  BT_STATUS_RMT_DEV_DOWN,
  BT_STATUS_AUTH_REJECTED,
  BT_STATUS_JNI_ENVIRONMENT_ERROR,
  BT_STATUS_JNI_THREAD_ATTACH_ERROR,
  BT_STATUS_WAKELOCK_ERROR
} bt_status_t;

/** Bluetooth PinKey Code */
typedef struct { uint8_t pin[16]; } __attribute__((packed)) bt_pin_code_t;

typedef struct {
  uint8_t status;
  uint8_t ctrl_state;   /* stack reported state */
  uint64_t tx_time;     /* in ms */
  uint64_t rx_time;     /* in ms */
  uint64_t idle_time;   /* in ms */
  uint64_t energy_used; /* a product of mA, V and ms */
} __attribute__((packed)) bt_activity_energy_info;

typedef struct {
  int32_t app_uid;
  uint64_t tx_bytes;
  uint64_t rx_bytes;
} __attribute__((packed)) bt_uid_traffic_t;

/** Bluetooth Adapter Discovery state */
typedef enum {
  BT_DISCOVERY_STOPPED,
  BT_DISCOVERY_STARTED
} bt_discovery_state_t;

/** Bluetooth ACL connection state */
typedef enum {
  BT_ACL_STATE_CONNECTED,
  BT_ACL_STATE_DISCONNECTED
} bt_acl_state_t;

/** Bluetooth SDP service record */
typedef struct {
  bluetooth::Uuid uuid;
  uint16_t channel;
  char name[256];  // what's the maximum length
} bt_service_record_t;

/** Bluetooth Remote Version info */
typedef struct {
  int version;
  int sub_ver;
  int manufacturer;
} bt_remote_version_t;

typedef struct {
  uint16_t version_supported;
  uint8_t local_privacy_enabled;
  uint8_t max_adv_instance;
  ui

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值