OVMS3-idf/components/bt/esp_ble_mesh/mesh_core/include/mesh_hci.h
lly b19671e0d4 ble_mesh: Add ESP BLE Mesh implementation
1. BLE Mesh Core

    * Provisioning: Node Role
        * PB-ADV and PB-GATT
        * Authentication OOB

    * Provisioning: Provisioner Role
        * PB-ADV and PB-GATT
        * Authentication OOB

    * Networking
        * Relay
        * Segmentation and Reassembly
        * Key Refresh
        * IV Update

    * Proxy Support

    * Multiple Client Models Run Simultaneously
        * Support multiple client models send packets to different nodes simultaneously
        * No blocking between client model and server

    * NVS Storage
        * Store BLE Mesh node related information in flash
        * Store BLE Mesh Provisioner related information in flash

2. BLE Mesh Models

    * Foundation Models
        * Configuration Server Model
        * Configuration Client Model
        * Health Server Model
        * Health Client Model

    * Generic
        * Generic OnOff Server
        * Generic OnOff Client
        * Generic Level Server
        * Generic Level Client
        * Generic Default Transition Time Server
        * Generic Default Transition Time Client
        * Generic Power OnOff Server
        * Generic Power OnOff Setup Server
        * Generic Power OnOff Client
        * Generic Power Level Server
        * Generic Power Level Setup Server
        * Generic Power Level Client
        * Generic Battery Server
        * Generic Battery Client
        * Generic Location Server
        * Generic Location Setup Server
        * Generic Location Client
        * Generic Admin Property Server
        * Generic Manufacturer Property Server
        * Generic User Property Server
        * Generic Client Property Server
        * Generic Property Client

    * Sensor Server Model
        * Sensor Server
        * Sensor Setup Server
        * Sensor Client

    * Time and Scenes
        * Time Server
        * Time Setup Server
        * Time Client
        * Scene Server
        * Scene Setup Server
        * Scene Client
        * Scheduler Server
        * Scheduler Setup Server
        * Scheduler Client

    * Lighting
        * Light Lightness Server
        * Light Lightness Setup Server
        * Light Lightness Client
        * Light CTL Server
        * Light CTL Setup Server
        * Light CTL Client
        * Light CTL Temperature Server
        * Light HSL Server
        * Light HSL Setup Server
        * Light HSL Client
        * Light HSL Hue Server
        * Light HSL Saturation Server
        * Light xyL Server
        * Light xyL Setup Server
        * Light xyL Client
        * Light LC Server
        * Light LC Setup Server
        * Light LC Client

3. BLE Mesh Applications

    * BLE Mesh Node
        * OnOff Client Example
        * OnOff Server Example

    * BLE Mesh Provisioner
        * Example

    * Fast Provisioning
        * Vendor Fast Prov Server Model
        * Vendor Fast Prov Client Model
        * Examples

    * Wi-Fi & BLE Mesh Coexistence
        * Example

    * BLE Mesh Console Commands
        * Examples
2020-02-03 12:03:36 +08:00

134 lines
3.4 KiB
C

