| 87 | } |
| 88 | |
| 89 | int BrainBitBLED::call_open () |
| 90 | { |
| 91 | if (dll_loader == NULL) |
| 92 | { |
| 93 | return (int)BrainFlowExitCodes::BOARD_NOT_READY_ERROR; |
| 94 | } |
| 95 | int res = (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 96 | if (use_mac_addr) |
| 97 | { |
| 98 | int (*func) (void *) = (int (*) (void *))dll_loader->get_address ("open_device_mac_addr"); |
| 99 | if (func == NULL) |
| 100 | { |
| 101 | safe_logger ( |
| 102 | spdlog::level::err, "failed to get function address for open_device_mac_addr"); |
| 103 | return (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 104 | } |
| 105 | safe_logger (spdlog::level::info, "search for {}", params.mac_address.c_str ()); |
| 106 | res = func (const_cast<char *> (params.mac_address.c_str ())); |
| 107 | } |
| 108 | else |
| 109 | { |
| 110 | int (*func) (void *) = (int (*) (void *))dll_loader->get_address ("open_device"); |
| 111 | if (func == NULL) |
| 112 | { |
| 113 | safe_logger (spdlog::level::err, "failed to get function address for open_device"); |
| 114 | return (int)BrainFlowExitCodes::GENERAL_ERROR; |
| 115 | } |
| 116 | safe_logger ( |
| 117 | spdlog::level::info, "mac address is not specified, try to find brainbit without it"); |
| 118 | res = func (NULL); |
| 119 | } |
| 120 | return res; |
| 121 | } |
nothing calls this directly
no test coverage detected