mesh: extract pb_gatt

This commit is contained in:
Milanka Ringwald 2018-11-20 11:22:40 +01:00 committed by Matthias Ringwald
parent 19d484afeb
commit 127b9caf59
10 changed files with 338 additions and 238 deletions

View File

@ -95,10 +95,6 @@ static mesh_provisioning_t * mesh_provisioning_service_get_instance_for_con_hand
return instance;
}
static hci_con_handle_t get_con_handle(void){
return mesh_provisioning.con_handle;
}
static uint16_t mesh_provisioning_service_read_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){
UNUSED(con_handle);
UNUSED(attribute_handle);
@ -129,7 +125,7 @@ static int mesh_provisioning_service_write_callback(hci_con_handle_t con_handle,
if (attribute_handle == instance->data_in_client_value_handle){
printf("mesh_provisioning_service_write_callback: handle write on 0x%02x, len %u\n", attribute_handle, buffer_size);
if (!mesh_provisioning_service_packet_handler) return 0;
(*mesh_provisioning_service_packet_handler)(PROVISIONING_DATA_PACKET, 0, buffer, buffer_size);
(*mesh_provisioning_service_packet_handler)(PROVISIONING_DATA_PACKET, con_handle, buffer, buffer_size);
return 0;
}
@ -223,196 +219,3 @@ void mesh_provisioning_service_server_request_can_send_now(hci_con_handle_t con_
void mesh_provisioning_service_server_register_packet_handler(btstack_packet_handler_t callback){
mesh_provisioning_service_packet_handler = callback;
}
/************** PB GATT Mesh Provisioning ********************/
static const uint8_t * pb_gatt_own_device_uuid;
static const uint8_t * proxy_pdu;
static uint16_t proxy_pdu_size;
static uint16_t con_handle;
static uint8_t reassembly_buffer[MESH_PROV_MAX_PROXY_PDU];
static uint16_t reassembly_offset;
/**
* Send Provisioning PDU
*/
static uint8_t segmentation_buffer[MESH_PROV_MAX_PROXY_PDU];
static uint16_t segmentation_offset;
static mesh_msg_sar_field_t segmentation_state;
static uint16_t pb_gatt_mtu;
static btstack_packet_handler_t pb_gatt_packet_handler;
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
static void pb_gatt_emit_pdu_sent(uint8_t status){
uint8_t event[] = {HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status};
pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(channel);
UNUSED(size);
mesh_msg_sar_field_t msg_sar_field;
mesh_msg_type_t msg_type;
int pdu_segment_len;
int pos;
switch (packet_type) {
case PROVISIONING_DATA_PACKET:
pos = 0;
// on provisioning PDU call packet handler with PROVISIONG_DATA type
msg_sar_field = packet[pos] >> 6;
msg_type = packet[pos] & 0x3F;
pos++;
if (msg_type != MESH_MSG_TYPE_PROVISIONING_PDU) return;
if (!pb_gatt_packet_handler) return;
pdu_segment_len = size - pos;
if (sizeof(reassembly_buffer) - reassembly_offset < pdu_segment_len) {
printf("sar buffer too small left %d, new to store %d\n", MESH_PROV_MAX_PROXY_PDU - reassembly_offset, pdu_segment_len);
break;
}
// update mtu if incoming packet is larger than default
if (size > (ATT_DEFAULT_MTU - 1)){
log_info("Remote uses larger MTU, enable long PDUs");
pb_gatt_mtu = att_server_get_mtu(con_handle);
}
switch (msg_sar_field){
case MESH_MSG_SAR_FIELD_FIRST_SEGMENT:
memset(reassembly_buffer, 0, sizeof(reassembly_buffer));
memcpy(reassembly_buffer, packet+pos, pdu_segment_len);
reassembly_offset = pdu_segment_len;
return;
case MESH_MSG_SAR_FIELD_CONTINUE:
memcpy(reassembly_buffer + reassembly_offset, packet+pos, pdu_segment_len);
reassembly_offset += pdu_segment_len;
return;
case MESH_MSG_SAR_FIELD_LAST_SEGMENT:
memcpy(reassembly_buffer + reassembly_offset, packet+pos, pdu_segment_len);
reassembly_offset += pdu_segment_len;
// send to provisioning device
pb_gatt_packet_handler(PROVISIONING_DATA_PACKET, 0, reassembly_buffer, reassembly_offset);
reassembly_offset = 0;
break;
case MESH_MSG_SAR_FIELD_COMPLETE_MSG:
// send to provisioning device
pb_gatt_packet_handler(PROVISIONING_DATA_PACKET, 0, packet+pos, pdu_segment_len);
break;
}
break;
case HCI_EVENT_PACKET:
switch (hci_event_packet_get_type(packet)) {
case HCI_EVENT_MESH_META:
switch (hci_event_mesh_meta_get_subevent_code(packet)){
case MESH_PB_TRANSPORT_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_CLOSED:
// Forward link open/close
pb_gatt_mtu = ATT_DEFAULT_MTU;
pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, packet, size);
break;
case MESH_SUBEVENT_CAN_SEND_NOW:
con_handle = little_endian_read_16(packet, 3);
if (con_handle == HCI_CON_HANDLE_INVALID) return;
segmentation_buffer[0] = (segmentation_state << 6) | MESH_MSG_TYPE_PROVISIONING_PDU;
pdu_segment_len = btstack_min(proxy_pdu_size - segmentation_offset, pb_gatt_mtu - 1);
memcpy(&segmentation_buffer[1], &proxy_pdu[segmentation_offset], pdu_segment_len);
segmentation_offset += pdu_segment_len;
mesh_provisioning_service_server_send_proxy_pdu(con_handle, segmentation_buffer, pdu_segment_len + 1);
switch (segmentation_state){
case MESH_MSG_SAR_FIELD_COMPLETE_MSG:
case MESH_MSG_SAR_FIELD_LAST_SEGMENT:
pb_gatt_emit_pdu_sent(0);
break;
case MESH_MSG_SAR_FIELD_CONTINUE:
case MESH_MSG_SAR_FIELD_FIRST_SEGMENT:
if ((proxy_pdu_size - segmentation_offset) > (pb_gatt_mtu - 1)){
segmentation_state = MESH_MSG_SAR_FIELD_CONTINUE;
} else {
segmentation_state = MESH_MSG_SAR_FIELD_LAST_SEGMENT;
}
mesh_provisioning_service_server_request_can_send_now(con_handle);
break;
}
// printf("sending packet, size %d, MTU %d: ", proxy_pdu_size, pb_gatt_mtu);
// printf_hexdump(proxy_pdu, proxy_pdu_size);
// printf("\n");
// mesh_provisioning_service_server_request_can_send_now(con_handle);
break;
default:
break;
}
printf("\n");
}
break;
default:
break;
}
}
/**
* Setup mesh provisioning service
* @param device_uuid
*/
void pb_gatt_init(const uint8_t * device_uuid){
pb_gatt_own_device_uuid = device_uuid;
// setup mesh provisioning service
mesh_provisioning_service_server_init();
mesh_provisioning_service_server_register_packet_handler(packet_handler);
}
/**
* Register listener for Provisioning PDUs
*/
void pb_gatt_register_packet_handler(btstack_packet_handler_t _packet_handler){
pb_gatt_packet_handler = _packet_handler;
}
/**
* Close Link
* @param con_handle
* @param pdu
* @param pdu_size
*/
void pb_gatt_send_pdu(uint16_t con_handle, const uint8_t * pdu, uint16_t size){
if (!pdu || size <= 0) return;
// store pdu, request to send
printf_hexdump(pdu, size);
proxy_pdu = pdu;
proxy_pdu_size = size;
segmentation_offset = 0;
printf("pb_gatt_send_pdu received 0x%02x, used 0x%02x\n", con_handle, get_con_handle());
// check if segmentation is necessary
if (proxy_pdu_size > (pb_gatt_mtu - 1)){
segmentation_state = MESH_MSG_SAR_FIELD_FIRST_SEGMENT;
} else {
segmentation_state = MESH_MSG_SAR_FIELD_COMPLETE_MSG;
}
mesh_provisioning_service_server_request_can_send_now(get_con_handle());
}
/**
* Close Link
* @param con_handle
* @param reason 0 = success, 1 = timeout, 2 = fail
*/
void pb_gatt_close_link(hci_con_handle_t con_handle, uint8_t reason){
}
/**
* Setup Link with unprovisioned device
* @param device_uuid
* @returns con_handle or HCI_CON_HANDLE_INVALID
*/
uint16_t pb_gatt_create_link(const uint8_t * device_uuid){
return HCI_CON_HANDLE_INVALID;
}

View File

@ -93,43 +93,7 @@ void mesh_provisioning_service_server_register_packet_handler(btstack_packet_han
* Generates an MESH_SUBEVENT_CAN_SEND_NOW subevent
* @param con_handle
*/
void mesh_provisioning_service_server_request_can_send_now_event(hci_con_handle_t con_handle);
// PB-GATT API
/**
* Setup mesh provisioning service
* @param device_uuid
*/
void pb_gatt_init(const uint8_t * device_uuid);
/**
* Register listener for Provisioning PDUs and events: MESH_PB_TRANSPORT_LINK_OPEN, MESH_PB_TRANSPORT_LINK_CLOSED, MESH_SUBEVENT_CAN_SEND_NOW
* @param packet_handler
*/
void pb_gatt_register_packet_handler(btstack_packet_handler_t packet_handler);
/**
* Close Link
* @param con_handle
* @param pdu
* @param pdu_size
*/
void pb_gatt_send_pdu(uint16_t con_handle, const uint8_t * pdu, uint16_t pdu_size);
/**
* Setup Link with unprovisioned device
* @param device_uuid
* @returns con_handle or HCI_CON_HANDLE_INVALID
*/
hci_con_handle_t pb_gatt_create_link(const uint8_t * device_uuid);
/**
* Close Link
* @param con_handle
* @param reason 0 = success, 1 = timeout, 2 = fail
*/
void pb_gatt_close_link(hci_con_handle_t con_handle, uint8_t reason);
void mesh_provisioning_service_server_request_can_send_now(hci_con_handle_t con_handle);
/* API_END */
#if defined __cplusplus

235
src/ble/mesh/pb_gatt.c Normal file
View File

@ -0,0 +1,235 @@
/*
* Copyright (C) 2014 BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. Any redistribution, use, or modification is done solely for
* personal benefit and not for any commercial purpose or for
* monetary gain.
*
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Please inquire about commercial licensing options at
* contact@bluekitchen-gmbh.com
*
*/
#define __BTSTACK_FILE__ "pb_gatt.c"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "btstack_util.h"
#include "btstack_debug.h"
#include "btstack_event.h"
#include "ble/mesh/pb_gatt.h"
#include "ble/gatt-service/mesh_provisioning_service_server.h"
#include "provisioning.h"
#include "ble/att_server.h"
/************** PB GATT Mesh Provisioning ********************/
// share buffer for reassembly and segmentation - protocol is half-duplex
static union {
uint8_t reassembly_buffer[MESH_PROV_MAX_PROXY_PDU];
uint8_t segmentation_buffer[MESH_PROV_MAX_PROXY_PDU];
} sar_buffer;
static const uint8_t * pb_gatt_own_device_uuid;
static const uint8_t * proxy_pdu;
static uint16_t proxy_pdu_size;
static uint16_t reassembly_offset;
static uint16_t segmentation_offset;
static mesh_msg_sar_field_t segmentation_state;
static uint16_t pb_gatt_mtu;
static btstack_packet_handler_t pb_gatt_packet_handler;
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
static void pb_gatt_emit_pdu_sent(uint8_t status){
uint8_t event[] = {HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status};
pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
UNUSED(channel);
UNUSED(size);
mesh_msg_sar_field_t msg_sar_field;
mesh_msg_type_t msg_type;
int pdu_segment_len;
int pos;
hci_con_handle_t con_handle;
switch (packet_type) {
case PROVISIONING_DATA_PACKET:
pos = 0;
// on provisioning PDU call packet handler with PROVISIONG_DATA type
msg_sar_field = packet[pos] >> 6;
msg_type = packet[pos] & 0x3F;
pos++;
if (msg_type != MESH_MSG_TYPE_PROVISIONING_PDU) return;
if (!pb_gatt_packet_handler) return;
pdu_segment_len = size - pos;
if (sizeof(sar_buffer.reassembly_buffer) - reassembly_offset < pdu_segment_len) {
log_error("sar buffer too small left %d, new to store %d", MESH_PROV_MAX_PROXY_PDU - reassembly_offset, pdu_segment_len);
break;
}
// update mtu if incoming packet is larger than default
if (size > (ATT_DEFAULT_MTU - 1)){
log_info("Remote uses larger MTU, enable long PDUs");
pb_gatt_mtu = att_server_get_mtu(channel);
}
switch (msg_sar_field){
case MESH_MSG_SAR_FIELD_FIRST_SEGMENT:
memset(sar_buffer.reassembly_buffer, 0, sizeof(sar_buffer.reassembly_buffer));
memcpy(sar_buffer.reassembly_buffer, packet+pos, pdu_segment_len);
reassembly_offset = pdu_segment_len;
return;
case MESH_MSG_SAR_FIELD_CONTINUE:
memcpy(sar_buffer.reassembly_buffer + reassembly_offset, packet+pos, pdu_segment_len);
reassembly_offset += pdu_segment_len;
return;
case MESH_MSG_SAR_FIELD_LAST_SEGMENT:
memcpy(sar_buffer.reassembly_buffer + reassembly_offset, packet+pos, pdu_segment_len);
reassembly_offset += pdu_segment_len;
// send to provisioning device
pb_gatt_packet_handler(PROVISIONING_DATA_PACKET, 0, sar_buffer.reassembly_buffer, reassembly_offset);
reassembly_offset = 0;
break;
case MESH_MSG_SAR_FIELD_COMPLETE_MSG:
// send to provisioning device
pb_gatt_packet_handler(PROVISIONING_DATA_PACKET, 0, packet+pos, pdu_segment_len);
break;
}
break;
case HCI_EVENT_PACKET:
switch (hci_event_packet_get_type(packet)) {
case HCI_EVENT_MESH_META:
switch (hci_event_mesh_meta_get_subevent_code(packet)){
case MESH_PB_TRANSPORT_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_CLOSED:
// Forward link open/close
pb_gatt_mtu = ATT_DEFAULT_MTU;
pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, packet, size);
break;
case MESH_SUBEVENT_CAN_SEND_NOW:
con_handle = little_endian_read_16(packet, 3);
if (con_handle == HCI_CON_HANDLE_INVALID) return;
sar_buffer.segmentation_buffer[0] = (segmentation_state << 6) | MESH_MSG_TYPE_PROVISIONING_PDU;
pdu_segment_len = btstack_min(proxy_pdu_size - segmentation_offset, pb_gatt_mtu - 1);
memcpy(&sar_buffer.segmentation_buffer[1], &proxy_pdu[segmentation_offset], pdu_segment_len);
segmentation_offset += pdu_segment_len;
mesh_provisioning_service_server_send_proxy_pdu(con_handle, sar_buffer.segmentation_buffer, pdu_segment_len + 1);
switch (segmentation_state){
case MESH_MSG_SAR_FIELD_COMPLETE_MSG:
case MESH_MSG_SAR_FIELD_LAST_SEGMENT:
pb_gatt_emit_pdu_sent(0);
break;
case MESH_MSG_SAR_FIELD_CONTINUE:
case MESH_MSG_SAR_FIELD_FIRST_SEGMENT:
if ((proxy_pdu_size - segmentation_offset) > (pb_gatt_mtu - 1)){
segmentation_state = MESH_MSG_SAR_FIELD_CONTINUE;
} else {
segmentation_state = MESH_MSG_SAR_FIELD_LAST_SEGMENT;
}
mesh_provisioning_service_server_request_can_send_now(con_handle);
break;
}
break;
default:
break;
}
}
break;
default:
break;
}
}
/**
* Setup mesh provisioning service
* @param device_uuid
*/
void pb_gatt_init(const uint8_t * device_uuid){
pb_gatt_own_device_uuid = device_uuid;
// setup mesh provisioning service
mesh_provisioning_service_server_init();
mesh_provisioning_service_server_register_packet_handler(packet_handler);
}
/**
* Register listener for Provisioning PDUs
*/
void pb_gatt_register_packet_handler(btstack_packet_handler_t _packet_handler){
pb_gatt_packet_handler = _packet_handler;
}
/**
* Close Link
* @param con_handle
* @param pdu
* @param pdu_size
*/
void pb_gatt_send_pdu(uint16_t con_handle, const uint8_t * pdu, uint16_t size){
if (!pdu || size <= 0) return;
if (con_handle == HCI_CON_HANDLE_INVALID) return;
// store pdu, request to send
proxy_pdu = pdu;
proxy_pdu_size = size;
segmentation_offset = 0;
// check if segmentation is necessary
if (proxy_pdu_size > (pb_gatt_mtu - 1)){
segmentation_state = MESH_MSG_SAR_FIELD_FIRST_SEGMENT;
} else {
segmentation_state = MESH_MSG_SAR_FIELD_COMPLETE_MSG;
}
mesh_provisioning_service_server_request_can_send_now(con_handle);
}
/**
* Close Link
* @param con_handle
* @param reason 0 = success, 1 = timeout, 2 = fail
*/
void pb_gatt_close_link(hci_con_handle_t con_handle, uint8_t reason){
}
/**
* Setup Link with unprovisioned device
* @param device_uuid
* @returns con_handle or HCI_CON_HANDLE_INVALID
*/
uint16_t pb_gatt_create_link(const uint8_t * device_uuid){
return HCI_CON_HANDLE_INVALID;
}

90
src/ble/mesh/pb_gatt.h Normal file
View File

@ -0,0 +1,90 @@
/*
* Copyright (C) 2017 BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. Any redistribution, use, or modification is done solely for
* personal benefit and not for any commercial purpose or for
* monetary gain.
*
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Please inquire about commercial licensing options at
* contact@bluekitchen-gmbh.com
*
*/
#ifndef __PB_GATT_H
#define __PB_GATT_H
#include <stdint.h>
#include "btstack_defines.h"
#include "btstack_config.h"
#include "hci.h"
#if defined __cplusplus
extern "C" {
#endif
/**
* Setup mesh provisioning service
* @param device_uuid
*/
void pb_gatt_init(const uint8_t * device_uuid);
/**
* Register listener for Provisioning PDUs and events: MESH_PB_TRANSPORT_LINK_OPEN, MESH_PB_TRANSPORT_LINK_CLOSED, MESH_SUBEVENT_CAN_SEND_NOW
* @param packet_handler
*/
void pb_gatt_register_packet_handler(btstack_packet_handler_t packet_handler);
/**
* Send PDU
* @param con_handle
* @param pdu
* @param pdu_size
*/
void pb_gatt_send_pdu(uint16_t con_handle, const uint8_t * pdu, uint16_t pdu_size);
/**
* Setup Link with unprovisioned device
* @param device_uuid
* @return con_handle or HCI_CON_HANDLE_INVALID
*/
hci_con_handle_t pb_gatt_create_link(const uint8_t * device_uuid);
/**
* Close Link
* @param con_handle
* @param reason 0 = success, 1 = timeout, 2 = fail
*/
void pb_gatt_close_link(hci_con_handle_t con_handle, uint8_t reason);
#if defined __cplusplus
}
#endif
#endif // __PB_GATT_H

View File

@ -42,7 +42,7 @@ CC_UNIT = g++
CFLAGS += $(shell pkg-config libusb-1.0 --cflags)
LDFLAGS += $(shell pkg-config libusb-1.0 --libs)
mesh: ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_SERVER_OBJ} ${SM_OBJ} pb_adv.o mesh_provisioning_service_server.o mesh_crypto.o provisioning_device.o mesh_network.o mesh.o
mesh: ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_SERVER_OBJ} ${SM_OBJ} pb_adv.o pb_gatt.o mesh_provisioning_service_server.o mesh_crypto.o provisioning_device.o mesh_network.o mesh.o
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
provisioner: ${CORE_OBJ} ${COMMON_OBJ} ${SM_OBJ} pb_adv.o mesh_crypto.o provisioning_provisioner.o provisioner.o
@ -60,7 +60,7 @@ provisioning_provisioner_test: provisioning_provisioner_test.cpp uECC.o mesh_cry
mesh_provisioning_device.h: mesh_provisioning_device.gatt
python ${BTSTACK_ROOT}/tool/compile_gatt.py $< $@
mesh_provisioning_device: mesh_provisioning_device.h ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_SERVER_OBJ} ${SM_OBJ} pb_adv.o mesh_crypto.o provisioning_device.o mesh_provisioning_service_server.o mesh_provisioning_device.o
mesh_provisioning_device: mesh_provisioning_device.h ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_SERVER_OBJ} ${SM_OBJ} pb_adv.o pb_gatt.o mesh_crypto.o provisioning_device.o mesh_provisioning_service_server.o mesh_provisioning_device.o
${CC} $(filter-out mesh_provisioning_device.h,$^) ${CFLAGS} ${LDFLAGS} -o $@
EXAMPLES = mesh provisioner sniffer provisioning_device_test provisioning_provisioner_test mesh_provisioning_device

