コード例 #1
0
ファイル: rrw_server.c プロジェクト: isuvalov/fftsender_new
int srv_handle_meas_ctl_req(srv_t *srv) {
  meas_ctl_req_t *req = (meas_ctl_req_t *)srv->req;

  if(srv->test_mode) {
    srv_update_status(srv);
    return RRW_RV_BUSY;
  }
  
  switch(req->mode) {
  case RRW_MEAS_ON_REQ:
    if(rcli_meas_mode(srv->rcli)==MEAS_MODE_CYCLE) {
      rcli_en_onreq_mode(srv->rcli);
    }
    rcli_set_cycle_dly(srv->rcli,req->cycle_dly);
    rcli_set_cycle_dur(srv->rcli,req->cycle_dur);
    break;
  case RRW_MEAS_CYCLE:
    if(rcli_meas_mode(srv->rcli)==MEAS_MODE_ON_REQ) {
      rcli_set_cycle_dly(srv->rcli,req->cycle_dly);
      rcli_set_cycle_dur(srv->rcli,req->cycle_dur);
      rcli_en_cycle_mode(srv->rcli);
    } else {
      rcli_cycle_stop(srv->rcli);
      rcli_set_cycle_dly(srv->rcli,req->cycle_dly);
      rcli_set_cycle_dur(srv->rcli,req->cycle_dur);      
      rcli_cycle_start(srv->rcli);
    }
    break;
  }
  
  srv_update_status(srv);

  return RRW_RV_SUCCESS;
}
コード例 #2
0
ファイル: rrw_server.c プロジェクト: halecky/fftsender_new
/**Perform measurement control requst related routines*/
int srv_handle_meas_ctl_req(srv_t *srv) {
  meas_ctl_req_t *req = (meas_ctl_req_t *)srv->req;

  switch(req->mode) {
  case RRW_MEAS_ON_REQ:
    //if in cyclic mode switch to on-request mode
    if(rcli_meas_mode(srv->rcli)==MEAS_MODE_CYCLE) {
      rcli_en_onreq_mode(srv->rcli);
    }
//    rcli_set_cycle_dly(srv->rcli,req->cycle_dly);
    rcli_set_cycle_dur(srv->rcli,req->cycle_dur);
    break;
  case RRW_MEAS_CYCLE:
    //if in on-request mode switch to cyclic mode
    if(rcli_meas_mode(srv->rcli)==MEAS_MODE_ON_REQ) {
//      rcli_set_cycle_dly(srv->rcli,req->cycle_dly);
      rcli_set_cycle_dur(srv->rcli,req->cycle_dur);
      rcli_en_cycle_mode(srv->rcli);
    } else {
      rcli_cycle_stop(srv->rcli);
//      rcli_set_cycle_dly(srv->rcli,req->cycle_dly);
      rcli_set_cycle_dur(srv->rcli,req->cycle_dur);
      rcli_cycle_start(srv->rcli);
    }
    break;
  }

  srv_update_status(srv);

  return RRW_RV_SUCCESS;
}
コード例 #3
0
ファイル: rrw_server.c プロジェクト: isuvalov/fftsender_new
void srv_test_mode(srv_t *srv, int ctl) {
  if(ctl) {
    if(rcli_meas_mode(srv->rcli)==MEAS_MODE_CYCLE)
      rcli_cycle_stop(srv->rcli);
    srv->test_mode = 1;
  } else {
    if(rcli_meas_mode(srv->rcli)==MEAS_MODE_CYCLE)
      rcli_cycle_start(srv->rcli);
    srv->test_mode = 0;
  }
  srv_update_status(srv);
}