* \brief Force flush of rig communication data buffers. * \param port communication port * \param flush_async_data Flushes also asynchronous I/O pipes if non-zero. * \return status code * * This function should be used only in special cases like after handling raw command data from Hamlib clients. * When asynchronous I/O is enabled, responses to raw commands may disrupt processing of all co
| 2259 | * because the responses and up in the async I/O pipes. |
| 2260 | */ |
| 2261 | int HAMLIB_API rig_flush_force(hamlib_port_t *port, int flush_async_data) |
| 2262 | { |
| 2263 | if (port->type.rig == RIG_PORT_NONE) |
| 2264 | { |
| 2265 | return RIG_OK; |
| 2266 | } |
| 2267 | |
| 2268 | // Flush also the async I/O pipes |
| 2269 | if (port->asyncio && flush_async_data) |
| 2270 | { |
| 2271 | port_flush_sync_pipes(port); |
| 2272 | } |
| 2273 | |
| 2274 | #ifndef RIG_FLUSH_REMOVE |
| 2275 | // rig_debug(RIG_DEBUG_TRACE, "%s: called for %s device\n", __func__, |
| 2276 | // port->type.rig == RIG_PORT_SERIAL ? "serial" : "network"); |
| 2277 | |
| 2278 | if (port->type.rig == RIG_PORT_NETWORK |
| 2279 | || port->type.rig == RIG_PORT_UDP_NETWORK) |
| 2280 | { |
| 2281 | network_flush(port); |
| 2282 | return RIG_OK; |
| 2283 | } |
| 2284 | |
| 2285 | if (port->type.rig != RIG_PORT_SERIAL) |
| 2286 | { |
| 2287 | rig_debug(RIG_DEBUG_WARN, |
| 2288 | "%s: Expected serial port type!!\nWhat is this rig?\n", __func__); |
| 2289 | } |
| 2290 | |
| 2291 | return serial_flush(port); // we must be on serial port |
| 2292 | #else |
| 2293 | return RIG_OK; |
| 2294 | #endif |
| 2295 | } |
| 2296 | |
| 2297 | int HAMLIB_API rig_flush(hamlib_port_t *port) |
| 2298 | { |
no test coverage detected