View File

@ -43,6 +43,8 @@
#include <string.h>
#include "ble/mesh/adv_bearer.h"
#include "ble/mesh/pb_adv.h"
#include "ble/mesh/pb_gatt.h"
#include "ble/gatt-service/mesh_provisioning_service_server.h"
#include "ble/mesh/beacon.h"
#include "provisioning.h"
#include "provisioning_device.h"

View File

@ -43,6 +43,7 @@
#include <string.h>
#include "ble/mesh/pb_adv.h"
#include "ble/mesh/pb_gatt.h"
#include "ble/gatt-service/mesh_provisioning_service_server.h"
#include "mesh_provisioning_device.h"
#include "btstack_config.h"

View File

@ -43,7 +43,7 @@
#include <string.h>
#include "ble/mesh/pb_adv.h"
#include "ble/gatt-service/mesh_provisioning_service_server.h"
#include "ble/mesh/pb_gatt.h"
#include "ble/mesh/mesh_crypto.h"
#include "classic/rfcomm.h" // for crc8

View File

@ -40,7 +40,9 @@
#include <stdlib.h>
#include <string.h>
#include "ble/mesh/pb_adv.h"
#include "ble/mesh/pb_gatt.h"
#include "ble/gatt-service/mesh_provisioning_service_server.h"
#include "provisioning.h"
#include "provisioning_device.h"
#include "btstack.h"

View File

@ -40,6 +40,9 @@
#include <stdlib.h>
#include <string.h>
#include "ble/mesh/pb_adv.h"
#include "ble/mesh/pb_gatt.h"
#include "ble/gatt-service/mesh_provisioning_service_server.h"
#include "provisioning.h"
#include "provisioning_provisioner.h"
#include "btstack.h"