Пример #1
0
static int hero2sub2_event_notify(activity *act, enum im_evnet_category_t e_category, int event, void* value)
{
    if (e_category == EC_RKE) {
        enum update_request_action_t pact = (enum update_request_action_t) event;
        if (pact == UR_RANGE) {
#if 0
            /* If RKE reports correctly, stop demo animation. */
            stopDemoAnimation();
#endif
            setElectricity();
            setFuel();
            setMile();
            update_fully_charge_time();
        }
        else if (pact == UR_CODING) {
            /* Language changed */
            setup_labels();
        }
    } else if (e_category == EC_CHANGE) {
        if ((enum im_change_evnet_t) event == EVENT_CONNECTION_STATUS) {
            update_fully_charge_time();
        }
    }
    return 0;
}
Пример #2
0
static int onStart(activity *act) {
    LOG_DBG("temperature %s\n", __func__);
    getInfoManager()->set_temperature_show_state(true);
    getInfoManager()->register_event_notify(act, EC_RKE, UR_CODING, temperature_screen_event_notify);
    setup_labels();
    return MKD_OK;
}
Пример #3
0
static int onStart(activity *act) {
    LOG_DBG("batterylow %s\n", __func__);
    /* Let informanager know we successfully started the battery low activity. */
    getInfoManager()->set_batterylow_show_state(true);
    //lite_set_window_background(act->window, &Colors.translucentBlack);
    getInfoManager()->register_event_notify(act, EC_RKE, UR_CODING, batterylow_screen_event_notify);
    setup_labels();
    return MKD_OK;
}
Пример #4
0
int temperature_screen_event_notify(activity *act, enum im_evnet_category_t e_category, int event, void* value)
{
    if (e_category == EC_RKE) {
        enum update_request_action_t pact = (enum update_request_action_t) event;
        if (pact == UR_CODING) {
            /* Language changed */
            setup_labels();
        }
    }
}
MainWindow::MainWindow(unsigned dmin, unsigned dmax, decltype(packet_sequences_raw_) packet_sequences_raw, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    packet_sequences_raw_(packet_sequences_raw),
    scheduler_(dmin, dmax)
{
    ui->setupUi(this);

    setup_buttons();
    setup_labels();
    setup_pipelines();

    this->showFullScreen();
}
Пример #6
0
static int onCreate(int mode, activity *act) {
    if( onCreateSanityCheck(act) != MKD_OK ) {
        return MKD_ERR;
    }
    //Start to construct the window
    loadWindow(act);

    //Set event notify
    getInfoManager()->register_event_notify(act, EC_RKE, UR_CBS | UR_CODING, hero3_event_notify);

    setup_labels();
    switch_ui();
    return MKD_OK;
}
Пример #7
0
static int hero3_event_notify(activity *act, enum im_evnet_category_t e_category,
                                    int event, void* value)
{
    assert(e_category == EC_RKE);
    enum update_request_action_t pact = (enum update_request_action_t) event;
    if (pact == UR_CBS) {
        switch_ui();
    }
    else if (pact == UR_CODING) {
        /* Language changed */
        setup_labels();
        switch_ui();
    }
    return 0;
}
Пример #8
0
static int onCreate(int mode, activity *act) {
    if( onCreateSanityCheck(act) != MKD_OK ) {
        return MKD_ERR;
    }
    //Start to construct the window
    loadWindow(act);

    first_icon_initialized = false;
    //Set event notify
    getInfoManager()->register_event_notify(act, EC_RKE, UR_CBS | UR_CODING, hero3_event_notify);

    setup_labels();
    update_cbs_status();
    update_cbs_button();
    lite_on_button_press(serviceButton, servicePressed, act->window);
    return MKD_OK;
}
Пример #9
0
static int hero3_event_notify(activity *act, enum im_evnet_category_t e_category,
                                    int event, void* value)
{
    DFBResult       res;
    assert(e_category == EC_RKE);
    enum update_request_action_t pact = (enum update_request_action_t) event;
    if (pact == UR_CODING) {
        /* Language changed */
        setup_labels();
    }
    else if (pact == UR_CBS) {
        if (update_cbs_status() == true) {
            update_cbs_button();
        }
    }
    return 0;
}
Пример #10
0
static int onCreate(int mode, activity *act) {
    if( onCreateSanityCheck(act) != MKD_OK ) {
        return MKD_ERR;
    }
    //Start to construct the window
    loadWindow(act);

    //Set event notify
    getInfoManager()->register_event_notify(act, EC_RKE, UR_RANGE | UR_CODING, hero2sub2_event_notify);
    getInfoManager()->register_event_notify(act, EC_CHANGE, EVENT_CONNECTION_STATUS, hero2sub2_event_notify);

    setup_labels();
    setElectricity();
    setFuel();
    setMile();
    update_fully_charge_time();
    return MKD_OK;
}
Пример #11
0
void bwtool_matrix(struct hash *options, char *favorites, char *regions, unsigned decimals,
		   double fill, char *range_s, char *bigfile, char *tmp_dir, char *outputfile)
/* bwtool_matrix - main for matrix-creation program */
{
    boolean do_k = (hashFindVal(options, "cluster") != NULL) ? TRUE : FALSE;
    boolean do_tile = (hashFindVal(options, "tiled-averages") != NULL) ? TRUE : FALSE;
    boolean do_binary_matrix = (hashFindVal(options, "binary-matrix") != NULL) ? TRUE : FALSE;
    boolean keep_bed = (hashFindVal(options, "keep-bed") != NULL) ? TRUE : FALSE;
    boolean starts = (hashFindVal(options, "starts") != NULL) ? TRUE : FALSE;
    boolean ends = (hashFindVal(options, "ends") != NULL) ? TRUE : FALSE;
    boolean lf_header = (hashFindVal(options, "long-form-header") != NULL) ? TRUE : FALSE;
    char *centroid_file = (char *)hashFindVal(options, "cluster-centroids");
    char *long_form = (char *)hashFindVal(options, "long-form");
    boolean do_long_form = (long_form != NULL);
    unsigned left = 0, right = 0;
    int meta = 0;
    int num_parse = parse_left_right(range_s, &left, &right, &meta);
    boolean do_meta = (num_parse == 3);
    int k = (int)sqlUnsigned((char *)hashOptionalVal(options, "cluster", "0"));
    int tile = (int)sqlUnsigned((char *)hashOptionalVal(options, "tiled-averages", "1"));
    if ((do_k) && ((k < 2) || (k > 10)))
	errAbort("k should be between 2 and 10\n");
    if ((do_tile) && (tile < 2))
	errAbort("tiling should be done for larger regions");
    if ((left % tile != 0) || (right % tile != 0))
	errAbort("tiling should be multiple of both up and down values");
    if (do_meta && starts && ends)
	warn("meta uses -starts and -ends anyway");
    else if ((do_meta) && (starts || ends))
	warn("-starts and -ends both automatically used with meta");
    if (do_meta && do_tile)
	errAbort("meta not compatible with -tile... yet");
    if (do_binary_matrix && do_long_form)
	errAbort("Writing binary matrix is not compatible with -long-form... yet");
    struct slName *bw_names = slNameListFromComma(bigfile);
    struct slName *bw_name;
    struct slName *labels_from_file = NULL;
    int num_bigwigs = check_for_list_files(&bw_names, &labels_from_file, 0);
    struct slName *labels = setup_labels(long_form, bw_names, &labels_from_file);
    struct bed6 *regs = NULL;
    struct bed6 *regions_left = NULL, *regions_right = NULL, *regions_meta = NULL;
    struct perBaseMatrix *pbm = NULL;
    int i;
    if (do_meta)
    {
	if (meta == -1)
	{
	    meta = calculate_meta_file(regions);
	    fprintf(stderr, "calculated meta = %d bases\n", meta);
	}
	regions_left = load_and_recalculate_coords(regions, left, 0, FALSE, TRUE, FALSE);
	regions_right = load_and_recalculate_coords(regions, 0, right, FALSE, FALSE, TRUE);
	regions_meta = (meta > 0) ? readBed6Soft(regions) : NULL;
    }
    else
	regs = load_and_recalculate_coords(regions, left, right, FALSE, starts, ends);
    for (bw_name = bw_names; bw_name != NULL; bw_name = bw_name->next)
    {
	struct metaBig *mb = metaBigOpenWithTmpDir(bw_name->name, tmp_dir, NULL);
	if (do_meta)
	{
	    struct perBaseMatrix *one_pbm = load_perBaseMatrix(mb, regions_left, fill);
	    struct perBaseMatrix *right_pbm = load_perBaseMatrix(mb, regions_right, fill);
	    if (meta > 0)
	    {
		struct perBaseMatrix *meta_pbm = load_meta_perBaseMatrix(mb, regions_meta, meta, fill);
		fuse_pbm(&one_pbm, &meta_pbm, TRUE);
	    }
	    fuse_pbm(&one_pbm, &right_pbm, TRUE);
	    fuse_pbm(&pbm, &one_pbm, FALSE);
	}
	else
	{
	    struct perBaseMatrix *one_pbm = (do_tile) ? load_ave_perBaseMatrix(mb, regs, tile, fill) :
		load_perBaseMatrix(mb, regs, fill);
	    fuse_pbm(&pbm, &one_pbm, FALSE);
	}
	metaBigClose(&mb);
    }
    if (do_k)
    {
	struct cluster_bed_matrix *cbm = NULL;
	/* ordered by cluster with label in first column */
	cbm = init_cbm_from_pbm(pbm, k);
	do_kmeans_sort(cbm, 0.001, TRUE);
	if (do_long_form)
	{
	    output_cluster_matrix_long(cbm, labels, keep_bed, outputfile, lf_header);
	}
	else
	{
	    if (do_binary_matrix)
	    {
		output_binary_cluster_matrix(cbm, keep_bed, outputfile);
	    }
	    else
	    {
		output_cluster_matrix(cbm, decimals, keep_bed, outputfile);
	    }
	}
	if (centroid_file)
	{
	    output_centroids(cbm, centroid_file, decimals);
	}
	free_cbm(&cbm);
    }
    else
    {
	if (do_long_form)
	{
	    output_matrix_long(pbm, decimals, labels, keep_bed, left, right, tile, lf_header, outputfile);
	}
	else
	{
	    if (do_binary_matrix)
	    {
		output_binary_matrix(pbm, keep_bed, outputfile);
	    }
	    else
	    {
		output_matrix(pbm, decimals, keep_bed, outputfile);
	    }
	}
	/* unordered, no label  */
	free_perBaseMatrix(&pbm);
    }
    if (do_meta)
    {
	bed6FreeList(&regions_left);
	bed6FreeList(&regions_right);
	if (meta > 0)
	    bed6FreeList(&regions_meta);
    }
    else
	bed6FreeList(&regs);
}