Lines 136-148
void kis_gps_gpsd_v3::close_impl() {
Link Here
|
136 |
} |
136 |
} |
137 |
|
137 |
|
138 |
void kis_gps_gpsd_v3::start_connect(const boost::system::error_code& error, |
138 |
void kis_gps_gpsd_v3::start_connect(const boost::system::error_code& error, |
139 |
tcp::resolver::iterator endpoints) { |
139 |
tcp::resolver::results_type endpoints) { |
140 |
|
140 |
|
141 |
if (error) { |
141 |
if (error) { |
142 |
_MSG_ERROR("(GPS) Could not resolve gpsd address {}:{} - {}", host, port, error.message()); |
142 |
_MSG_ERROR("(GPS) Could not resolve gpsd address {}:{} - {}", host, port, error.message()); |
143 |
stopped = true; |
143 |
stopped = true; |
144 |
set_int_device_connected(false); |
144 |
set_int_device_connected(false); |
145 |
} else if (endpoints == tcp::resolver::iterator()) { |
145 |
} else if (endpoints.empty()) { |
146 |
_MSG_ERROR("(GPS) Could not connect to gpsd {}:{}", host, port); |
146 |
_MSG_ERROR("(GPS) Could not connect to gpsd {}:{}", host, port); |
147 |
stopped = true; |
147 |
stopped = true; |
148 |
set_int_device_connected(false); |
148 |
set_int_device_connected(false); |
Lines 150-179
void kis_gps_gpsd_v3::start_connect(cons
Link Here
|
150 |
boost::asio::async_connect(socket, endpoints, |
150 |
boost::asio::async_connect(socket, endpoints, |
151 |
boost::asio::bind_executor(strand_, |
151 |
boost::asio::bind_executor(strand_, |
152 |
[self = shared_from_this()](const boost::system::error_code& ec, |
152 |
[self = shared_from_this()](const boost::system::error_code& ec, |
153 |
tcp::resolver::iterator endpoint) { |
153 |
tcp::resolver::results_type::endpoint_type endpoint) { |
154 |
self->handle_connect(ec, endpoint); |
154 |
self->handle_connect(ec, endpoint); |
155 |
})); |
155 |
})); |
156 |
} |
156 |
} |
157 |
} |
157 |
} |
158 |
|
158 |
|
159 |
void kis_gps_gpsd_v3::handle_connect(const boost::system::error_code& error, |
159 |
void kis_gps_gpsd_v3::handle_connect(const boost::system::error_code& error, |
160 |
tcp::resolver::iterator endpoint) { |
160 |
tcp::resolver::results_type::endpoint_type endpoint) { |
161 |
|
161 |
|
162 |
if (stopped) { |
162 |
if (stopped) { |
163 |
return; |
163 |
return; |
164 |
} |
164 |
} |
165 |
|
165 |
|
166 |
if (error) { |
166 |
if (error) { |
167 |
if (endpoint == tcp::resolver::iterator()) |
167 |
if (endpoint == tcp::resolver::results_type::endpoint_type()) |
168 |
_MSG_ERROR("(GPS) Could not connect to gpsd {}:{} - {}", host, port, error.message()); |
168 |
_MSG_ERROR("(GPS) Could not connect to gpsd {}:{} - {}", host, port, error.message()); |
169 |
else |
169 |
else |
170 |
_MSG_ERROR("(GPS) Could not connect to gpsd {} - {}", endpoint->endpoint(), error.message()); |
170 |
_MSG_ERROR("(GPS) Could not connect to gpsd {} - {}", endpoint.address().to_string(), endpoint.port(), error.message()); |
171 |
|
171 |
|
172 |
handle_error(); |
172 |
handle_error(); |
173 |
return; |
173 |
return; |
174 |
} |
174 |
} |
175 |
|
175 |
|
176 |
_MSG_INFO("(GPS) Connected to gpsd server {}", endpoint->endpoint()); |
176 |
_MSG_INFO("(GPS) Connected to gpsd server {}", endpoint.address().to_string(), endpoint.port()); |
177 |
|
177 |
|
178 |
stopped = false; |
178 |
stopped = false; |
179 |
set_int_device_connected(true); |
179 |
set_int_device_connected(true); |
Lines 728-737
bool kis_gps_gpsd_v3::open_gps(std::stri
Link Here
|
728 |
|
728 |
|
729 |
lk.unlock(); |
729 |
lk.unlock(); |
730 |
|
730 |
|
731 |
resolver.async_resolve(tcp::resolver::query(host.c_str(), port.c_str()), |
731 |
resolver.async_resolve(host, port, |
732 |
boost::asio::bind_executor(strand_, |
732 |
boost::asio::bind_executor(strand_, |
733 |
[self = shared_from_this()](const boost::system::error_code& error, tcp::resolver::iterator endp) { |
733 |
[self = shared_from_this()](const boost::system::error_code& error, tcp::resolver::results_type results) { |
734 |
self->start_connect(error, endp); |
734 |
self->start_connect(error, results); |
735 |
})); |
735 |
})); |
736 |
|
736 |
|
737 |
return 1; |
737 |
return 1; |