Exemplo n.º 1
0
/*!
 * \brief MainWindow::do_EPI_ifft
 */
void MainWindow::do_EPI_ifft(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_coord_select->size() != 0){
        bool res = ifft(EPI_coord_ifft, *EPI_coord_select, EPI_min_ifft, EPI_max_ifft);

        if(res){
            //Plot
            plot_EPI_ifft_curve();

            //Min-Max
            double ymin = min(EPI_coord_ifft->coords(YCOORD), EPI_coord_ifft->size());
            double ymax = max(EPI_coord_ifft->coords(YCOORD), EPI_coord_ifft->size());

            //Slider
            EPI_slider_threshold->setRange(ymin * (double)SLIDER_DOUBLE, ymax * (double)SLIDER_DOUBLE);

            //Box
            EPI_box_threshold->setRange(ymin, ymax);
            EPI_box_threshold->setValue((ymin+ymax)/2.);

            //Status
            status_info("");
        }
        else{
            status_error("");
        }
    }
    else{
        status_error("");
    }
}
Exemplo n.º 2
0
/*!
 * \brief MainWindow::plot_EPI_signal_min
 */
void MainWindow::plot_EPI_signal_min(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    int n = EPI_coords[EPI_current_pos]->size();
    if (n > 0){
        double min_signal = min(EPI_coords[EPI_current_pos]->coords(XCOORD), n);
        double max_signal = max(EPI_coords[EPI_current_pos]->coords(XCOORD), n);

        if (EPI_min_signal >= min_signal && EPI_min_signal <= max_signal && EPI_min_signal < EPI_max_signal){
            //Create QVector
            QVector<double> x, y;
            x.append(EPI_min_signal);
            x.append(EPI_min_signal);
            y.append(EPI_plot_signal->yAxis->range().lower);
            y.append(EPI_plot_signal->yAxis->range().upper);

            //Plot
            EPI_plot_signal->graph(1)->setData(x, y);

            plot_EPI_signal_font();
        }
        else{
            status_error("Bad value for EPI min");
        }
    }
    else{
        status_error("No EPI signal curve");
    }
}
void _attitude_read_tuning() {
	uint8_t data[24];
	
	uint8_t length = persist_read(PERSIST_SECTION_ATTITUDE, data, 24);
	if (length == 24) {
		state_x.q_angle = convert_bytes_to_double(data, 0);
		state_x.q_gyro = convert_bytes_to_double(data, 4);
		state_x.r_angle = convert_bytes_to_double(data, 8);

		state_y.q_angle = convert_bytes_to_double(data, 12);
		state_y.q_gyro = convert_bytes_to_double(data, 16);
		state_y.r_angle = convert_bytes_to_double(data, 20);
	} else {
		status_error(STATUS_ERR_ATTITUDE_CHECKSUM);
		_delay_ms(1000);
		status_error(0x00);
		
		state_x.q_angle = 0.001;
		state_x.q_gyro = 0.003;
		state_x.r_angle = 0.03;

		state_y.q_angle = 0.001;
		state_y.q_gyro = 0.003;
		state_y.r_angle = 0.03;
	}
}
Exemplo n.º 4
0
void process_outgoing(struct worker_t *self)
{
	struct pbuf_t *pb;
	int e;
	
	if ((e = rwl_rdlock(&pbuf_global_rwlock))) {
		hlog(LOG_CRIT, "worker: Failed to rdlock pbuf_global_rwlock!");
		exit(1);
	}
	
	while ((pb = *self->pbuf_global_prevp)) {
		//__sync_synchronize();
		/* Some safety checks against bugs and overload conditions */
		if (pb->is_free) {
			hlog(LOG_ERR, "worker %d: process_outgoing got pbuf %d marked free, age %d (now %d t %d)\n%.*s",
				self->id, pb->seqnum, tick - pb->t, tick, pb->t, pb->packet_len-2, pb->data);
			abort(); /* this would be pretty bad, so we crash immediately */
		} else if (pb->t > tick + 2) {
			/* 2-second offset is normal in case of one thread updating tick earlier than another
			 * and a little thread scheduling luck
			 */
			hlog(LOG_ERR, "worker %d: process_outgoing got packet %d from future with t %d > tick %d!\n%.*s",
				self->id, pb->seqnum, pb->t, tick, pb->packet_len-2, pb->data);
			status_error(86400, "packet_drop_future");
		} else if (tick - pb->t > 5) {
			/* this is a bit too old, are we stuck? */
			hlog(LOG_ERR, "worker %d: process_outgoing got packet %d aged %d sec (now %d t %d)\n%.*s",
				self->id, pb->seqnum, tick - pb->t, tick, pb->t, pb->packet_len-2, pb->data);
			status_error(86400, "packet_drop_hang");
		} else {
			process_outgoing_single(self, pb);
		}
		self->last_pbuf_seqnum = pb->seqnum;
		self->pbuf_global_prevp = &pb->next;
	}
	
	while ((pb = *self->pbuf_global_dupe_prevp)) {
		if (pb->is_free) {
			hlog(LOG_ERR, "worker %d: process_outgoing got dupe %d marked free, age %d (now %d t %d)\n%.*s",
				self->id, pb->seqnum, tick - pb->t, tick, pb->t, pb->packet_len-2, pb->data);
			abort();
		} else if (pb->t > tick + 2) {
			hlog(LOG_ERR, "worker: process_outgoing got dupe from future %d with t %d > tick %d!\n%.*s",
				pb->seqnum, pb->t, tick, pb->packet_len-2, pb->data);
		} else if (tick - pb->t > 5) {
			hlog(LOG_ERR, "worker: process_outgoing got dupe %d aged %d sec\n%.*s",
				pb->seqnum, tick - pb->t, pb->packet_len-2, pb->data);
		} else {
			process_outgoing_single(self, pb);
		}
		self->last_pbuf_dupe_seqnum = pb->seqnum;
		self->pbuf_global_dupe_prevp = &pb->next;
	}
	
	if ((e = rwl_rdunlock(&pbuf_global_rwlock))) {
		hlog(LOG_CRIT, "worker: Failed to rdunlock pbuf_global_rwlock!");
		exit(1);
	}
}
Exemplo n.º 5
0
STATIC void
show_target(uint32_t id, iscsid_list_kind_t kind)
{
	iscsid_list_id_t req;
	iscsid_response_t *trsp, *prsp;
	iscsid_get_target_rsp_t *targ;
	iscsid_get_portal_rsp_t *port;
	unsigned i;

	/* get target info */
	req.list_kind = kind;
	req.id.id = id;
	req.id.name[0] = '\0';
	send_request(ISCSID_GET_TARGET_INFO, sizeof(req), &req);

	trsp = get_response(TRUE);
	if (trsp->status) {
		status_error(trsp->status);
	}
	targ = (iscsid_get_target_rsp_t *)(void *)trsp->parameter;

	/* display basic target info */
	printf("%6d", targ->target_id.id);
	if (targ->target_id.name[0]) {
		printf(" [%s]", targ->target_id.name);
	}
	printf(": %s", targ->TargetName);
	if (targ->TargetAlias[0]) {
		printf(" (%s)", targ->TargetAlias);
	}
	printf("\n");

	/* now get and display info on the target's portals */
	for (i = 0; i < targ->num_portals; i++) {
		req.id.id = targ->portal[i];
		send_request(ISCSID_GET_PORTAL_INFO, sizeof(req), &req);
		prsp = get_response(FALSE);
		if (prsp->status) {
			status_error(prsp->status);
		}
		port = (iscsid_get_portal_rsp_t *)(void *)prsp->parameter;

		printf("   %6d", port->portal_id.id);
		if (port->portal_id.name[0]) {
			printf(" [%s]", port->portal_id.name);
		}
		printf(": %s:%d", port->portal.address, port->portal.port);
		if (kind != SEND_TARGETS_LIST) {
			printf(",%d", port->portal.group_tag);
		}
		printf("\n");
		free_response(prsp);
	}
	free_response(trsp);
}
Exemplo n.º 6
0
int
add_portal(int argc, char **argv)
{
	iscsid_add_portal_req_t port;
	iscsid_response_t *rsp;
	iscsid_add_portal_rsp_t *res;

	if (!cl_get_portal(&port, argc, argv)) {
		arg_missing("Portal Address");
	}
	if (!cl_get_id('I', &port.target_id, argc, argv)) {
		arg_missing("Target ID");
	}
	cl_get_symname(port.sym_name, argc, argv);
	check_extra_args(argc, argv);

	send_request(ISCSID_ADD_PORTAL, sizeof(port), &port);
	rsp = get_response(FALSE);

	if (rsp->status) {
		status_error(rsp->status);
	}
	res = (iscsid_add_portal_rsp_t *)(void *)rsp->parameter;

	printf("Added Portal %d to Target %d\n",
		res->portal_id.id, res->target_id.id);
	free_response(rsp);
	return 0;
}
Exemplo n.º 7
0
int
add_isns_server(int argc, char **argv)
{
	iscsid_add_isns_server_req_t arg;
	iscsid_add_isns_server_rsp_t *res;
	iscsid_response_t *rsp;

	memset(&arg, 0x0, sizeof(arg));
	if (!(cl_get_isns(&arg, argc, argv))) {
		arg_missing("Server Address");
	}
	check_extra_args(argc, argv);

	send_request(ISCSID_ADD_ISNS_SERVER, sizeof(arg), &arg);
	rsp = get_response(FALSE);

	if (rsp->status) {
		status_error(rsp->status);
	}
	res = (iscsid_add_isns_server_rsp_t *)(void *)rsp->parameter;

	printf("Added iSNS Server ID %d\n", res->server_id);

	free_response(rsp);
	return 0;
}
Exemplo n.º 8
0
int
remove_isns_server(int argc, char **argv)
{
	iscsid_sym_id_t req;
	iscsid_search_list_req_t srch;
	iscsid_response_t *rsp;

	if (!cl_get_id('I', &req, argc, argv)) {
		if (!cl_get_string('a', (char *)srch.strval, argc, argv)) {
			arg_missing("Server Address");
		}
		check_extra_args(argc, argv);
		srch.search_kind = FIND_ADDRESS;
		srch.list_kind = ISNS_LIST;

		send_request(ISCSID_SEARCH_LIST, sizeof(srch), &srch);
		rsp = get_response(FALSE);
		if (rsp->status) {
			status_error_slist(rsp->status);
		}
		GET_SYM_ID(req.id, rsp->parameter);
		free_response(rsp);
	} else {
		check_extra_args(argc, argv);
	}
	send_request(ISCSID_REMOVE_ISNS_SERVER, sizeof(req), &req);
	rsp = get_response(TRUE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	free_response(rsp);

	printf("OK\n");
	return 0;
}
Exemplo n.º 9
0
int
set_node_name(int argc, char **argv)
{
	iscsid_set_node_name_req_t req;
	iscsid_response_t *rsp;
	uint64_t isid;

	memset(&req, 0x0, sizeof(req));
	if (!cl_get_string('n', (char *)req.InitiatorName, argc, argv)) {
		arg_missing("Initiator Name");
	}
	cl_get_string('A', (char *)req.InitiatorAlias, argc, argv);
	isid = cl_get_longlong('i', argc, argv);
	hton6(req.ISID, isid);

	check_extra_args(argc, argv);

	send_request(ISCSID_SET_NODE_NAME, sizeof(req), &req);

	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	free_response(rsp);

	printf("OK\n");
	return 0;
}
Exemplo n.º 10
0
int
add_initiator(int argc, char **argv)
{
	iscsid_add_initiator_req_t req;
	iscsid_add_initiator_rsp_t *res;
	iscsid_response_t *rsp;

	memset(&req, 0x0, sizeof(req));
	if (!cl_get_string('a', (char *)req.address, argc, argv)) {
		arg_missing("Interface Address");
	}
	cl_get_symname(req.name, argc, argv);
	check_extra_args(argc, argv);

	send_request(ISCSID_ADD_INITIATOR_PORTAL, sizeof(req), &req);
	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	res = (iscsid_add_initiator_rsp_t *)(void *)rsp->parameter;
	printf("Added Initiator Portal %d\n", res->portal_id);

	free_response(rsp);
	return 0;
}
Exemplo n.º 11
0
int
login(int argc, char **argv)
{
	iscsid_login_req_t loginp;
	iscsid_login_rsp_t *res;
	iscsid_response_t *rsp;

	memset(&loginp, 0x0, sizeof(loginp));
	loginp.login_type = (cl_get_opt('m', argc, argv))
						? ISCSI_LOGINTYPE_NOMAP : ISCSI_LOGINTYPE_MAP;

	login_or_add(&loginp, argc, argv);

	send_request(ISCSID_LOGIN, sizeof(loginp), &loginp);

	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	res = (iscsid_login_rsp_t *)(void *)rsp->parameter;
	printf("Created Session %d, Connection %d\n",
		res->session_id.id, res->connection_id.id);

	free_response(rsp);
	return 0;
}
Exemplo n.º 12
0
int
add_connection(int argc, char **argv)
{
	iscsid_login_req_t loginp;
	iscsid_login_rsp_t	*loginrsp;
	iscsid_response_t *rsp;

	memset(&loginp, 0x0, sizeof(loginp));
	loginp.login_type = ISCSI_LOGINTYPE_MAP;
	cl_get_id('I', &loginp.session_id, argc, argv);

	login_or_add(&loginp, argc, argv);

	send_request(ISCSID_ADD_CONNECTION, sizeof(loginp), &loginp);

	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	loginrsp = (iscsid_login_rsp_t *)(void *)(rsp->parameter);
	printf("Added Connection %d\n", loginrsp->connection_id.id);

	free_response(rsp);
	return 0;
}
Exemplo n.º 13
0
void
status_error_slist(unsigned n)
{
	if (n == ISCSI_STATUS_LIST_EMPTY || n == ISCSID_STATUS_LIST_EMPTY)
		n = ISCSI_STATUS_INVALID_ID;
	status_error (n);
}
Exemplo n.º 14
0
int report_error( char *reason, unsigned char *codes ) {
  status_error( codes );
  print_mutex_lock();
  safe_printf(("%s\r\n", reason));
  print_mutex_unlock();
  return 0;
}
Exemplo n.º 15
0
/*!
 * \brief MainWindow::do_EPI_mean
 */
void MainWindow::do_EPI_mean(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_coord_select->size() != 0 && EPI_coord_peaks->size() != 0){
        //Mean
        mean_icp(*EPI_coord_select, *EPI_coord_peaks, EPI_coord_mean, EPI_coord_SD);

        //Print
        double cycle = max(EPI_coord_mean->coords(XCOORD), EPI_coord_mean->size());
        double heartrate = 60./cycle;
        double pmin = min(EPI_coord_mean->coords(YCOORD), EPI_coord_mean->size());
        double pmax = max(EPI_coord_mean->coords(YCOORD), EPI_coord_mean->size());
        double pmean = mean(*EPI_coord_mean, YCOORD);
        double gradp = pmax - pmin;

        EPI_label_cycle->setText(MAINWINDOW_EPI_CC + QString::number(cycle) + UNITY_S);
        EPI_label_heartrate->setText(MAINWINDOW_EPI_HR + QString::number(heartrate) + UNITY_BPM);
        EPI_label_min->setText(MAINWINDOW_EPI_MIN_S + QString::number(pmin) + UNITY_MMHG);
        EPI_label_max->setText(MAINWINDOW_EPI_MAX_S + QString::number(pmax) + UNITY_MMHG);
        EPI_label_mean->setText(MAINWINDOW_EPI_MEAN_S + QString::number(pmean) + UNITY_MMHG);
        EPI_label_gradient->setText(MAINWINDOW_EPI_GRAD_S + QString::number(gradp) + UNITY_MMHG);

        //Plot
        plot_EPI_mean_curve();

        //Status
        status_info("");
    }
    else{
        status_error("");
    }
}
Exemplo n.º 16
0
STATIC int
do_list_targets(int argc, char **argv, iscsid_list_kind_t kind)
{
	iscsid_get_list_req_t lst;
	iscsid_response_t *rsp;
	iscsid_get_list_rsp_t *list;
	unsigned i;

	check_extra_args(argc, argv);

	/* get the list of targets */
	lst.list_kind = kind;
	send_request(ISCSID_GET_LIST, sizeof(lst), &lst);
	rsp = get_response(TRUE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	list = (iscsid_get_list_rsp_t *)(void *)rsp->parameter;

	/* display all targets */
	for (i = 0; i < list->num_entries; i++) {
		show_target(list->id[i], kind);
	}
	free_response(rsp);
	return 0;
}
Exemplo n.º 17
0
/*!
 * \brief MainWindow::do_EPI_fourier
 */
void MainWindow::do_EPI_fourier(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_coord_select->size() != 0){
        //Fourier
        bool res = fourier(EPI_coord_fourier, *EPI_coord_select);

        if (res){
            //Min-Max
            int xmin = (int)EPI_coord_fourier->coord(0, XCOORD);
            int xmax = (int)EPI_coord_fourier->coord(EPI_coord_fourier->size()-1, XCOORD);

            //Sliders
            EPI_slider_min_fourier->setRange(xmin, xmax);
            EPI_slider_max_fourier->setRange(xmin, xmax);

            //Boxes
            EPI_box_min_fourier->setRange(xmin, xmax);
            EPI_box_max_fourier->setRange(xmin, xmax);

            EPI_box_min_fourier->setValue(xmax*EPI_coeff_fourier_min);
            EPI_box_max_fourier->setValue(xmax*EPI_coeff_fourier_max);

            //Plot
            plot_EPI_fourier_curve();

            //Sliders
            EPI_slider_min_ifft->setRange(1, xmax*EPI_coeff_fourier_max);
            EPI_slider_max_ifft->setRange(1, xmax*EPI_coeff_fourier_max);

            //Boxes
            EPI_box_min_ifft->setRange(1, xmax*EPI_coeff_fourier_max);
            EPI_box_max_ifft->setRange(1, xmax*EPI_coeff_fourier_max);
            EPI_box_min_ifft->setValue(xmax*EPI_coeff_ifft_min);
            EPI_box_max_ifft->setValue(xmax*EPI_coeff_ifft_max);

            //Status
            status_info("");
        }
        else{
            status_error("");
        }
    }
    else{
        status_error("");
    }
}
Exemplo n.º 18
0
/*!
 * \brief MainWindow::do_EPI_save
 */
