* write_transaction * Assumes rig!=NULL, xml!=NULL, xml_len=total size of xml for response */
| 214 | * Assumes rig!=NULL, xml!=NULL, xml_len=total size of xml for response |
| 215 | */ |
| 216 | static int write_transaction(RIG *rig, char *xml, int xml_len) |
| 217 | { |
| 218 | |
| 219 | int try = rig->caps->retry; |
| 220 | |
| 221 | int retval = -RIG_EPROTO; |
| 222 | hamlib_port_t *rp = RIGPORT(rig); |
| 223 | |
| 224 | ENTERFUNC; |
| 225 | |
| 226 | // This shouldn't ever happen...but just in case |
| 227 | // We need to avoid an empty write as rigctld replies with blank line |
| 228 | if (xml_len == 0) |
| 229 | { |
| 230 | rig_debug(RIG_DEBUG_ERR, "%s: len==0??\n", __func__); |
| 231 | RETURNFUNC(retval); |
| 232 | } |
| 233 | |
| 234 | // appears we can lose sync if we don't clear things out |
| 235 | // shouldn't be anything for us now anyways |
| 236 | rig_flush(rp); |
| 237 | |
| 238 | while (try-- >= 0 && retval != RIG_OK) |
| 239 | { |
| 240 | retval = write_block(rp, (unsigned char *) xml, strlen(xml)); |
| 241 | |
| 242 | if (retval < 0) |
| 243 | { |
| 244 | RETURNFUNC(-RIG_EIO); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | RETURNFUNC(retval); |
| 249 | } |
| 250 | |
| 251 | static int aclog_transaction(RIG *rig, char *cmd, char *value, |
| 252 | int value_len) |
no test coverage detected