Muse-IO C++ - Receiving multiple Data Packets at once


#1

Hi,

I have downloaded the Windows Muse SDK and have looked at the sample code for ‘GettingData’.

I want to, at any given time, receive multiple data packets for metrics such as alpha, beta, gamma, theta, delta (relative and absolute) as well as artifact packets.

Am I right in thinking you need to have multiple data listeners for each data type you’re interested in? And then have separate instances of the DataModel class for each metric to store the packet data? E.g.

my_muse_->register_data_listener(data_listener_alpha_, MuseDataPacketType::ALPHA_RELATIVE);
my_muse_->register_data_listener(data_listener_beta_, MuseDataPacketType::BETA_RELATIVE);
my_muse_->register_data_listener(data_listener_gamma_,MuseDataPacketType::GAMMA_RELATIVE);

void SessionPage::receive_muse_data_packet(const std::shared_ptr & packet, const std::shared_ptr & muse) {
if (packet->packet_type() == MuseDataPacketType::ALPHA_RELATIVE) {
OutputDebugString(L"MainPage::receive_muse_data_packet - ALPHA\n");
model_Alpha.set_values(packet);
}
else if (packet->packet_type() == MuseDataPacketType::BETA_RELATIVE) {
OutputDebugString(L"MainPage::receive_muse_data_packet - BETA\n");
model_Beta.set_values(packet);
}
else {
OutputDebugString(L"MainPage::receive_muse_data_packet - GAMMA\n");
model_Gamma.set_values(packet);
}
}

Essentially I would like to have it so my application can append a bunch of metrics to a CSV file for every second the Muse is running.

Thank you in advance.

-Dom


#2

You can setup a single listener then switch on the data packet type when you receive it.