void MainWindow::do_EPI_save(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_coord_mean->size() != 0 && EPI_coord_SD->size() != 0){
        QString file_name = current_dir + "/" + "EPI__processed_"+EPI_box_select_signal->currentText()+".dat";

        if (!file_name.isEmpty()){
            //Save
            bool res = save_data(file_name, EPI_coord_mean, EPI_coord_SD);

            if (!res){
                    status_error("");
            }
            else{
                int n = EPI_DATA_LENGHT;
                string *string_list1 = new string[n];
                string *string_list2 = new string[n];

                string_list1[0] = EPI_DATA_ITEM01;  string_list2[0] = "";
                string_list1[1] = EPI_DATA_ITEM02;  string_list2[1] = "";
                string_list1[2] = EPI_DATA_ITEM03;  string_list2[2] = "";
                string_list1[3] = EPI_DATA_ITEM04;  string_list2[3] = "";
                string_list1[4] = EPI_DATA_ITEM05;  string_list2[4] = "";
                string_list1[5] = EPI_DATA_ITEM06;  string_list2[5] = "";
                string_list1[6] = EPI_DATA_ITEM07;  string_list2[6] = "";
                string_list1[7] = EPI_DATA_ITEM08;  string_list2[7] = "";
                string_list1[8] = EPI_DATA_ITEM09;  string_list2[8] = "";
                string_list1[9] = EPI_DATA_ITEM10;  string_list2[9] = "";

                file_name.remove(".dat");
                file_name.append("__data.dat");
                res = save_sup_data(file_name, string_list1, string_list2, n);
                delete[] string_list1;
                delete[] string_list2;
            }
        }
        else{
            status_error("");
        }
    }
    else{
        status_error("");
    }
}
Exemplo n.º 19
0
int
list_initiators(int argc, char **argv)
{
	iscsid_get_list_req_t lst;
	iscsid_response_t *rsp, *prsp;
	iscsid_get_list_rsp_t *list;
	iscsid_get_initiator_rsp_t *init;
	iscsid_sym_id_t req;
	unsigned i;

	memset(&req, 0x0, sizeof(req));
	check_extra_args(argc, argv);

	/* get the list of servers */
	lst.list_kind = INITIATOR_LIST;
	send_request(ISCSID_GET_LIST, sizeof(lst), &lst);
	rsp = get_response(TRUE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	list = (iscsid_get_list_rsp_t *)(void *)rsp->parameter;

	/* display all servers */
	for (i = 0; i < list->num_entries; i++) {
		req.id = list->id[i];
		send_request(ISCSID_GET_INITIATOR_PORTAL, sizeof(req), &req);
		prsp = get_response(FALSE);
		if (prsp->status) {
			status_error(prsp->status);
		}
		init = (iscsid_get_initiator_rsp_t *)(void *)prsp->parameter;
		printf("%6d", init->portal_id.id);
		if (init->portal_id.name[0]) {
			printf("[%s]", init->portal_id.name);
		}
		printf(": %s\n", init->address);
		free_response(prsp);
	}
	free_response(rsp);
	return 0;
}
Exemplo n.º 20
0
int parse_error (parse_code_t pcode, int lineno, const char *filename,
		 char *line)
{
  if (pcode == parse_syserr) {
    if (errno != EEXIST && errno != ENOENT)
      perror (_("System error"));
    return -1;
  } else {
    status_error (_("=== Parse error: %s on line %d of %s (%s)\n"), 
		  parse_error_string(pcode), 
		  lineno, filename, line);
    return 0;
  }
}
Exemplo n.º 21
0
int
list_isns_servers(int argc, char **argv)
{
	iscsid_get_list_req_t lst;
	iscsid_response_t *rsp, *prsp;
	iscsid_get_list_rsp_t *list;
	iscsid_get_isns_server_rsp_t *isns;
	iscsid_sym_id_t req;
	unsigned i;

	memset(&req, 0x0, sizeof(req));
	check_extra_args(argc, argv);

	/* get the list of servers */
	lst.list_kind = ISNS_LIST;
	send_request(ISCSID_GET_LIST, sizeof(lst), &lst);
	rsp = get_response(TRUE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	list = (iscsid_get_list_rsp_t *)(void *)rsp->parameter;

	/* display all servers */
	for (i = 0; i < list->num_entries; i++) {
		req.id = list->id[i];
		send_request(ISCSID_GET_ISNS_SERVER, sizeof(req), &req);
		prsp = get_response(FALSE);
		if (prsp->status)
			status_error(prsp->status);

		isns = (iscsid_get_isns_server_rsp_t *)(void *)prsp->parameter;
		printf("%6d: %s\n", list->id[i], isns->address);
		free_response(prsp);
	}
	free_response(rsp);
	return 0;
}
Exemplo n.º 22
0
STATIC int
do_refresh(int argc, char **argv, iscsid_list_kind_t kind)
{
	iscsid_sym_id_t id;
	iscsid_response_t *rsp;
	iscsid_refresh_req_t req;

	req.kind = kind;

	if (cl_get_id('I', &id, argc, argv)) {
		check_extra_args(argc, argv);

		if (!id.id) {
			iscsid_search_list_req_t srch;

			srch.search_kind = FIND_NAME;
			srch.list_kind = kind;
			strlcpy((char *)srch.strval, (char *)id.name,
				sizeof(srch.strval));

			send_request(ISCSID_SEARCH_LIST, sizeof(srch), &srch);
			rsp = get_response(FALSE);
			if (rsp->status) {
				status_error_slist(rsp->status);
			}
			GET_SYM_ID(req.id[0], rsp->parameter);
			free_response(rsp);
		} else {
			req.id[0] = id.id;
		}
		req.num_ids = 1;
	} else {
		req.num_ids = 0;
		check_extra_args(argc, argv);
	}

	req.kind = kind;
	send_request(ISCSID_REFRESH_TARGETS, sizeof(req), &req);

	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	printf("OK\n");
	free_response(rsp);
	return 0;
}
Exemplo n.º 23
0
/*!
 * \brief MainWindow::do_EPI_peaks
 */
void MainWindow::do_EPI_peaks(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_coord_ifft->size() != 0){
        //Peaks detection
        detect_peaks(*EPI_coord_ifft, EPI_coord_peaks, EPI_threshold);

        //Plot
        plot_EPI_peaks();

        //Status
        status_info("");
    }
    else{
        status_error("");
    }
}
Exemplo n.º 24
0
/*!
 * \brief MainWindow::do_EPI_adjust
 */
void MainWindow::do_EPI_adjust(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_coord_mean->size() != 0 && EPI_coord_SD->size() != 0){
        //Adjust
        adjust(EPI_coord_mean, EPI_coord_SD, EPI_box_adjust->currentText().toLower().toStdString());

        //Plot
        plot_EPI_mean_curve();

        //Status
        status_info("");
    }
    else{
        status_error("");
    }
}
Exemplo n.º 25
0
/*!
 * \brief MainWindow::do_EPI_normalize
 */
