@@ -259,6 +259,7 @@ int MuseAthena::prepare_session ()
259259 std::this_thread::sleep_for (std::chrono::seconds (1 ));
260260
261261 bool control_characteristics_found = false ;
262+ bool data_characteristics_notified = false ;
262263
263264 if (res == (int )BrainFlowExitCodes::STATUS_OK )
264265 {
@@ -301,25 +302,37 @@ int MuseAthena::prepare_session ()
301302 }
302303 }
303304
304- if ((strcmp (service.characteristics [j].uuid .value , MUSE_ATHENA_GATT_DATA_1 ) ==
305- 0 ) ||
306- (strcmp (service.characteristics [j].uuid .value , MUSE_ATHENA_GATT_DATA_2 ) == 0 ))
305+ bool is_data_1 =
306+ strcmp (service.characteristics [j].uuid .value , MUSE_ATHENA_GATT_DATA_1 ) == 0 ;
307+ bool is_data_2 =
308+ strcmp (service.characteristics [j].uuid .value , MUSE_ATHENA_GATT_DATA_2 ) == 0 ;
309+ if (is_data_1 || is_data_2)
307310 {
308- // Athena multiplexes EEG, IMU, optics, and battery packets across data
309- // characteristics; use one parser intentionally and route by packet tag.
311+ // Athena multiplexes EEG, IMU, optics, and battery packets by packet tag.
312+ // LibMuse maps both data characteristics, but not all firmware exposes both
313+ // as notify-capable.
314+ if (!service.characteristics [j].can_notify )
315+ {
316+ safe_logger (spdlog::level::info,
317+ " Skip MuseAthena data characteristic {} because it does not support "
318+ " notifications" ,
319+ service.characteristics [j].uuid .value );
320+ continue ;
321+ }
310322 if (simpleble_peripheral_notify (muse_peripheral, service.uuid ,
311323 service.characteristics [j].uuid , ::athena_peripheral_on_data,
312324 (void *)this ) == SIMPLEBLE_SUCCESS )
313325 {
314326 notified_characteristics.push_back (
315327 std::pair<simpleble_uuid_t , simpleble_uuid_t > (
316328 service.uuid , service.characteristics [j].uuid ));
329+ data_characteristics_notified = true ;
317330 }
318331 else
319332 {
320- safe_logger (spdlog::level::err, " Failed to notify for {} {}" ,
333+ safe_logger (spdlog::level::warn,
334+ " Failed to notify MuseAthena data characteristic {} {}" ,
321335 service.uuid .value , service.characteristics [j].uuid .value );
322- res = (int )BrainFlowExitCodes::GENERAL_ERROR ;
323336 }
324337 }
325338 }
@@ -331,6 +344,11 @@ int MuseAthena::prepare_session ()
331344 safe_logger (spdlog::level::err, " failed to find control characteristic" );
332345 res = (int )BrainFlowExitCodes::BOARD_NOT_READY_ERROR ;
333346 }
347+ if ((res == (int )BrainFlowExitCodes::STATUS_OK ) && (!data_characteristics_notified))
348+ {
349+ safe_logger (spdlog::level::err, " failed to notify any MuseAthena data characteristic" );
350+ res = (int )BrainFlowExitCodes::GENERAL_ERROR ;
351+ }
334352
335353 if (res == (int )BrainFlowExitCodes::STATUS_OK )
336354 {
0 commit comments