-
-
-static int nma_send_req(const struct sr_dev_inst *sdi, enum nmadmm_req_t req,
- char* params)
-{
- struct sr_serial_dev_inst *serial;
- struct dev_context *devc;
- char buf[NMADMM_BUFSIZE];
- int len;
-
-
- if (!sdi || !(serial = sdi->conn) || !(devc = sdi->priv))
- return SR_ERR_BUG;
-
- len = snprintf(buf, sizeof(buf), "%s%s\r\n",
- nmadmm_requests[req].reqstr, params?params:"");
-
- sr_spew("Sending request: '%s'", buf);
-
- devc->last_req = req;
- devc->last_req_pending = TRUE;
-
- if (serial_write(serial, buf, len) == -1) {
- sr_err("Unable to send request: %d %s.",
- errno, strerror(errno));
- devc->last_req_pending = FALSE;
- return SR_ERR;
- }
-
- return SR_OK;
-}
-
-
-SR_PRIV const struct nmadmm_req nmadmm_requests[] = {
- { NMADMM_REQ_IDN, "IDN?"},
- { NMADMM_REQ_IDN, "STATUS?"},
- { 0, NULL }
-};