本文整理汇总了C++中BLE_UUID_BLE_ASSIGN函数的典型用法代码示例。如果您正苦于以下问题:C++ BLE_UUID_BLE_ASSIGN函数的具体用法?C++ BLE_UUID_BLE_ASSIGN怎么用?C++ BLE_UUID_BLE_ASSIGN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLE_UUID_BLE_ASSIGN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ble_ans_c_init
uint32_t ble_ans_c_init(ble_ans_c_t * p_ans, const ble_ans_c_init_t * p_ans_init)
{
VERIFY_PARAM_NOT_NULL(p_ans);
VERIFY_PARAM_NOT_NULL(p_ans_init);
VERIFY_PARAM_NOT_NULL(p_ans_init->evt_handler);
// clear all handles
memset(p_ans, 0, sizeof(ble_ans_c_t));
memset(m_tx_buffer, 0, TX_BUFFER_SIZE);
p_ans->conn_handle = BLE_CONN_HANDLE_INVALID;
p_ans->evt_handler = p_ans_init->evt_handler;
p_ans->error_handler = p_ans_init->error_handler;
p_ans->message_buffer_size = p_ans_init->message_buffer_size;
p_ans->p_message_buffer = p_ans_init->p_message_buffer;
BLE_UUID_BLE_ASSIGN(p_ans->service.service.uuid, BLE_UUID_ALERT_NOTIFICATION_SERVICE);
BLE_UUID_BLE_ASSIGN(p_ans->service.new_alert.uuid, BLE_UUID_NEW_ALERT_CHAR);
BLE_UUID_BLE_ASSIGN(p_ans->service.alert_notif_ctrl_point.uuid,
BLE_UUID_ALERT_NOTIFICATION_CONTROL_POINT_CHAR);
BLE_UUID_BLE_ASSIGN(p_ans->service.unread_alert_status.uuid, BLE_UUID_UNREAD_ALERT_CHAR);
BLE_UUID_BLE_ASSIGN(p_ans->service.suported_new_alert_cat.uuid,
BLE_UUID_SUPPORTED_NEW_ALERT_CATEGORY_CHAR);
BLE_UUID_BLE_ASSIGN(p_ans->service.suported_unread_alert_cat.uuid,
BLE_UUID_SUPPORTED_UNREAD_ALERT_CATEGORY_CHAR);
BLE_UUID_BLE_ASSIGN(p_ans->service.new_alert_cccd.uuid, BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG);
BLE_UUID_BLE_ASSIGN(p_ans->service.unread_alert_cccd.uuid,
BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG);
return ble_db_discovery_evt_register(&p_ans->service.service.uuid);
}
示例2: ble_qodome_init
uint32_t ble_qodome_init(void)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
// Initialize service structure
ble_qodome_t * p_qodome = &m_qodome;
p_qodome->conn_handle = BLE_CONN_HANDLE_INVALID;
// Add service
BLE_UUID_BLE_ASSIGN(ble_uuid, QODOME_PUBLIC_SERVICE);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_qodome->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add memory dump characteristic
err_code = hts_qodome_char_add(p_qodome);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
return NRF_SUCCESS;
}
示例3: ble_bps_init
uint32_t ble_bps_init(ble_bps_t * p_bps, const ble_bps_init_t * p_bps_init)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
// Initialize service structure
p_bps->evt_handler = p_bps_init->evt_handler;
p_bps->conn_handle = BLE_CONN_HANDLE_INVALID;
p_bps->feature = p_bps_init->feature;
// Add service
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BLOOD_PRESSURE_SERVICE);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_bps->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add measurement characteristic
err_code = bps_measurement_char_add(p_bps, p_bps_init);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add feature characteristic
err_code = bps_feature_char_add(p_bps, p_bps_init);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
return NRF_SUCCESS;
}
示例4: ble_bas_init
uint32_t ble_bas_init(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init)
{
if (p_bas == NULL || p_bas_init == NULL)
{
return NRF_ERROR_NULL;
}
uint32_t err_code;
ble_uuid_t ble_uuid;
// Initialize service structure
p_bas->evt_handler = p_bas_init->evt_handler;
p_bas->conn_handle = BLE_CONN_HANDLE_INVALID;
p_bas->is_notification_supported = p_bas_init->support_notification;
p_bas->battery_level_last = INVALID_BATTERY_LEVEL;
// Add service
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BATTERY_SERVICE);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_bas->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add battery level characteristic
return battery_level_char_add(p_bas, p_bas_init);
}
示例5: ble_ias_init
uint32_t ble_ias_init(ble_ias_t * p_ias, const ble_ias_init_t * p_ias_init)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
// Initialize service structure
if (p_ias_init->evt_handler == NULL)
{
return NRF_ERROR_INVALID_PARAM;
}
p_ias->evt_handler = p_ias_init->evt_handler;
// Add service
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_IMMEDIATE_ALERT_SERVICE);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
&ble_uuid,
&p_ias->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add alert level characteristic
return alert_level_char_add(p_ias);
}
示例6: ble_cscs_init
uint32_t ble_cscs_init(ble_cscs_t * p_cscs, const ble_cscs_init_t * p_cscs_init)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
ble_cs_ctrlpt_init_t sc_ctrlpt_init;
// Initialize service structure
p_cscs->evt_handler = p_cscs_init->evt_handler;
p_cscs->conn_handle = BLE_CONN_HANDLE_INVALID;
p_cscs->feature = p_cscs_init->feature;
// Add service
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_CYCLING_SPEED_AND_CADENCE);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
&ble_uuid,
&p_cscs->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add cycling speed and cadence measurement characteristic
err_code = csc_measurement_char_add(p_cscs, p_cscs_init);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add cycling speed and cadence feature characteristic
err_code = csc_feature_char_add(p_cscs, p_cscs_init);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add Sensor Location characteristic (optional)
if (p_cscs_init->sensor_location != NULL)
{
err_code = csc_sensor_loc_char_add(p_cscs, p_cscs_init);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
}
//Add speed and cadence control point characteristic
sc_ctrlpt_init.error_handler = p_cscs_init->error_handler;
sc_ctrlpt_init.size_list_supported_locations = p_cscs_init->size_list_supported_locations;
sc_ctrlpt_init.supported_functions = p_cscs_init->ctrplt_supported_functions;
sc_ctrlpt_init.evt_handler = p_cscs_init->ctrlpt_evt_handler;
sc_ctrlpt_init.list_supported_locations = p_cscs_init->list_supported_locations;
sc_ctrlpt_init.sc_ctrlpt_attr_md = p_cscs_init->csc_ctrlpt_attr_md;
sc_ctrlpt_init.sensor_location_handle = p_cscs->sensor_loc_handles.value_handle;
sc_ctrlpt_init.service_handle = p_cscs->service_handle;
return ble_sc_ctrlpt_init(&p_cscs->ctrl_pt, &sc_ctrlpt_init);
}
示例7: indication_char_add
static uint32_t indication_char_add(uint16_t uuid,
uint8_t *p_char_value,
uint16_t char_len,
const ble_srv_cccd_security_mode_t* idc_char_attr_md,
ble_gatts_char_handles_t* p_handles)
{
ble_gatts_char_md_t char_md;
ble_gatts_attr_md_t cccd_md;
ble_gatts_attr_md_t attr_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
APP_ERROR_CHECK_BOOL(p_char_value != NULL);
APP_ERROR_CHECK_BOOL(char_len > 0);
memset(&cccd_md, 0, sizeof(cccd_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
cccd_md.vloc = BLE_GATTS_VLOC_STACK;
cccd_md.write_perm = idc_char_attr_md->cccd_write_perm;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.indicate = 1;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf = NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md = &cccd_md;
char_md.p_sccd_md = NULL;
BLE_UUID_BLE_ASSIGN(ble_uuid, uuid);
memset(&attr_md, 0, sizeof(attr_md));
attr_md.vloc = BLE_GATTS_VLOC_STACK;
attr_md.read_perm = idc_char_attr_md->read_perm;
attr_md.write_perm = idc_char_attr_md->write_perm;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen = 1;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &ble_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_len = char_len;
attr_char_value.init_offs = 0;
attr_char_value.max_len = char_len;
attr_char_value.p_value = p_char_value;
return sd_ble_gatts_characteristic_add(service_handle, \
&char_md, \
&attr_char_value, \
p_handles);
}
示例8: boot_inp_rep_char_add
/**@brief Function for adding Input Report characteristics.
*
* @param[in] p_hids HID Service structure.
* @param[in] uuid UUID of report characteristic to be added.
* @param[in] max_data_len Maximum length of report value.
* @param[in] p_sec_mode Characteristic security settings.
* @param[out] p_char_handles Handles of new characteristic.
*
* @return NRF_SUCCESS on success, otherwise an error code.
*/
static uint32_t boot_inp_rep_char_add(ble_hids_t * p_hids,
uint16_t uuid,
uint16_t max_data_len,
const ble_srv_cccd_security_mode_t * p_sec_mode,
ble_gatts_char_handles_t * p_char_handles)
{
ble_gatts_char_md_t char_md;
ble_gatts_attr_md_t cccd_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
ble_gatts_attr_md_t attr_md;
memset(&cccd_md, 0, sizeof(cccd_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
cccd_md.write_perm = p_sec_mode->cccd_write_perm;
cccd_md.vloc = BLE_GATTS_VLOC_STACK;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.read = 1;
char_md.char_props.write = (p_sec_mode->write_perm.sm) ? 1 : 0;
char_md.char_props.notify = 1;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf = NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md = &cccd_md;
char_md.p_sccd_md = NULL;
BLE_UUID_BLE_ASSIGN(ble_uuid, uuid);
memset(&attr_md, 0, sizeof(attr_md));
attr_md.read_perm = p_sec_mode->read_perm;
attr_md.write_perm = p_sec_mode->write_perm;
attr_md.vloc = BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen = 0;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &ble_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_len = 0;
attr_char_value.init_offs = 0;
attr_char_value.max_len = max_data_len;
attr_char_value.p_value = NULL;
return sd_ble_gatts_characteristic_add(p_hids->service_handle,
&char_md,
&attr_char_value,
p_char_handles);
}
示例9: on_connect
/**@brief Function for handling the Connect event.
*
* @param[in] p_ias_c Immediate Alert Service client structure.
* @param[in] p_ble_evt Event received from the BLE stack.
*/
static uint32_t on_connect(ble_ias_c_t * p_ias_c, ble_evt_t const * p_ble_evt)
{
ble_uuid_t ias_uuid;
p_ias_c->conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
// Discover Immediate alert service
BLE_UUID_BLE_ASSIGN(ias_uuid, BLE_UUID_IMMEDIATE_ALERT_SERVICE);
return sd_ble_gattc_primary_services_discover(p_ias_c->conn_handle, START_HANDLE, &ias_uuid);
}
示例10: heart_rate_measurement_char_add
/**@brief Function for adding the Heart Rate Measurement characteristic.
*
* @param[in] p_hrs Heart Rate Service structure.
* @param[in] p_hrs_init Information needed to initialize the service.
*
* @return NRF_SUCCESS on success, otherwise an error code.
*/
static uint32_t heart_rate_measurement_char_add(ble_hrs_t * p_hrs,
const ble_hrs_init_t * p_hrs_init)
{
simple_uart_putstring("add heart rate measurement");
ble_gatts_char_md_t char_md;
ble_gatts_attr_md_t cccd_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
ble_gatts_attr_md_t attr_md;
uint8_t encoded_initial_hrm[MAX_HRM_LEN];
memset(&cccd_md, 0, sizeof(cccd_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
cccd_md.write_perm = p_hrs_init->hrs_hrm_attr_md.cccd_write_perm;
cccd_md.vloc = BLE_GATTS_VLOC_STACK;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.notify = 1;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf = NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md = &cccd_md;
char_md.p_sccd_md = NULL;
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HEART_RATE_MEASUREMENT_CHAR);
memset(&attr_md, 0, sizeof(attr_md));
attr_md.read_perm = p_hrs_init->hrs_hrm_attr_md.read_perm;
attr_md.write_perm = p_hrs_init->hrs_hrm_attr_md.write_perm;
attr_md.vloc = BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen = 1;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &ble_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_len = hrm_encode(p_hrs, INITIAL_VALUE_HRM, encoded_initial_hrm);
attr_char_value.init_offs = 0;
attr_char_value.max_len = MAX_HRM_LEN;
attr_char_value.p_value = encoded_initial_hrm;
return sd_ble_gatts_characteristic_add(p_hrs->service_handle,
&char_md,
&attr_char_value,
&p_hrs->hrm_handles);
}
示例11: hts_measurement_char_add
/**@brief Add Health Thermometer Measurement characteristic.
*
* @param[in] p_hts Health Thermometer Service structure.
* @param[in] p_hts_init Information needed to initialize the service.
*
* @return NRF_SUCCESS on success, otherwise an error code.
*/
static uint32_t hts_measurement_char_add(ble_hts_t * p_hts, const ble_hts_init_t * p_hts_init)
{
ble_gatts_char_md_t char_md;
ble_gatts_attr_md_t cccd_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
ble_gatts_attr_md_t attr_md;
ble_hts_meas_t initial_htm;
uint8_t encoded_htm[MAX_HTM_LEN];
memset(&cccd_md, 0, sizeof(cccd_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
cccd_md.vloc = BLE_GATTS_VLOC_STACK;
cccd_md.write_perm = p_hts_init->hts_meas_attr_md.cccd_write_perm;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.indicate = 1;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf = NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md = &cccd_md;
char_md.p_sccd_md = NULL;
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_TEMPERATURE_MEASUREMENT_CHAR);
memset(&attr_md, 0, sizeof(attr_md));
attr_md.vloc = BLE_GATTS_VLOC_STACK;
attr_md.read_perm = p_hts_init->hts_meas_attr_md.read_perm;
attr_md.write_perm = p_hts_init->hts_meas_attr_md.write_perm;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen = 1;
memset(&attr_char_value, 0, sizeof(attr_char_value));
memset(&initial_htm, 0, sizeof(initial_htm));
attr_char_value.p_uuid = &ble_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_len = hts_measurement_encode(p_hts, &initial_htm, encoded_htm);
attr_char_value.init_offs = 0;
attr_char_value.max_len = MAX_HTM_LEN;
attr_char_value.p_value = encoded_htm;
return sd_ble_gatts_characteristic_add(p_hts->service_handle,
&char_md,
&attr_char_value,
&p_hts->meas_handles);
}
示例12: dp_otp_char_add
/**@brief Digipass OTP characteristic.
*
* @param[in] p_dp Digipass Service structure.
* @param[in] p_dp_init Information needed to initialize the service.
*
* @return NRF_SUCCESS on success, otherwise an error code.
*/
static uint32_t dp_otp_char_add(ble_dp_t * p_dp, const ble_dp_init_t * p_dp_init)
{
ble_gatts_char_md_t char_md;
//ble_gatts_attr_md_t cccd_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
ble_gatts_attr_md_t attr_md;
uint8_t initial_otp;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.read = 1; //Reading value permitted.
//char_md.char_properties.notify = (p_bas->is_notification_supported) ? 1 : 0;
char_md.p_char_user_desc = NULL; //Pointer to a UTF-8, NULL if the descriptor is not required.
char_md.p_char_pf = NULL; //Pointer to a presentation format structure or NULL if the descriptor is not required.
char_md.p_user_desc_md = NULL; //Attribute Metadata for the User Description descriptor, or NULL for default values.
//char_md.p_cccd_md = (p_bas->is_notification_supported) ? &cccd_md : NULL;
char_md.p_cccd_md = NULL;
//Attribute Metadata for the Client Characteristic Configuration Descriptor, or NULL for default values.
char_md.p_sccd_md = NULL;
//Attribute Metadata for the Server Characteristic Configuration Descriptor, or NULL for default values.
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_DP_OTP); //Assing Digipass OTP UUID
memset(&attr_md, 0, sizeof(attr_md));
attr_md.read_perm = p_dp_init->dp_otp_char_attr_md.read_perm; //Read permissions.
attr_md.write_perm = p_dp_init->dp_otp_char_attr_md.write_perm; //Write permissions.
attr_md.vloc = BLE_GATTS_VLOC_STACK; /**< Value is located in stack memory. */
attr_md.rd_auth = 0; //Value will be requested from application on every read. OFF
attr_md.wr_auth = 0; //Value will be reported to application on every write. OFF
attr_md.vlen = 0; //Variable length attribute. OFF
initial_otp = p_dp_init->initial_otp;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &ble_uuid; //Pointer to the attribute UUID.
attr_char_value.p_attr_md = &attr_md; //Pointer to the attribute metadata structure.
attr_char_value.init_len = sizeof(uint8_t); //Initial attribute value length in bytes.
attr_char_value.init_offs = 0;
//Initial attribute value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized.
attr_char_value.max_len = sizeof(uint8_t); //Maximum attribute value length in bytes.
attr_char_value.p_value = &initial_otp; //Pointer to the attribute data.
return sd_ble_gatts_characteristic_add(p_dp->service_handle,
&char_md,
&attr_char_value,
&p_dp->dp_otp_handles);
}
示例13: csc_sensor_loc_char_add
/**@brief Function for adding CSC Sensor Location characteristic.
*
* @param[in] p_cscs Cycling Speed and Cadence Service structure.
* @param[in] p_cscs_init Information needed to initialize the service.
*
* @return NRF_SUCCESS on success, otherwise an error code.
*/
static uint32_t csc_sensor_loc_char_add(ble_cscs_t * p_cscs, const ble_cscs_init_t * p_cscs_init)
{
ble_gatts_char_md_t char_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
ble_gatts_attr_md_t attr_md;
uint8_t init_value_len;
uint8_t encoded_init_value[1];
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.read = 1;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf = NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md = NULL;
char_md.p_sccd_md = NULL;
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_SENSOR_LOCATION_CHAR);
memset(&attr_md, 0, sizeof(attr_md));
attr_md.read_perm = p_cscs_init->csc_sensor_loc_attr_md.read_perm;
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);
attr_md.vloc = BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen = 0;
memset(&attr_char_value, 0, sizeof(attr_char_value));
init_value_len = sizeof(uint8_t);
if (p_cscs_init->sensor_location != NULL)
{
encoded_init_value[0] = *p_cscs_init->sensor_location;
}
attr_char_value.p_uuid = &ble_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_len = init_value_len;
attr_char_value.init_offs = 0;
attr_char_value.max_len = init_value_len;
attr_char_value.p_value = encoded_init_value;
return sd_ble_gatts_characteristic_add(p_cscs->service_handle,
&char_md,
&attr_char_value,
&p_cscs->sensor_loc_handles);
}
示例14: ble_ias_c_init
uint32_t ble_ias_c_init(ble_ias_c_t * p_ias_c, ble_ias_c_init_t const * p_ias_c_init)
{
if (p_ias_c_init->evt_handler == NULL)
{
return NRF_ERROR_INVALID_PARAM;
}
p_ias_c->evt_handler = p_ias_c_init->evt_handler;
p_ias_c->error_handler = p_ias_c_init->error_handler;
p_ias_c->conn_handle = BLE_CONN_HANDLE_INVALID;
p_ias_c->alert_level_handle = BLE_GATT_HANDLE_INVALID;
BLE_UUID_BLE_ASSIGN(m_alert_level_uuid, BLE_UUID_ALERT_LEVEL_CHAR);
return NRF_SUCCESS;
}
示例15: ble_tps_init
uint32_t ble_tps_init(ble_tps_t * p_tps, const ble_tps_init_t * p_tps_init)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
// Add service
BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_TX_POWER_SERVICE);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_tps->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
// Add TX Power Level characteristic
return tx_power_level_char_add(p_tps, p_tps_init);
}