void MainWindow::do_EPI_normalize(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_coord_mean->size() != 0 && EPI_coord_SD->size() != 0){
        //Normalize
        normalize(EPI_coord_mean, EPI_coord_SD);

        //Plot
        plot_EPI_mean_curve();

        //Status
        status_info("");
    }
    else{
        status_error("");
    }
}
Exemplo n.º 26
0
int
/*ARGSUSED*/
get_version(int argc, char **argv)
{
	iscsid_response_t *rsp;
	iscsid_get_version_rsp_t *ver;

	send_request(ISCSID_GET_VERSION, 0, NULL);
	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	ver = (iscsid_get_version_rsp_t *)(void *)rsp->parameter;
	printf("%s\n%s\n%s\n", VERSION_STRING, ver->version_string,
		   ver->driver_version_string);

	return 0;
}
Exemplo n.º 27
0
/*!
 * \brief MainWindow::plot_EPI_signal_curve
 * \param pos
 */
void MainWindow::plot_EPI_signal_curve(int pos){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    clear_EPI();

    if (EPI_box_select_signal->count() > 0){
        EPI_current_pos = pos;

        //Data
        int n = EPI_coords[pos]->size();

        if (n > 0){
            //Convert Coord to QVector
            QVector<double> x, y;
            for (int i = 0; i < n; i++){
                x.append(EPI_coords[pos]->coord(i, XCOORD));
                y.append(EPI_coords[pos]->coord(i, YCOORD));
            }

            //Plot
            EPI_plot_signal->graph(0)->setData(x, y);
            EPI_plot_signal->xAxis->setRange(min(x), max(x));
            EPI_plot_signal->yAxis->setRange(min(y), max(y));

            EPI_plot_signal->replot();

            //Slider
            double xmin = min(x);
            double xmax = max(x);
            EPI_slider_min_signal->setRange(xmin, xmax);
            EPI_slider_max_signal->setRange(xmin, xmax);

            //Boxes
            EPI_box_min_signal->setRange(xmin, xmax);
            EPI_box_max_signal->setRange(xmin, xmax);
            EPI_box_min_signal->setValue(xmin);
            EPI_box_max_signal->setValue(xmax);
        }
        else{
            status_error("No EPI signal curve to plot");
        }
    }
}
Exemplo n.º 28
0
int
logout(int argc, char **argv)
{
	iscsid_sym_id_t req;
	iscsid_response_t *rsp;

	if (!cl_get_id('I', &req, argc, argv)) {
		arg_missing("Session");
	}
	check_extra_args(argc, argv);

	send_request(ISCSID_LOGOUT, sizeof(req), &req);
	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	free_response(rsp);

	printf("OK\n");
	return 0;
}
Exemplo n.º 29
0
int
remove_initiator(int argc, char **argv)
{
	iscsid_sym_id_t req;
	iscsid_response_t *rsp;

	memset(&req, 0x0, sizeof(req));
	if (!cl_get_id('I', &req, argc, argv)) {
		arg_missing("Initiator Portal ID");
	}
	check_extra_args(argc, argv);

	send_request(ISCSID_REMOVE_INITIATOR_PORTAL, sizeof(req), &req);
	rsp = get_response(FALSE);
	if (rsp->status) {
		status_error(rsp->status);
	}
	free_response(rsp);

	printf("OK\n");
	return 0;
}
Exemplo n.º 30
0
/*!
 * \brief MainWindow::plot_EPI_select_curve
 */
