| 205 | |
| 206 | |
| 207 | void Callibri::read_thread () |
| 208 | { |
| 209 | int num_rows = board_descr["default"]["num_rows"]; |
| 210 | double *package = new double[num_rows]; |
| 211 | for (int i = 0; i < num_rows; i++) |
| 212 | { |
| 213 | package[i] = 0.0; |
| 214 | } |
| 215 | |
| 216 | while (keep_alive) |
| 217 | { |
| 218 | size_t length = 0; |
| 219 | |
| 220 | do |
| 221 | { |
| 222 | AnyChannel_get_total_length ((AnyChannel *)signal_channel, &length); |
| 223 | } while ((keep_alive) && (length < (counter + 1))); |
| 224 | |
| 225 | // check that inner loop ended not because of stop_stream invocation |
| 226 | if (!keep_alive) |
| 227 | { |
| 228 | break; |
| 229 | } |
| 230 | |
| 231 | double timestamp = get_timestamp (); |
| 232 | size_t stub = 0; |
| 233 | double data = 0; |
| 234 | int sdk_ec = SDK_NO_ERROR; |
| 235 | sdk_ec = |
| 236 | DoubleChannel_read_data ((DoubleChannel *)signal_channel, counter, 1, &data, 1, &stub); |
| 237 | if (sdk_ec != SDK_NO_ERROR) |
| 238 | { |
| 239 | continue; |
| 240 | } |
| 241 | counter++; |
| 242 | |
| 243 | package[board_descr["default"]["package_num_channel"].get<int> ()] = (double)counter; |
| 244 | package[1] = data * 1e6; // hardcode channel num here because there are 3 different types |
| 245 | package[board_descr["default"]["timestamp_channel"].get<int> ()] = timestamp; |
| 246 | push_package (package); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | void Callibri::free_channels () |
| 251 | { |
no test coverage detected