| 40 | } |
| 41 | |
| 42 | int bluetooth_get_data (char *data, int size, char *mac_addr) |
| 43 | { |
| 44 | if ((data == NULL) || (mac_addr == NULL) || (size < 0)) |
| 45 | { |
| 46 | return (int)SocketBluetoothReturnCodes::PARAMETER_ERROR; |
| 47 | } |
| 48 | |
| 49 | std::lock_guard<std::mutex> lock (mutex); |
| 50 | |
| 51 | std::string key = mac_addr; |
| 52 | auto device_it = devices.find (key); |
| 53 | if (device_it == devices.end ()) |
| 54 | { |
| 55 | return (int)SocketBluetoothReturnCodes::DEVICE_IS_NOT_CREATED_ERROR; |
| 56 | } |
| 57 | return device_it->second->recv (data, size); |
| 58 | } |
| 59 | |
| 60 | int bluetooth_write_data (char *data, int size, char *mac_addr) |
| 61 | { |