| 220 | } |
| 221 | |
| 222 | int BrainBit::config_board (std::string config, std::string &response) |
| 223 | { |
| 224 | if (device == NULL) |
| 225 | { |
| 226 | return (int)BrainFlowExitCodes::BOARD_NOT_CREATED_ERROR; |
| 227 | } |
| 228 | if (config.empty ()) |
| 229 | { |
| 230 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 231 | } |
| 232 | |
| 233 | Command cmd = CommandStartSignal; |
| 234 | bool parsed = false; |
| 235 | // get Command enum value from value name as char * |
| 236 | // this enum has more values but looks like they are not supported by brainbit board and used by |
| 237 | // other devices |
| 238 | if (strcmp (config.c_str (), "CommandStartSignal") == 0) |
| 239 | { |
| 240 | parsed = true; |
| 241 | cmd = CommandStartSignal; |
| 242 | } |
| 243 | if (strcmp (config.c_str (), "CommandStopSignal") == 0) |
| 244 | { |
| 245 | parsed = true; |
| 246 | cmd = CommandStopSignal; |
| 247 | } |
| 248 | if (strcmp (config.c_str (), "CommandStartResist") == 0) |
| 249 | { |
| 250 | parsed = true; |
| 251 | cmd = CommandStartResist; |
| 252 | } |
| 253 | if (strcmp (config.c_str (), "CommandStopResist") == 0) |
| 254 | { |
| 255 | parsed = true; |
| 256 | cmd = CommandStopResist; |
| 257 | } |
| 258 | |
| 259 | if (!parsed) |
| 260 | { |
| 261 | safe_logger (spdlog::level::err, |
| 262 | "Invalid value for config, Supported values: CommandStartSignal, CommandStopSignal, " |
| 263 | "CommandStartResist, CommandStopResist"); |
| 264 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 265 | } |
| 266 | |
| 267 | int ec = device_execute (device, cmd); |
| 268 | if (ec != SDK_NO_ERROR) |
| 269 | { |
| 270 | char error_msg[1024]; |
| 271 | sdk_last_error_msg (error_msg, 1024); |
| 272 | safe_logger (spdlog::level::err, error_msg); |
| 273 | return (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 274 | } |
| 275 | |
| 276 | return (int)BrainFlowExitCodes::STATUS_OK; |
| 277 | } |
| 278 | |
| 279 | int BrainBit::start_stream (int buffer_size, const char *streamer_params) |