| 120 | } |
| 121 | |
| 122 | void MuseBLED::read_thread () |
| 123 | { |
| 124 | int num_attempts = 0; |
| 125 | int sleep_time = 10; |
| 126 | int max_attempts = params.timeout * 1000 / sleep_time; |
| 127 | |
| 128 | int (*func_default) (void *) = (int (*) (void *))dll_loader->get_address ("get_data_default"); |
| 129 | if (func_default == NULL) |
| 130 | { |
| 131 | safe_logger (spdlog::level::err, "failed to get function address for get_data_default"); |
| 132 | state = (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 133 | return; |
| 134 | } |
| 135 | int (*func_aux) (void *) = (int (*) (void *))dll_loader->get_address ("get_data_aux"); |
| 136 | if (func_aux == NULL) |
| 137 | { |
| 138 | safe_logger (spdlog::level::err, "failed to get function address for get_data_aux"); |
| 139 | state = (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 140 | return; |
| 141 | } |
| 142 | int (*func_anc) (void *) = (int (*) (void *))dll_loader->get_address ("get_data_anc"); |
| 143 | if (func_anc == NULL) |
| 144 | { |
| 145 | safe_logger (spdlog::level::err, "failed to get function address for get_data_anc"); |
| 146 | state = (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | int num_rows_default = board_descr["default"]["num_rows"]; |
| 151 | double *data_default = new double[num_rows_default]; |
| 152 | if (data_default == NULL) |
| 153 | { |
| 154 | safe_logger (spdlog::level::err, "failed to allocate data"); |
| 155 | state = (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 156 | return; |
| 157 | } |
| 158 | for (int i = 0; i < num_rows_default; i++) |
| 159 | { |
| 160 | data_default[i] = 0.0; |
| 161 | } |
| 162 | |
| 163 | int num_rows_aux = board_descr["auxiliary"]["num_rows"]; |
| 164 | double *data_aux = new double[num_rows_aux]; |
| 165 | if (data_aux == NULL) |
| 166 | { |
| 167 | safe_logger (spdlog::level::err, "failed to allocate data"); |
| 168 | state = (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 169 | return; |
| 170 | } |
| 171 | for (int i = 0; i < num_rows_aux; i++) |
| 172 | { |
| 173 | data_aux[i] = 0.0; |
| 174 | } |
| 175 | |
| 176 | double *data_anc = NULL; |
| 177 | if (board_id != (int)BoardIds::MUSE_2016_BLED_BOARD) |
| 178 | { |
| 179 | int num_rows_anc = board_descr["ancillary"]["num_rows"]; |
nothing calls this directly
no test coverage detected