/*
* Copyright (c) 2015-2016 Intel Corporation
* Additional Copyright (c) 2018 Espressif Systems (Shanghai) PTE LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _BLE_MESH_HCI_H_
#define _BLE_MESH_HCI_H_
#include "mesh_atomic.h"
#include "mesh_bearer_adapt.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Porting form zephyr/subsys/bluetooth/host/hci_core.h */
#define BLE_MESH_LMP_FEAT_PAGES_COUNT 1
/* bt_mesh_dev flags: the flags defined here represent BT controller state */
enum {
BLE_MESH_DEV_ENABLE,
BLE_MESH_DEV_READY,
BLE_MESH_DEV_ID_STATIC_RANDOM,
BLE_MESH_DEV_HAS_PUB_KEY,
BLE_MESH_DEV_PUB_KEY_BUSY,
BLE_MESH_DEV_ADVERTISING,
BLE_MESH_DEV_KEEP_ADVERTISING,
BLE_MESH_DEV_SCANNING,
BLE_MESH_DEV_EXPLICIT_SCAN,
BLE_MESH_DEV_ACTIVE_SCAN,
BLE_MESH_DEV_SCAN_FILTER_DUP,
BLE_MESH_DEV_RPA_VALID,
BLE_MESH_DEV_ID_PENDING,
/* Total number of flags - must be at the end of the enum */
BLE_MESH_DEV_NUM_FLAGS,
};
struct bt_mesh_dev_le {
/* LE features */
u8_t features[8];
/* LE states */
u64_t states;
};
/* State tracking for the local Bluetooth controller */
struct bt_mesh_dev {
/* Flags indicate which functionality is enabled */
BLE_MESH_ATOMIC_DEFINE(flags, BLE_MESH_DEV_NUM_FLAGS);
/* Controller version & manufacturer information */
u8_t hci_version;
u8_t lmp_version;
u16_t hci_revision;
u16_t lmp_subversion;
u16_t manufacturer;
/* LMP features (pages 0, 1, 2) */
u8_t features[BLE_MESH_LMP_FEAT_PAGES_COUNT][8];
/* LE controller specific features */
struct bt_mesh_dev_le le;
};
/*Porting from zephyr/subsys/bluetooth/host/hci_core.h */
/* HCI version from Assigned Numbers */
#define BLE_MESH_HCI_VERSION_1_0B 0
#define BLE_MESH_HCI_VERSION_1_1 1
#define BLE_MESH_HCI_VERSION_1_2 2
#define BLE_MESH_HCI_VERSION_2_0 3
#define BLE_MESH_HCI_VERSION_2_1 4
#define BLE_MESH_HCI_VERSION_3_0 5
#define BLE_MESH_HCI_VERSION_4_0 6
#define BLE_MESH_HCI_VERSION_4_1 7
#define BLE_MESH_HCI_VERSION_4_2 8
#define BLE_MESH_HCI_VERSION_5_0 9
/* OpCode Group Fields */
#define BLE_MESH_OGF_LINK_CTRL 0x01
#define BLE_MESH_OGF_BASEBAND 0x03
#define BLE_MESH_OGF_INFO 0x04
#define BLE_MESH_OGF_STATUS 0x05
#define BLE_MESH_OGF_LE 0x08
#define BLE_MESH_OGF_VS 0x3f
/* Construct OpCode from OGF and OCF */
#define BLE_MESH_OP(ogf, ocf) ((ocf) | ((ogf) << 10))
/* Obtain OGF from OpCode */
#define BLE_MESH_OGF(opcode) (((opcode) >> 10) & BIT_MASK(6))
/* Obtain OCF from OpCode */
#define BLE_MESH_OCF(opcode) ((opcode) & BIT_MASK(10))
#define BLE_MESH_HCI_OP_SET_ADV_PARAM BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0006)
struct bt_mesh_hci_cp_set_adv_param {
u16_t min_interval;
u16_t max_interval;
u8_t type;
u8_t own_addr_type;
bt_mesh_addr_t direct_addr;
u8_t channel_map;
u8_t filter_policy;
} __packed;
#define BLE_MESH_HCI_OP_SET_ADV_DATA BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0008)
struct bt_mesh_hci_cp_set_adv_data {
u8_t len;
u8_t data[31];
} __packed;
#define BLE_MESH_HCI_OP_SET_SCAN_RSP_DATA BLE_MESH_OP(BLE_MESH_OGF_LE, 0x0009)
struct bt_mesh_hci_cp_set_scan_rsp_data {
u8_t len;
u8_t data[31];
} __packed;
/* Added by Espressif */
extern struct bt_mesh_dev bt_mesh_dev;
void bt_mesh_hci_init(void);
#ifdef __cplusplus
}
#endif
#endif /* _BLE_MESH_HCI_H_ */