mirror of
https://github.com/tpunix/HMCLOCK.git
synced 2025-12-06 08:12:48 +08:00
113 lines
5.0 KiB
C
113 lines
5.0 KiB
C
/**
|
||
****************************************************************************************
|
||
*
|
||
* @file user_custs1_def.c
|
||
*
|
||
* @brief Custom Server 1 (CUSTS1) profile database definitions.
|
||
*
|
||
* Copyright (C) 2016-2023 Renesas Electronics Corporation and/or its affiliates.
|
||
* All rights reserved. Confidential Information.
|
||
*
|
||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||
* or together with Renesas products. You may make copies of this Software, provided this
|
||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||
* reserves the right to change or discontinue the Software at any time without notice.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||
* SOFTWARE.
|
||
*
|
||
****************************************************************************************
|
||
*/
|
||
|
||
/**
|
||
****************************************************************************************
|
||
* @defgroup USER_CONFIG
|
||
* @ingroup USER
|
||
* @brief Custom server 1 (CUSTS1) profile database definitions.
|
||
*
|
||
* @{
|
||
****************************************************************************************
|
||
*/
|
||
|
||
/*
|
||
* INCLUDE FILES
|
||
****************************************************************************************
|
||
*/
|
||
|
||
#include <stdint.h>
|
||
#include "co_utils.h"
|
||
#include "prf_types.h"
|
||
#include "attm_db_128.h"
|
||
#include "user_custs1_def.h"
|
||
|
||
/*
|
||
* LOCAL VARIABLE DEFINITIONS
|
||
****************************************************************************************
|
||
*/
|
||
|
||
// Service 1 of the custom server 1
|
||
static const uint16_t custs1_svc1 = 0xff00;
|
||
static const uint16_t svc1_ctrl_point = 0xff03;
|
||
static const uint16_t svc1_adc_val1 = 0xff02;
|
||
static const uint16_t svc1_long_value = 0xff01;
|
||
|
||
// Attribute specifications
|
||
static const uint16_t att_decl_svc = ATT_DECL_PRIMARY_SERVICE;
|
||
static const uint16_t att_decl_char = ATT_DECL_CHARACTERISTIC;
|
||
static const uint16_t att_desc_cfg = ATT_DESC_CLIENT_CHAR_CFG;
|
||
|
||
/*
|
||
* GLOBAL VARIABLE DEFINITIONS
|
||
****************************************************************************************
|
||
*/
|
||
|
||
const uint8_t custs1_services[] = {SVC1_IDX_SVC, CUSTS1_IDX_NB};
|
||
const uint8_t custs1_services_size = ARRAY_LEN(custs1_services) - 1;
|
||
const uint16_t custs1_att_max_nb = CUSTS1_IDX_NB;
|
||
|
||
|
||
/// Full CUSTS1 Database Description - Used to add attributes into the database
|
||
const struct attm_desc_128 custs1_att_db[CUSTS1_IDX_NB] =
|
||
{
|
||
/*************************
|
||
* Service 1 configuration
|
||
*************************
|
||
*/
|
||
|
||
// Service 1 Declaration
|
||
[SVC1_IDX_SVC] = {(uint8_t*)&att_decl_svc, ATT_UUID_16_LEN, PERM(RD, ENABLE),
|
||
sizeof(custs1_svc1), sizeof(custs1_svc1), (uint8_t*)&custs1_svc1},
|
||
|
||
// Control Point Characteristic Declaration
|
||
[SVC1_IDX_CONTROL_POINT_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL},
|
||
// Control Point Characteristic Value
|
||
[SVC1_IDX_CONTROL_POINT_VAL] = {(uint8_t*)&svc1_ctrl_point, ATT_UUID_16_LEN, PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
|
||
DEF_SVC1_CTRL_POINT_CHAR_LEN, 0, 0},
|
||
|
||
// ADC Value 1 Characteristic Declaration
|
||
[SVC1_IDX_ADC_VAL_1_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL},
|
||
// ADC Value 1 Characteristic Value
|
||
[SVC1_IDX_ADC_VAL_1_VAL] = {(uint8_t*)&svc1_adc_val1, ATT_UUID_16_LEN, PERM(RD, ENABLE),
|
||
DEF_SVC1_ADC_VAL_1_CHAR_LEN, 0, 0},
|
||
|
||
// Long Value Characteristic Declaration
|
||
[SVC1_IDX_LONG_VALUE_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL},
|
||
// Long Value Characteristic Value
|
||
[SVC1_IDX_LONG_VALUE_VAL] = {(uint8_t*)&svc1_long_value, ATT_UUID_16_LEN, PERM(RD, ENABLE) | PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
|
||
DEF_SVC1_LONG_VALUE_CHAR_LEN, 0, 0},
|
||
};
|
||
|
||
/// @} USER_CONFIG
|