@@ -100,6 +100,9 @@ static void aoxpc_configuration_handler_parse_config(const char *config)
100100 aoa_cte_type_t cte_mode ;
101101 struct sl_rtl_loc_locator_item item ;
102102 CoordinateAndOrientation position = {};
103+ uint8_t * antenna_switch_pattern = NULL ;
104+ uint8_t antenna_switch_pattern_size = 0 ;
105+ enum sl_rtl_aox_array_type antenna_array_type ;
103106
104107#ifdef AOA_ANGLE
105108 float mask_min = 0 ;
@@ -154,33 +157,45 @@ static void aoxpc_configuration_handler_parse_config(const char *config)
154157 aox_mode_string [angle_config -> aox_mode ]);
155158 // TBD: AoX Mode is not supported in MQTT; do nothing?
156159 }
160+ #endif
157161
158- sc = aoa_parse_antenna_mode (& angle_config -> array_type , locator_unid );
162+ sc = aoa_parse_antenna_mode (& antenna_array_type , locator_unid );
159163 if (sc == SL_STATUS_OK ) {
160164 sl_log_info (LOG_TAG ,
161165 "Antenna mode set to: %s" ,
162- antenna_type_string [angle_config -> array_type ]);
166+ antenna_type_string [antenna_array_type ]);
163167 // TBD: Antenna Mode is not supported in MQTT; do nothing?
164- }
168+ #ifdef AOA_ANGLE
169+ sc = antenna_array_init (& angle_config -> antenna_array , antenna_array_type );
170+ if (sc != SL_STATUS_OK ) {
171+ sl_log_error (LOG_TAG ,
172+ "antenna_array_init failed for %s" ,
173+ antenna_type_string [antenna_array_type ]);
174+ }
165175#endif
176+ }
166177
167- sc = aoa_parse_antenna_array (& aoa_cte_config . switching_pattern ,
168- & aoa_cte_config . switching_pattern_length ,
178+ sc = aoa_parse_antenna_array (& antenna_switch_pattern ,
179+ & antenna_switch_pattern_size ,
169180 locator_unid );
170181
171182 if (sc == SL_STATUS_OK ) {
172- #ifdef AOA_ANGLE
173- sc = aoa_parse_antenna_array (& angle_config -> switching_pattern ,
174- & angle_config -> switching_pattern_length ,
175- locator_unid );
176- #endif
177- if (sc == SL_STATUS_OK ) {
178- sl_log_info (LOG_TAG , "Antenna array set to: " );
179- for (uint8_t i = 0 ; i < aoa_cte_config .switching_pattern_length ; i ++ ) {
180- sl_log_info (LOG_TAG , "%d," , aoa_cte_config .switching_pattern [i ]);
181- }
182- // TBD: Antenna array is not supported in MQTT; do nothing?
183+ sl_log_info (LOG_TAG , "Antenna array set to: " );
184+ for (uint8_t i = 0 ; i < antenna_switch_pattern_size ; i ++ ) {
185+ sl_log_info (LOG_TAG , "%d," , antenna_switch_pattern [i ]);
183186 }
187+ // TBD: Antenna array is not supported in MQTT; do nothing?
188+ #ifdef ANGLE
189+ sc = antenna_array_set_pattern (& angle_config -> antenna_array ,
190+ antenna_switch_pattern ,
191+ antenna_switch_pattern_size );
192+ if (sc != SL_STATUS_OK ) {
193+ sl_log_error (LOG_TAG ,
194+ "antenna_array_set_pattern failed with size %d" ,
195+ antenna_switch_pattern_size );
196+ }
197+ #endif
198+ free (antenna_switch_pattern );
184199 }
185200
186201#ifdef AOA_ANGLE
@@ -201,16 +216,6 @@ static void aoxpc_configuration_handler_parse_config(const char *config)
201216 // TBD: Angle filtering weight is not supported in MQTT; do nothing?
202217 }
203218
204- sc = aoa_parse_simple_config (& angle_config -> period_samples ,
205- "periodSamples" ,
206- locator_unid );
207- if (sc == SL_STATUS_OK ) {
208- sl_log_info (LOG_TAG ,
209- "Sample period set to: %d" ,
210- angle_config -> period_samples );
211- // TBD: Sample period is not supported in MQTT; do nothing?
212- }
213-
214219 sc = aoa_parse_simple_config (& angle_config -> angle_correction_timeout ,
215220 "angleCorrectionTimeout" ,
216221 locator_unid );
0 commit comments