configuration write handler
This commit is contained in:
parent
8f74dda224
commit
bc0830f81d
@ -1 +1 @@
|
|||||||
Subproject commit 544c26fdfda6d679f07192b2358de1cefc998859
|
Subproject commit a15c1ca68e8bc601ae82f5b9184a5742e741ccee
|
@ -69,6 +69,31 @@ void on_char_read_handler(int svc_ind, int chr_ind, void** value, size_t* value_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int on_char_write_handler(int svc_ind, int chr_ind, struct os_mbuf* os){
|
||||||
|
ESP_LOGI(TAG, "char write handler");
|
||||||
|
uint32_t val;
|
||||||
|
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
switch(svc_ind){
|
||||||
|
case CONFIGURATION_SVC_ID:
|
||||||
|
switch (chr_ind){
|
||||||
|
case SWITCHING_FREQUENCY_CHR_ID:
|
||||||
|
;
|
||||||
|
rc = gatt_svr_chr_write_get_data(os, sizeof(val), sizeof(val), &val, NULL);
|
||||||
|
switching_frequency = val;
|
||||||
|
break;
|
||||||
|
case DUTY_CYCLE_CHR_ID:
|
||||||
|
rc = gatt_svr_chr_write_get_data(os, sizeof(val), sizeof(val), &val, NULL);
|
||||||
|
duty_cycle = val;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
void app_main(void){
|
void app_main(void){
|
||||||
adc_continuous_handle_cfg_t adc_h_conf = {
|
adc_continuous_handle_cfg_t adc_h_conf = {
|
||||||
.conv_frame_size = SOC_ADC_DIGI_DATA_BYTES_PER_CONV,
|
.conv_frame_size = SOC_ADC_DIGI_DATA_BYTES_PER_CONV,
|
||||||
@ -174,7 +199,8 @@ void app_main(void){
|
|||||||
|
|
||||||
gatt_value_server_handle_t calc_meas_serve_handle = simple_gatt_value_server(calc_meas, sizeof(uint32_t), ADC_IN_PIN_NUM, calc_meas_formats, &gatt_svcs[CALC_VALUES_SVC_ID], CALC_VALUES_SVC_ID, calc_meas_char_uuid);
|
gatt_value_server_handle_t calc_meas_serve_handle = simple_gatt_value_server(calc_meas, sizeof(uint32_t), ADC_IN_PIN_NUM, calc_meas_formats, &gatt_svcs[CALC_VALUES_SVC_ID], CALC_VALUES_SVC_ID, calc_meas_char_uuid);
|
||||||
|
|
||||||
add_on_char_read_handler(on_char_read_handler);
|
set_on_char_read_handler(on_char_read_handler);
|
||||||
|
set_on_char_write_handler(on_char_write_handler);
|
||||||
|
|
||||||
set_gatt_services(gatt_svcs, SVCS_NUM);
|
set_gatt_services(gatt_svcs, SVCS_NUM);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user