| 58 | } |
| 59 | |
| 60 | int bluetooth_write_data (char *data, int size, char *mac_addr) |
| 61 | { |
| 62 | if ((data == NULL) || (mac_addr == NULL) || (size < 0)) |
| 63 | { |
| 64 | return (int)SocketBluetoothReturnCodes::PARAMETER_ERROR; |
| 65 | } |
| 66 | |
| 67 | std::lock_guard<std::mutex> lock (mutex); |
| 68 | |
| 69 | std::string key = mac_addr; |
| 70 | auto device_it = devices.find (key); |
| 71 | if (device_it == devices.end ()) |
| 72 | { |
| 73 | return (int)SocketBluetoothReturnCodes::DEVICE_IS_NOT_CREATED_ERROR; |
| 74 | } |
| 75 | return device_it->second->send (data, size); |
| 76 | } |
| 77 | |
| 78 | int bluetooth_close_device (char *mac_addr) |
| 79 | { |