void MainWindow::plot_EPI_select_curve(){
    if (DEBUG) cout << Q_FUNC_INFO << endl;

    if (EPI_min_signal < EPI_max_signal){
        //Extract selection
        int n = EPI_coords[EPI_current_pos]->size();
        int n_min = 0, n_max = n;
        for (int i = 0; i < n; i++){
            if (EPI_coords[EPI_current_pos]->coord(i,XCOORD) < EPI_min_signal){
                n_min = i;
            }
            if (EPI_coords[EPI_current_pos]->coord(i, XCOORD) >= EPI_max_signal){
                n_max = i;
                break;
            }
        }

        //Create QVector and Coord
        EPI_coord_select->set_size(n_max-n_min);
        QVector<double> x, y;
        for (int i = n_min; i < n_max; i++){
            double x_val = EPI_coords[EPI_current_pos]->coord(i, XCOORD);
            double y_val = EPI_coords[EPI_current_pos]->coord(i, YCOORD);
            x.append(x_val);
            y.append(y_val);
            EPI_coord_select->set_coord(x_val, i-n_min, XCOORD);
            EPI_coord_select->set_coord(y_val, i-n_min, YCOORD);
        }

        //Plot
        EPI_plot_select->graph(0)->setData(x, y);
        EPI_plot_select->xAxis->setRange(min(x), max(x));
        EPI_plot_select->yAxis->setRange(min(y), max(y));
        EPI_plot_select->replot();
    }
    else{
        status_error("");
    }
}