Beispiel #1
0
// Load Lua module, parse PTP script and start execution if parse ok.
static long script_start_ptp( char *script )
{
    module_set_script_lang(0);  // Force Lua script language
    if (libscriptapi->script_start(script,1))
    {
        camera_info.state.auto_started = 0;
        return script_stack_start();
    }
    return -1;
}
Beispiel #2
0
// Called from kbd process to start PTP script
// Load Lua module, parse PTP script and start execution if parse ok.
void start_ptp_script()
{
    if (ptp_script)
    {
        module_set_script_lang(0);  // Force Lua script language
        if (libscriptapi->script_start(ptp_script,1))
        {
            camera_info.state.auto_started = 0;
            ptp_script_state = script_stack_start();
        }
        else
            ptp_script_state = -1;
        ptp_script = 0;
    }
}
Beispiel #3
0
long script_start_gui( int autostart )
{
    int i;

    if (conf.script_file[0] == 0) return 0;

    libshothisto->shot_histogram_set(0);
    camera_info.state.auto_started = autostart;

    // Kill high speed USB timer if running
    stop_usb_HPtimer();

    // Keyboard init
    camera_info.state.kbd_last_clicked = 0;
    camera_info.state.kbd_last_checked_time = get_tick_count();
    kbd_key_release_all();

    // Close old console, will be re-opened when first line added
    console_close();
    script_print_screen_init();

    save_params_values(0);

    script_console_add_line((autostart)?LANG_CONSOLE_TEXT_AUTOSTARTED:LANG_CONSOLE_TEXT_STARTED);

    module_set_script_lang(conf.script_file);
    if ( !libscriptapi->script_start_file(conf.script_file) )
    {
        return -1;
    }

    sc_param *p = script_params;
    while (p)
    {
        libscriptapi->set_variable(p->name, p->val, (p->range == 1), (p->data_type == DTYPE_TABLE), p->option_count, p->options);
        p = p->next;
    }

    conf_update_prevent_shutdown();

    old_gui_handler = gui_set_mode(&scriptGuiHandler);

    return script_stack_start();
}