[BAS_IDX_TEMP_LVL_VAL] = {ATT_CHAR_TEMPERATURE_MEAS, PERM(RD, ENABLE), sizeof(uint8_t), 0, NULL}, // Battery Level Characteristic - Client Characteristic Configuration Descriptor [BAS_IDX_TEMP_LVL_NTF_CFG] = {ATT_DESC_CLIENT_CHAR_CFG, PERM(RD, ENABLE)|PERM(WR, ENABLE), sizeof(uint16_t), 0, NULL}, // Battery Level Characteristic - Characteristic Presentation Format Descriptor [BAS_IDX_TEMP_LVL_PRES_FMT] = {ATT_DESC_CHAR_PRES_FORMAT, PERM(RD, ENABLE), sizeof(struct prf_char_pres_fmt), 0, NULL}, }; /// Battery Service const atts_svc_desc_t bas_svc = ATT_SVC_BATTERY_SERVICE; /// Battery Level characteristic const struct atts_char_desc bas_batt_level_char = ATTS_CHAR(ATT_CHAR_PROP_RD, 0, ATT_CHAR_BATTERY_LEVEL); /* * GLOBAL VARIABLE DEFINITIONS **************************************************************************************** */ struct bass_env_tag bass_env; /* * GLOBAL FUNCTIONS DEFINITIONS **************************************************************************************** */ void bass_init(void)
0, NULL}, // Client Characteristic Configuration Descriptor [QPPS_IDX_VAL_NTF_CFG] = {ATT_DESC_CLIENT_CHAR_CFG, PERM(RD, ENABLE)|PERM(WR, ENABLE), sizeof(uint16_t), 0, NULL}, }; /* * PROFILE ATTRIBUTES **************************************************************************************** */ /// Server Service const atts_svc_desc_t qpps_svc = QPP_SVC_PRIVATE_UUID; /// Server Service - Server value Characteristic const struct atts_char_desc qpps_value_char = ATTS_CHAR(ATT_CHAR_PROP_NTF, 0, QPPS_FIRST_TX_CHAR_UUID); /// RX data characteristic const struct atts_char_desc qpps_char_rx_data = ATTS_CHAR(ATT_CHAR_PROP_WR | ATT_CHAR_PROP_WR_NO_RESP, 0, QPPS_RX_CHAR_UUID); /* * GLOBAL VARIABLE DEFINITIONS **************************************************************************************** */ struct qpps_env_tag qpps_env; /* * DEFINES
[PASS_IDX_RINGER_SETTING_CFG] = {ATT_DESC_CLIENT_CHAR_CFG, PERM(RD, ENABLE)|PERM(WR, ENABLE), sizeof(uint16_t), 0, NULL}, // Ringer Control Point Characteristic Declaration [PASS_IDX_RINGER_CTNL_PT_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(pasps_ringer_ctnl_pt_char), sizeof(pasps_ringer_ctnl_pt_char), (uint8_t *)&pasps_ringer_ctnl_pt_char}, // Ringer Control Point Characteristic Value [PASS_IDX_RINGER_CTNL_PT_VAL] = {ATT_CHAR_RINGER_CNTL_POINT, PERM(WR, ENABLE), sizeof(uint8_t), 0, NULL}, }; /// Phone Alert Status Service const atts_svc_desc_t pasps_pass_svc = ATT_SVC_PHONE_ALERT_STATUS; /// Phone Alert Status Service Alert Status Characteristic const struct atts_char_desc pasps_alert_status_char = ATTS_CHAR(ATT_CHAR_PROP_RD | ATT_CHAR_PROP_NTF, 0, ATT_CHAR_ALERT_STATUS); /// Phone Alert Status Service Ringer Setting Characteristic const struct atts_char_desc pasps_ringer_setting_char = ATTS_CHAR(ATT_CHAR_PROP_RD | ATT_CHAR_PROP_NTF, 0, ATT_CHAR_RINGER_SETTING); /// Phone Alert Status Service Ringer Settings Characteristic const struct atts_char_desc pasps_ringer_ctnl_pt_char = ATTS_CHAR(ATT_CHAR_PROP_WR_NO_RESP, 0, ATT_CHAR_RINGER_CNTL_POINT); /* * GLOBAL VARIABLE DEFINITIONS **************************************************************************************** */ /// Phone Alert Status Profile Server Environment Variable
#include "glps.h" #include "glps_task.h" #include "prf_utils.h" /* * GLUCOSE PROFILE ATTRIBUTES **************************************************************************************** */ /// Glucose Sensor Service static const atts_svc_desc_t glps_gls_svc = ATT_SVC_GLUCOSE; /// Glucose Measurement characteristic value static const struct atts_char_desc glps_meas_char = ATTS_CHAR(ATT_CHAR_PROP_NTF, 0, ATT_CHAR_GLUCOSE_MEAS); /// Glucose Measurement Context characteristic value static const struct atts_char_desc glps_meas_ctx_char = ATTS_CHAR(ATT_CHAR_PROP_NTF, 0, ATT_CHAR_GLUCOSE_MEAS_CTX); /// Glucose Feature characteristic value static const struct atts_char_desc glps_feature_char = ATTS_CHAR(ATT_CHAR_PROP_RD, 0, ATT_CHAR_GLUCOSE_FEATURE); /// Record Access Control Point characteristic value static const struct atts_char_desc glps_racp_char = ATTS_CHAR(ATT_CHAR_PROP_WR | ATT_CHAR_PROP_IND, 0, ATT_CHAR_REC_ACCESS_CTRL_PT);
PERM(RD, ENABLE), sizeof(struct hids_report_ref), 0, NULL}, // Report Characteristic - Client Characteristic Configuration Descriptor [HOGPD_IDX_REPORT_NTF_CFG] = {ATT_DESC_CLIENT_CHAR_CFG, (PERM(RD, ENABLE) | PERM(WR, ENABLE)), sizeof(uint16_t), 0, NULL}, }; /// HID Service const atts_svc_desc_t hid_svc = ATT_SVC_HID; /// HID Information Characteristic const struct atts_char_desc hids_hid_info_char = ATTS_CHAR(ATT_CHAR_PROP_RD, HOGPD_HID_INFO_CHAR, ATT_CHAR_HID_INFO); /// HID Control Point Characteristic const struct atts_char_desc hids_hid_ctnl_pt_char = ATTS_CHAR(ATT_CHAR_PROP_WR_NO_RESP, HOGPD_HID_CTNL_PT_CHAR, ATT_CHAR_HID_CTNL_PT); /// Report Map Characteristic const struct atts_char_desc hids_report_map_char = ATTS_CHAR(ATT_CHAR_PROP_RD, HOGPD_REPORT_MAP_CHAR, ATT_CHAR_REPORT_MAP); /// Protocol Mode Characteristic const struct atts_char_desc hids_proto_mode_char = ATTS_CHAR((ATT_CHAR_PROP_RD | ATT_CHAR_PROP_WR_NO_RESP), HOGPD_PROTO_MODE_CHAR,
/** **************************************************************************************** * @brief Handles reception of the @ref QPPS_CREATE_DB_REQ message. * The handler adds Quintic private service into the database using the database * configuration value given in param. * @param[in] msgid Id of the message received (probably unused). * @param[in] param Pointer to the parameters of the message. * @param[in] dest_id ID of the receiving task instance (probably unused). * @param[in] src_id ID of the sending task instance. * @return If the message was consumed or not. **************************************************************************************** */ static int qpps_create_db_req_handler(ke_msg_id_t const msgid, struct qpps_create_db_req const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id) { //Service Configuration Flag uint64_t cfg_flag = QPPS_MANDATORY_MASK; //Database Creation Status uint8_t status; uint8_t idx_nb = 4; uint8_t tx_char_num = param->tx_char_num; struct atts_desc *qpps_db = NULL; struct atts_char_desc *char_desc_def = NULL; //Save Application ID qpps_env.appid = src_id; qpps_env.ntf_char_num = tx_char_num; /*---------------------------------------------------* * Quintic private Service Creation *---------------------------------------------------*/ if (tx_char_num > 1) { qpps_db = (struct atts_desc *)ke_malloc(sizeof(qpps_att_db) + 3 * (tx_char_num - 1) * sizeof(struct atts_desc)); char_desc_def = (struct atts_char_desc *)ke_malloc((tx_char_num - 1) * sizeof(struct atts_char_desc)); for (uint8_t i = 0; i < tx_char_num - 1; i++) { struct atts_char_desc value_char = ATTS_CHAR(ATT_CHAR_PROP_NTF, 0, QPP_CHAR_VAL_UUID + i + 1); char_desc_def[i] = value_char; } memcpy(qpps_db, qpps_att_db, sizeof(qpps_att_db)); for (uint8_t i = 0; i < tx_char_num - 1; i++) { qpps_db[QPPS_IDX_NB + i * 3] = qpps_db[QPPS_IDX_VAL_CHAR]; qpps_db[QPPS_IDX_NB + i * 3].value = (uint8_t*)&char_desc_def[i]; qpps_db[QPPS_IDX_NB + i * 3 + 1] = qpps_db[QPPS_IDX_VAL]; qpps_db[QPPS_IDX_NB + i * 3 + 1].uuid += i + 1; qpps_db[QPPS_IDX_NB + i * 3 + 2] = qpps_db[QPPS_IDX_VAL + 1]; } } while (tx_char_num--) { cfg_flag = (cfg_flag << 3) | 0x07; idx_nb += 3; } //Add Service Into Database status = atts_svc_create_db(&qpps_env.shdl, (uint8_t *)&cfg_flag, idx_nb, NULL, dest_id, (param->tx_char_num == 1 ? &qpps_att_db[0] : &qpps_db[0])); if (qpps_db != NULL) ke_free(qpps_db); if (char_desc_def != NULL) ke_free(char_desc_def); //Disable QPPS attsdb_svc_set_permission(qpps_env.shdl, PERM(SVC, DISABLE)); //Go to Idle State if (status == ATT_ERR_NO_ERROR) { //If we are here, database has been fulfilled with success, go to idle test ke_state_set(TASK_QPPS, QPPS_IDLE); } //Send response to application struct qpps_create_db_cfm * cfm = KE_MSG_ALLOC(QPPS_CREATE_DB_CFM, qpps_env.appid, TASK_QPPS, qpps_create_db_cfm); cfm->status = status; ke_msg_send(cfm); return (KE_MSG_CONSUMED); }
sizeof(findt_alert_lvl_char), (uint8_t *)&findt_alert_lvl_char}, // Alert Level Characteristic Value [FINDT_IAS_IDX_ALERT_LVL_VAL] = {ATT_CHAR_ALERT_LEVEL, PERM(WR, ENABLE), sizeof(uint8_t), 0, NULL}, }; /* * FIND ME PROFILE TARGET ATTRIBUTES **************************************************************************************** */ /// Immediate Alert Service const atts_svc_desc_t findt_ias_svc = ATT_SVC_IMMEDIATE_ALERT; /// Alert Level Service - Heart Rate Measurement Characteristic const struct atts_char_desc findt_alert_lvl_char = ATTS_CHAR(ATT_CHAR_PROP_WR_NO_RESP, 0, ATT_CHAR_ALERT_LEVEL); /* * GLOBAL VARIABLE DEFINITIONS **************************************************************************************** */ struct findt_env_tag findt_env; /* * FUNCTION DEFINITIONS **************************************************************************************** */ void findt_init(void) { // Reset environment
#include "anps_task.h" #include "anp_common.h" #include "prf_utils.h" #include "prf_types.h" /* * ANS ATTRIBUTES **************************************************************************************** */ /// Alert Notification Service const atts_svc_desc_t anps_ans_svc = ATT_SVC_ALERT_NTF; /// Supported New Alert Category Characteristic const struct atts_char_desc anps_supp_new_alert_cat_char = ATTS_CHAR(ATT_CHAR_PROP_RD, 0, ATT_CHAR_SUP_NEW_ALERT_CAT); /// New Alert Characteristic const struct atts_char_desc anps_new_alert_char = ATTS_CHAR(ATT_CHAR_PROP_NTF, 0, ATT_CHAR_NEW_ALERT); /// Supported Unread Alert Category Characteristic const struct atts_char_desc anps_supp_unread_alert_cat_char = ATTS_CHAR(ATT_CHAR_PROP_RD, 0, ATT_CHAR_SUP_UNREAD_ALERT_CAT); /// Unread Alert Status Characteristic const struct atts_char_desc anps_unread_alert_status_char = ATTS_CHAR(ATT_CHAR_PROP_NTF, 0, ATT_CHAR_UNREAD_ALERT_STATUS); /// Alert Notification Control Point Characteristic const struct atts_char_desc anps_alert_ntf_ctnl_pt_char = ATTS_CHAR(ATT_CHAR_PROP_WR,
[SCPS_IDX_SCAN_REFRESH_CHAR] = {ATT_DECL_CHARACTERISTIC, PERM(RD, ENABLE), sizeof(scps_scan_refresh_char), sizeof(scps_scan_refresh_char), (uint8_t *)&scps_scan_refresh_char}, // Scan Refresh Characteristic Value [SCPS_IDX_SCAN_REFRESH_VAL] = {ATT_CHAR_SCAN_REFRESH, PERM(NTF, ENABLE), sizeof(uint8_t), 0, NULL}, // Scan Refresh Characteristic - Client Characteristic Configuration Descriptor [SCPS_IDX_SCAN_REFRESH_NTF_CFG] = {ATT_DESC_CLIENT_CHAR_CFG, PERM(RD, ENABLE)|PERM(WR, ENABLE), sizeof(uint16_t), 0, NULL}, }; /// Scan Parameters Service const atts_svc_desc_t scps_svc = ATT_SVC_SCAN_PARAMETERS; /// Scan Parameters Service Scan Interval Window characteristic const struct atts_char_desc scps_scan_intv_wd_char = ATTS_CHAR(ATT_CHAR_PROP_WR_NO_RESP, 0, ATT_CHAR_SCAN_INTV_WD); /// Scan Parameters Service Scan Refresh characteristic const struct atts_char_desc scps_scan_refresh_char = ATTS_CHAR(ATT_CHAR_PROP_NTF, 0, ATT_CHAR_SCAN_REFRESH); /* * GLOBAL VARIABLE DEFINITIONS **************************************************************************************** */ struct scpps_env_tag scpps_env; /*