Lines Matching +full:data +full:- +full:role
4 * SPDX-License-Identifier: Apache-2.0
40 enum bt_conn_le_cs_role role; member
46 *z_out_real = z_a_real * z_b_real - z_a_imag * z_b_imag; in calc_complex_product()
62 y_mean += (y_values[i] - y_mean) / (i + 1); in linear_regression()
63 x_mean += (x_values[i] - x_mean) / (i + 1); in linear_regression()
70 b_est_upper += (x_values[i] - x_mean) * (y_values[i] - y_mean); in linear_regression()
71 b_est_lower += (x_values[i] - x_mean) * (x_values[i] - x_mean); in linear_regression()
82 for (uint16_t i = 0; i < len - 1; i++) { in bubblesort_2()
84 for (uint16_t j = 0; j < len - i - 1; j++) { in bubblesort_2()
102 static float estimate_distance_using_phase_slope(struct iq_sample_and_channel *data, uint8_t len) in estimate_distance_using_phase_slope() argument
111 if (!data[i].failed) { in estimate_distance_using_phase_slope()
112 calc_complex_product(data[i].local_iq_sample.i, data[i].local_iq_sample.q, in estimate_distance_using_phase_slope()
113 data[i].peer_iq_sample.i, data[i].peer_iq_sample.q, in estimate_distance_using_phase_slope()
117 frequencies[num_angles] = 1.0 * CS_FREQUENCY_MHZ(data[i].channel); in estimate_distance_using_phase_slope()
129 /* One-dimensional phase unwrapping */ in estimate_distance_using_phase_slope()
131 float difference = theta[i] - theta[i - 1]; in estimate_distance_using_phase_slope()
135 theta[j] -= 2.0f * PI; in estimate_distance_using_phase_slope()
137 } else if (difference < -PI) { in estimate_distance_using_phase_slope()
146 float distance = -phase_slope * (SPEED_OF_LIGHT_M_PER_S / (4 * PI)); in estimate_distance_using_phase_slope()
159 tof = (mode_1_data[i].toa_tod_initiator - in estimate_distance_using_time_of_flight()
162 tof_mean += (tof - tof_mean) / (i + 1); in estimate_distance_using_time_of_flight()
175 if (step->mode == BT_CONN_LE_CS_MAIN_MODE_2) { in process_step_data()
177 (struct bt_hci_le_cs_step_data_mode_2 *)step->data; in process_step_data()
179 if (context->local_steps) { in process_step_data()
180 for (uint8_t i = 0; i < (context->n_ap + 1); i++) { in process_step_data()
181 if (step_data->tone_info[i].extension_indicator != in process_step_data()
186 mode_2_data[context->mode_2_data_index].channel = step->channel; in process_step_data()
187 mode_2_data[context->mode_2_data_index].antenna_permutation = in process_step_data()
188 step_data->antenna_permutation_index; in process_step_data()
189 mode_2_data[context->mode_2_data_index].local_iq_sample = in process_step_data()
191 step_data->tone_info[i].phase_correction_term); in process_step_data()
192 if (step_data->tone_info[i].quality_indicator == in process_step_data()
194 step_data->tone_info[i].quality_indicator == in process_step_data()
196 mode_2_data[context->mode_2_data_index].failed = true; in process_step_data()
199 context->mode_2_data_index++; in process_step_data()
202 for (uint8_t i = 0; i < (context->n_ap + 1); i++) { in process_step_data()
203 if (step_data->tone_info[i].extension_indicator != in process_step_data()
208 mode_2_data[context->mode_2_data_index].peer_iq_sample = in process_step_data()
210 step_data->tone_info[i].phase_correction_term); in process_step_data()
211 if (step_data->tone_info[i].quality_indicator == in process_step_data()
213 step_data->tone_info[i].quality_indicator == in process_step_data()
215 mode_2_data[context->mode_2_data_index].failed = true; in process_step_data()
218 context->mode_2_data_index++; in process_step_data()
221 } else if (step->mode == BT_HCI_OP_LE_CS_MAIN_MODE_1) { in process_step_data()
223 (struct bt_hci_le_cs_step_data_mode_1 *)step->data; in process_step_data()
225 if (step_data->packet_quality_aa_check != in process_step_data()
227 step_data->packet_rssi == BT_HCI_LE_CS_PACKET_RSSI_NOT_AVAILABLE || in process_step_data()
228 step_data->tod_toa_reflector == BT_HCI_LE_CS_TIME_DIFFERENCE_NOT_AVAILABLE) { in process_step_data()
229 mode_1_data[context->mode_1_data_index].failed = true; in process_step_data()
232 if (context->local_steps) { in process_step_data()
233 if (context->role == BT_CONN_LE_CS_ROLE_INITIATOR) { in process_step_data()
234 mode_1_data[context->mode_1_data_index].toa_tod_initiator = in process_step_data()
235 step_data->toa_tod_initiator; in process_step_data()
236 } else if (context->role == BT_CONN_LE_CS_ROLE_REFLECTOR) { in process_step_data()
237 mode_1_data[context->mode_1_data_index].tod_toa_reflector = in process_step_data()
238 step_data->tod_toa_reflector; in process_step_data()
241 if (context->role == BT_CONN_LE_CS_ROLE_INITIATOR) { in process_step_data()
242 mode_1_data[context->mode_1_data_index].tod_toa_reflector = in process_step_data()
243 step_data->tod_toa_reflector; in process_step_data()
244 } else if (context->role == BT_CONN_LE_CS_ROLE_REFLECTOR) { in process_step_data()
245 mode_1_data[context->mode_1_data_index].toa_tod_initiator = in process_step_data()
246 step_data->toa_tod_initiator; in process_step_data()
250 context->mode_1_data_index++; in process_step_data()
257 uint16_t peer_steps_len, uint8_t n_ap, enum bt_conn_le_cs_role role) in estimate_distance() argument
266 .role = role, in estimate_distance()
297 printk("- Round-Trip Timing method: %f meters (derived from %d samples)\n", in estimate_distance()
301 printk("- Phase-Based Ranging method: %f meters (derived from %d samples)\n", in estimate_distance()