initial commit
This commit is contained in:
+234
@@ -0,0 +1,234 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file appl_gap_config_params.c
|
||||
//!
|
||||
//! @brief This file contains GAP Configuration Parameters used by the application.
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// 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 holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT HOLDER 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.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
/**
|
||||
* \file appl_gap_config_params.c
|
||||
*
|
||||
* This file contains GAP Configuration Parameters used by the application.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013. Mindtree Ltd.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/* --------------------------------------------- Header File Inclusion */
|
||||
#include "appl_gap.h"
|
||||
|
||||
/* --------------------------------------------- External Global Variables */
|
||||
|
||||
/* --------------------------------------------- Exported Global Variables */
|
||||
|
||||
/* --------------------------------------------- Static Global Variables */
|
||||
|
||||
#if ((defined APPL_GAP_BROADCASTER_SUPPORT) || (defined APPL_GAP_PERIPHERAL_SUPPORT))
|
||||
/** Advertisement Data Options */
|
||||
const APPL_GAP_ADV_DATA appl_gap_adv_data[APPL_GAP_MAX_ADV_DATA_OPTIONS] =
|
||||
{
|
||||
/* GAP Advertisement Parameters */
|
||||
{
|
||||
{
|
||||
/**
|
||||
* Flags:
|
||||
* 0x01: LE Limited Discoverable Mode
|
||||
* 0x02: LE General Discoverable Mode
|
||||
* 0x04: BR/EDR Not Supported
|
||||
* 0x08: Simultaneous LE and BR/EDR to Same Device
|
||||
* Capable (Controller)
|
||||
* 0x10: Simultaneous LE and BR/EDR to Same Device
|
||||
* Capable (Host)
|
||||
*/
|
||||
0x02, 0x01,
|
||||
(BT_AD_FLAGS_LE_GENERAL_DISC_MODE | BT_AD_FLAGS_LE_BR_EDR_SUPPORT),
|
||||
|
||||
/*! Manufacturer specific data AD type */
|
||||
0x1A, /*! length */
|
||||
HCI_AD_TYPE_MANUFACTURER_SPECIFIC_DATA, /*! AD type */
|
||||
|
||||
0x4C, /*! Company ID[0] */
|
||||
0x00, /*! Company ID[1] */
|
||||
|
||||
0x02, /*! Device type, this has to be 0x02*/
|
||||
0x15, /*! Length of vendor advertising data. */
|
||||
|
||||
/*! Proximity UUID 16 bytes */
|
||||
0xe2, 0xc5, 0x6d, 0xb5,
|
||||
0xdf, 0xfb, 0x48, 0xd2,
|
||||
0xb0, 0x60, 0xd0, 0xf5,
|
||||
0xa7, 0x10, 0x96, 0xe0,
|
||||
|
||||
/*! Major 0xnnnn */
|
||||
0x00, 0x00,
|
||||
/*! Minor 0xnnnn */
|
||||
0x00, 0x00,
|
||||
|
||||
/*! Measured Power */
|
||||
0xc5
|
||||
},
|
||||
30
|
||||
}
|
||||
};
|
||||
|
||||
/* Advertisement parameters options */
|
||||
const APPL_GAP_ADV_PARAM appl_gap_adv_param[APPL_GAP_MAX_ADV_PARAM_OPTIONS] =
|
||||
{
|
||||
/* 0 - Normal Advertising Params */
|
||||
{
|
||||
32,
|
||||
|
||||
32,
|
||||
|
||||
7,
|
||||
|
||||
0
|
||||
},
|
||||
/* 1 - Fast Connection Advertising Params */
|
||||
{
|
||||
32,
|
||||
|
||||
48,
|
||||
|
||||
7,
|
||||
|
||||
0
|
||||
},
|
||||
/* 2 - Low Power Advertising Params */
|
||||
{
|
||||
1600,
|
||||
|
||||
4000,
|
||||
|
||||
7,
|
||||
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
/* Advertisement Table */
|
||||
APPL_GAP_ADV_INFO appl_gap_adv_table =
|
||||
{
|
||||
appl_gap_adv_data,
|
||||
|
||||
appl_gap_adv_param,
|
||||
|
||||
APPL_GAP_ADV_IDLE
|
||||
};
|
||||
#endif /* APPL_GAP_BROADCASTER || APPL_GAP_PERIPHERAL_SUPPORT */
|
||||
|
||||
#if ((defined APPL_GAP_OBSERVER_SUPPORT) || (defined APPL_GAP_CENTRAL_SUPPORT))
|
||||
/* Scan Parameters Option */
|
||||
const APPL_GAP_SCAN_PARAM appl_gap_scan_param[APPL_GAP_MAX_SCAN_PARAM_OPTIONS] =
|
||||
{
|
||||
/* Normal Scan Params */
|
||||
{
|
||||
32,
|
||||
|
||||
7,
|
||||
|
||||
0
|
||||
},
|
||||
/* Fast Connection Scan Params */
|
||||
{
|
||||
48,
|
||||
|
||||
7,
|
||||
|
||||
0
|
||||
},
|
||||
/* Low Power Scan Params */
|
||||
{
|
||||
4000,
|
||||
|
||||
7,
|
||||
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
/* Scan Table */
|
||||
APPL_GAP_SCAN_INFO appl_gap_scan_table =
|
||||
{
|
||||
appl_gap_scan_param,
|
||||
|
||||
APPL_GAP_SCAN_IDLE
|
||||
};
|
||||
#endif /* APPL_GAP_OBSERVER_SUPPORT || APPL_GAP_CENTRAL_SUPPORT */
|
||||
|
||||
#ifdef APPL_GAP_CENTRAL_SUPPORT
|
||||
/* Connection Parameters Options */
|
||||
const APPL_GAP_CONN_PARAM appl_gap_conn_param[APPL_GAP_MAX_CONN_PARAM_OPTIONS] =
|
||||
{
|
||||
{
|
||||
4,
|
||||
|
||||
4,
|
||||
|
||||
0,
|
||||
|
||||
40,
|
||||
|
||||
56,
|
||||
|
||||
0,
|
||||
|
||||
955,
|
||||
|
||||
32,
|
||||
|
||||
32
|
||||
}
|
||||
};
|
||||
|
||||
/* GAP Connection Table */
|
||||
APPL_GAP_CONN_INFO appl_gap_conn_table =
|
||||
{
|
||||
appl_gap_conn_param,
|
||||
|
||||
APPL_GAP_CONN_IDLE
|
||||
};
|
||||
#endif /* APPL_GAP_CENTRAL_SUPPORT */
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
/**
|
||||
* \file appl_ibeacon.c
|
||||
*
|
||||
* This file contains ibeacon example
|
||||
*
|
||||
* Copyright (C) 2013. Mindtree Ltd.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/* --------------------------------------------- Header File Inclusion */
|
||||
#include "appl.h"
|
||||
|
||||
/* --------------------------------------------- Constants */
|
||||
|
||||
/* --------------------------------------------- Static Global Variables */
|
||||
|
||||
|
||||
/* --------------------------------------------- Functions */
|
||||
|
||||
void appl_ibeacon_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file appl_ibeacon.h
|
||||
//!
|
||||
//! @brief Application Header File for iBeacon example.
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// 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 holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT HOLDER 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.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
/**
|
||||
* \file appl_ibeacon.h
|
||||
*
|
||||
* Application Header File for iBeacon example.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013. Mindtree Ltd.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _H_APPL_HRS_
|
||||
#define _H_APPL_HRS_
|
||||
|
||||
/* ----------------------------------------- Header File Inclusion */
|
||||
#include "BT_api.h"
|
||||
#include "BT_gatt_db_api.h"
|
||||
#include "gatt_db.h"
|
||||
#include "appl.h"
|
||||
|
||||
/* ----------------------------------------- Data Types/ Structures */
|
||||
|
||||
/* --------------------------------------------- Functions */
|
||||
void appl_ibeacon_init(void);
|
||||
|
||||
/* Profile handling */
|
||||
#define APPL_PROFILE_INIT(...) appl_ibeacon_init()
|
||||
#define APPL_PROFILE_CONNECT(x)
|
||||
#define APPL_SEND_MEASUREMENT(x)
|
||||
#define APPL_PROFILE_DISCONNECT_HANDLER(x)
|
||||
#define GATT_DB_PROFILE_HANDLER
|
||||
#define APPL_PROFILE_HVN_NTF_COMPLETE_HANDLER(x, y, z)
|
||||
#define APPL_PROFILE_HVN_IND_COMPLETE_HANDLER(x, y, z)
|
||||
#define APPL_PROFILE_MTU_UPDT_COMPLETE_HANDLER(x, y)
|
||||
|
||||
#define APPL_USE_IDLE_TIMER
|
||||
#define APPL_IDLE_TIMEOUT 30
|
||||
#endif /* _H_APPL_HRS_ */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,167 @@
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! @file gatt_db.h
|
||||
//!
|
||||
//! @brief GATT Databse.
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Copyright (c) 2020, Ambiq Micro
|
||||
// All rights reserved.
|
||||
//
|
||||
// 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 holder nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// Third party software included in this distribution is subject to the
|
||||
// additional license terms as defined in the /docs/licenses directory.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT HOLDER 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.
|
||||
//
|
||||
// This is part of revision 2.4.2 of the AmbiqSuite Development Package.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
/**
|
||||
* \file gatt_db.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013. Mindtree Ltd.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _H_GATT_DB_
|
||||
#define _H_GATT_DB_
|
||||
|
||||
/**
|
||||
* addgroup gatt_db_module
|
||||
*/
|
||||
|
||||
/**
|
||||
* defgroup gatt_db_tuneable_param Tuneable Parameters
|
||||
* {
|
||||
* This section defines the Tuneable Constants of Data Base Module.
|
||||
*/
|
||||
|
||||
/** Number of Characteristics in the data base */
|
||||
#define GATT_CHARACTERISTIC_COUNT 16
|
||||
|
||||
/** Number of Services in the data base */
|
||||
#define GATT_SERVICE_COUNT 5
|
||||
|
||||
/** Number of Characteristics that are configurable by the client */
|
||||
#define GATT_DB_MAX_CONFIGUREABLE_CHAR 3
|
||||
|
||||
/** Maximum Length of any Characteristic Value/Descriptor */
|
||||
#define GATT_DB_MAX_VAL_LENGTH 32
|
||||
|
||||
#define GATT_VALUE_ARRAY_SIZE 3
|
||||
|
||||
#define GATT_CONST_VALUE_ARRAY_SIZE 203
|
||||
|
||||
#define GATT_DB_PEER_VALUE_ARRAY_SIZE 6
|
||||
|
||||
#define GATT_DB_MAX_ATTRIBUTES 42
|
||||
|
||||
#define GATT_UUID_ARRAY_SIZE 62
|
||||
|
||||
#define GATT_DB_MAX_TYPE_COUNT 25
|
||||
|
||||
#define GATT_DB_MAX_PEER_CONFIGURATION \
|
||||
(GATT_DB_PEER_VALUE_ARRAY_SIZE * BT_MAX_DEVICE_QUEUE_SIZE)
|
||||
|
||||
/** \} */
|
||||
|
||||
/** Service Instance Reference */
|
||||
|
||||
/** GAP Service */
|
||||
#define GATT_SER_GAP_INST 0
|
||||
|
||||
/** GATT Service */
|
||||
#define GATT_SER_GATT_INST 1
|
||||
|
||||
/** Battery Service */
|
||||
#define GATT_SER_BATTERY_INST 2
|
||||
|
||||
/** DeviceInformation Service */
|
||||
#define GATT_SER_DEV_INFO_INST 3
|
||||
|
||||
/** Heart Rate Service */
|
||||
#define GATT_SER_HEART_RATE_INST 4
|
||||
|
||||
/** Characteristic Instance Reference */
|
||||
|
||||
/** DeviceName */
|
||||
#define GATT_CHAR_DEV_NAME_INST 0
|
||||
|
||||
/** Appearance */
|
||||
#define GATT_CHAR_APPEARANCE_INST 1
|
||||
|
||||
/** Service Changed */
|
||||
#define GATT_CHAR_SER_CHNGD_INST 2
|
||||
|
||||
/** BatteryLevel */
|
||||
#define GATT_CHAR_BATTERY_LVL_INST 3
|
||||
|
||||
/** ManufacturerName */
|
||||
#define GATT_CHAR_MAN_NAME_INST 4
|
||||
|
||||
/** ModelNumber */
|
||||
#define GATT_CHAR_MODEL_NO_INST 5
|
||||
|
||||
/** SerialNumber */
|
||||
#define GATT_CHAR_SL_NO_INST 6
|
||||
|
||||
/** FirmwareRevision */
|
||||
#define GATT_CHAR_FW_REV_INST 7
|
||||
|
||||
/** HardwareRevision */
|
||||
#define GATT_CHAR_HW_REV_INST 8
|
||||
|
||||
/** SoftwareRevision */
|
||||
#define GATT_CHAR_SW_REV_INST 9
|
||||
|
||||
/** SystemId */
|
||||
#define GATT_CHAR_SYS_ID_INST 10
|
||||
|
||||
/** RegCertDataList */
|
||||
#define GATT_CHAR_REG_CERT_DATA_INST 11
|
||||
|
||||
/** PnPID */
|
||||
#define GATT_CHAR_PNP_ID_INST 12
|
||||
|
||||
/** HeartRateMeasurement */
|
||||
#define GATT_CHAR_HR_MSRMNT 13
|
||||
|
||||
/** BodySensorLocation */
|
||||
#define GATT_CHAR_BODY_SNSR_LOC_INST 14
|
||||
|
||||
/** HeartRateControlPoint */
|
||||
#define GATT_CHAR_HR_CNTRL_PNT_INST 15
|
||||
|
||||
#endif /* _H_GATT_DB_ */
|
||||
|
||||
Reference in New Issue
Block a user