/*
- * client.c -- Valerie client demo
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * client.c -- MVCP client
+ * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
* Author: Charles Yates <charles.yates@pandora.be>
*
* This program is free software; you can redistribute it and/or modify
absolute,
relative
}
-dv_demo_whence;
+client_whence;
/** Function prototype for menu handling.
*/
-typedef valerie_error_code (*demo_function)( dv_demo );
+typedef mvcp_error_code (*demo_function)( client );
/** The menu structure.
*/
}
array[ 50 ];
}
-*dv_demo_menu, dv_demo_menu_t;
+*client_menu, client_menu_t;
/** Forward reference to menu runner.
*/
-extern valerie_error_code dv_demo_run_menu( dv_demo, dv_demo_menu );
+extern mvcp_error_code client_run_menu( client, client_menu );
/** Foward references.
*/
-extern valerie_error_code dv_demo_list_nodes( dv_demo );
-extern valerie_error_code dv_demo_add_unit( dv_demo );
-extern valerie_error_code dv_demo_select_unit( dv_demo );
-extern valerie_error_code dv_demo_execute( dv_demo );
-extern valerie_error_code dv_demo_load( dv_demo );
-extern valerie_error_code dv_demo_transport( dv_demo );
-static void *dv_demo_status_thread( void * );
+extern mvcp_error_code client_list_nodes( client );
+extern mvcp_error_code client_add_unit( client );
+extern mvcp_error_code client_select_unit( client );
+extern mvcp_error_code client_execute( client );
+extern mvcp_error_code client_load( client );
+extern mvcp_error_code client_transport( client );
+static void *client_status_thread( void * );
/** Connected menu definition.
*/
-dv_demo_menu_t connected_menu =
+client_menu_t connected_menu =
{
"Connected Menu",
{
- { "Add Unit", dv_demo_add_unit },
- { "Select Unit", dv_demo_select_unit },
- { "Command Shell", dv_demo_execute },
+ { "Add Unit", client_add_unit },
+ { "Select Unit", client_select_unit },
+ { "Command Shell", client_execute },
{ NULL, NULL }
}
};
/** Initialise the demo structure.
*/
-dv_demo dv_demo_init( valerie_parser parser )
+client client_init( mvcp_parser parser )
{
- dv_demo this = malloc( sizeof( dv_demo_t ) );
+ client this = malloc( sizeof( client_t ) );
if ( this != NULL )
{
int index = 0;
- memset( this, 0, sizeof( dv_demo_t ) );
+ memset( this, 0, sizeof( client_t ) );
strcpy( this->last_directory, "/" );
for ( index = 0; index < 4; index ++ )
{
/** Display a status record.
*/
-void dv_demo_show_status( dv_demo demo, valerie_status status )
+void client_show_status( client demo, mvcp_status status )
{
if ( status->unit == demo->selected_unit && demo->showing )
{
/** Determine action to carry out as dictated by the client unit queue.
*/
-void dv_demo_queue_action( dv_demo demo, valerie_status status )
+void client_queue_action( client demo, mvcp_status status )
{
- dv_demo_queue queue = &demo->queues[ status->unit ];
+ client_queue queue = &demo->queues[ status->unit ];
/* SPECIAL CASE STATUS NOTIFICATIONS TO IGNORE */
queue->position = ( queue->position + 1 ) % 50;
if ( queue->position == queue->tail )
queue->position = queue->head;
- valerie_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
+ mvcp_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
if ( status->status == unit_not_loaded )
- valerie_unit_play( demo->dv, queue->unit );
+ mvcp_unit_play( demo->dv, queue->unit );
queue->ignore = 1;
}
else if ( ( status->position <= status->in && status->speed < 0 ) || status->status == unit_not_loaded )
{
if ( queue->position == -1 )
queue->position = queue->head;
- valerie_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
+ mvcp_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
if ( status->status == unit_not_loaded )
- valerie_unit_play( demo->dv, queue->unit );
+ mvcp_unit_play( demo->dv, queue->unit );
queue->position = ( queue->position - 1 ) % 50;
queue->ignore = 1;
}
/** Status thread.
*/
-static void *dv_demo_status_thread( void *arg )
+static void *client_status_thread( void *arg )
{
- dv_demo demo = arg;
- valerie_status_t status;
- valerie_notifier notifier = valerie_get_notifier( demo->dv_status );
+ client demo = arg;
+ mvcp_status_t status;
+ mvcp_notifier notifier = mvcp_get_notifier( demo->dv_status );
while ( !demo->terminated )
{
- if ( valerie_notifier_wait( notifier, &status ) != -1 )
+ if ( mvcp_notifier_wait( notifier, &status ) != -1 )
{
- dv_demo_queue_action( demo, &status );
- dv_demo_show_status( demo, &status );
+ client_queue_action( demo, &status );
+ client_show_status( demo, &status );
if ( status.status == unit_disconnected )
demo->disconnected = 1;
}
/** Turn on/off status display.
*/
-void dv_demo_change_status( dv_demo demo, int flag )
+void client_change_status( client demo, int flag )
{
if ( demo->disconnected && flag )
{
- valerie_error_code error = valerie_connect( demo->dv );
- if ( error == valerie_ok )
+ mvcp_error_code error = mvcp_connect( demo->dv );
+ if ( error == mvcp_ok )
demo->disconnected = 0;
else
beep();
if ( flag )
{
- valerie_status_t status;
- valerie_notifier notifier = valerie_get_notifier( demo->dv );
- valerie_notifier_get( notifier, &status, demo->selected_unit );
+ mvcp_status_t status;
+ mvcp_notifier notifier = mvcp_get_notifier( demo->dv );
+ mvcp_notifier_get( notifier, &status, demo->selected_unit );
demo->showing = 1;
- dv_demo_show_status( demo, &status );
+ client_show_status( demo, &status );
}
else
{
/** Add a unit.
*/
-valerie_error_code dv_demo_add_unit( dv_demo demo )
+mvcp_error_code client_add_unit( client demo )
{
- valerie_error_code error = valerie_ok;
- valerie_nodes nodes = valerie_nodes_init( demo->dv );
- valerie_units units = valerie_units_init( demo->dv );
+ mvcp_error_code error = mvcp_ok;
+ mvcp_nodes nodes = mvcp_nodes_init( demo->dv );
+ mvcp_units units = mvcp_units_init( demo->dv );
- if ( valerie_nodes_count( nodes ) != -1 && valerie_units_count( units ) != -1 )
+ if ( mvcp_nodes_count( nodes ) != -1 && mvcp_units_count( units ) != -1 )
{
char pressed;
- valerie_node_entry_t node;
- valerie_unit_entry_t unit;
+ mvcp_node_entry_t node;
+ mvcp_unit_entry_t unit;
int node_index = 0;
int unit_index = 0;
printf( "Select a Node\n\n" );
- for ( node_index = 0; node_index < valerie_nodes_count( nodes ); node_index ++ )
+ for ( node_index = 0; node_index < mvcp_nodes_count( nodes ); node_index ++ )
{
- valerie_nodes_get( nodes, node_index, &node );
+ mvcp_nodes_get( nodes, node_index, &node );
printf( "%d: %s - %s ", node_index + 1, node.guid, node.name );
- for ( unit_index = 0; unit_index < valerie_units_count( units ); unit_index ++ )
+ for ( unit_index = 0; unit_index < mvcp_units_count( units ); unit_index ++ )
{
- valerie_units_get( units, unit_index, &unit );
+ mvcp_units_get( units, unit_index, &unit );
if ( !strcmp( unit.guid, node.guid ) )
printf( "[U%d] ", unit.unit );
}
while ( ( pressed = get_keypress( ) ) != '0' )
{
node_index = pressed - '1';
- if ( node_index >= 0 && node_index < valerie_nodes_count( nodes ) )
+ if ( node_index >= 0 && node_index < mvcp_nodes_count( nodes ) )
{
int unit;
printf( "%c\n\n", pressed );
- valerie_nodes_get( nodes, node_index, &node );
- if ( valerie_unit_add( demo->dv, node.guid, &unit ) == valerie_ok )
+ mvcp_nodes_get( nodes, node_index, &node );
+ if ( mvcp_unit_add( demo->dv, node.guid, &unit ) == mvcp_ok )
{
printf( "Unit added as U%d\n", unit );
demo->selected_unit = unit;
else
{
int index = 0;
- valerie_response response = valerie_get_last_response( demo->dv );
+ mvcp_response response = mvcp_get_last_response( demo->dv );
printf( "Failed to add unit:\n\n" );
- for( index = 1; index < valerie_response_count( response ) - 1; index ++ )
- printf( "%s\n", valerie_response_get_line( response, index ) );
+ for( index = 1; index < mvcp_response_count( response ) - 1; index ++ )
+ printf( "%s\n", mvcp_response_get_line( response, index ) );
}
printf( "\n" );
wait_for_any_key( NULL );
wait_for_any_key( NULL );
}
- valerie_nodes_close( nodes );
- valerie_units_close( units );
+ mvcp_nodes_close( nodes );
+ mvcp_units_close( units );
return error;
}
/** Select a unit.
*/
-valerie_error_code dv_demo_select_unit( dv_demo demo )
+mvcp_error_code client_select_unit( client demo )
{
int terminated = 0;
int refresh = 1;
while ( !terminated )
{
- valerie_units units = valerie_units_init( demo->dv );
+ mvcp_units units = mvcp_units_init( demo->dv );
- if ( valerie_units_count( units ) > 0 )
+ if ( mvcp_units_count( units ) > 0 )
{
- valerie_unit_entry_t unit;
+ mvcp_unit_entry_t unit;
int index = 0;
char key = '\0';
{
printf( "Select a Unit\n\n" );
- for ( index = 0; index < valerie_units_count( units ); index ++ )
+ for ( index = 0; index < mvcp_units_count( units ); index ++ )
{
- valerie_units_get( units, index, &unit );
+ mvcp_units_get( units, index, &unit );
printf( "%d: U%d - %s [%s]\n", index + 1,
unit.unit,
unit.guid,
if ( key != '0' )
{
- if ( key >= '1' && key < '1' + valerie_units_count( units ) )
+ if ( key >= '1' && key < '1' + mvcp_units_count( units ) )
{
demo->selected_unit = key - '1';
printf( "%c\n\n", key );
- dv_demo_load( demo );
+ client_load( demo );
refresh = 1;
}
else
terminated = 1;
}
}
- else if ( valerie_units_count( units ) == 0 )
+ else if ( mvcp_units_count( units ) == 0 )
{
printf( "No units added - add a unit first\n\n" );
- dv_demo_add_unit( demo );
+ client_add_unit( demo );
}
else
{
terminated = 1;
}
- valerie_units_close( units );
+ mvcp_units_close( units );
}
- return valerie_ok;
+ return mvcp_ok;
}
/** Execute an arbitrary command.
*/
-valerie_error_code dv_demo_execute( dv_demo demo )
+mvcp_error_code client_execute( client demo )
{
- valerie_error_code error = valerie_ok;
+ mvcp_error_code error = mvcp_ok;
char command[ 10240 ];
int terminated = 0;
- printf( "Miracle Shell\n" );
+ printf( "Melted Shell\n" );
printf( "Enter an empty command to exit.\n\n" );
while ( !terminated )
if ( strcmp( command, "" ) )
{
int index = 0;
- valerie_response response = NULL;
- error = valerie_execute( demo->dv, 10240, command );
+ mvcp_response response = NULL;
+ error = mvcp_execute( demo->dv, 10240, command );
printf( "\n" );
- response = valerie_get_last_response( demo->dv );
- for ( index = 0; index < valerie_response_count( response ); index ++ )
+ response = mvcp_get_last_response( demo->dv );
+ for ( index = 0; index < mvcp_response_count( response ); index ++ )
{
- char *line = valerie_response_get_line( response, index );
+ char *line = mvcp_response_get_line( response, index );
printf( "%4d: %s\n", index, line );
}
printf( "\n" );
/** Add a file to the queue.
*/
-valerie_error_code dv_demo_queue_add( dv_demo demo, dv_demo_queue queue, char *file )
+mvcp_error_code client_queue_add( client demo, client_queue queue, char *file )
{
- valerie_status_t status;
- valerie_notifier notifier = valerie_get_notifier( demo->dv );
+ mvcp_status_t status;
+ mvcp_notifier notifier = mvcp_get_notifier( demo->dv );
if ( ( queue->tail + 1 ) % 50 == queue->head )
queue->head = ( queue->head + 1 ) % 50;
strcpy( queue->list[ queue->tail ], file );
queue->tail = ( queue->tail + 1 ) % 50;
- valerie_notifier_get( notifier, &status, queue->unit );
- valerie_notifier_put( notifier, &status );
+ mvcp_notifier_get( notifier, &status, queue->unit );
+ mvcp_notifier_put( notifier, &status );
- return valerie_ok;
+ return mvcp_ok;
}
/** Basic queue maintenance and status reports.
*/
-valerie_error_code dv_demo_queue_maintenance( dv_demo demo, dv_demo_queue queue )
+mvcp_error_code client_queue_maintenance( client demo, client_queue queue )
{
printf( "Queue Maintenance for Unit %d\n\n", queue->unit );
last_position = queue->position;
}
- dv_demo_change_status( demo, 1 );
+ client_change_status( demo, 1 );
switch( term_read( ) )
{
break;
}
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
}
term_exit( );
}
- return valerie_ok;
+ return mvcp_ok;
}
/** Load a file to the selected unit. Horrible function - sorry :-/. Not a good
demo....
*/
-valerie_error_code dv_demo_load( dv_demo demo )
+mvcp_error_code client_load( client demo )
{
- valerie_error_code error = valerie_ok;
+ mvcp_error_code error = mvcp_ok;
int terminated = 0;
int refresh = 1;
int start = 0;
while ( !terminated )
{
- valerie_dir dir = valerie_dir_init( demo->dv, demo->current_directory );
+ mvcp_dir dir = mvcp_dir_init( demo->dv, demo->current_directory );
- if ( valerie_dir_count( dir ) == -1 )
+ if ( mvcp_dir_count( dir ) == -1 )
{
printf( "Invalid directory - retrying %s\n", demo->last_directory );
- valerie_dir_close( dir );
- dir = valerie_dir_init( demo->dv, demo->last_directory );
- if ( valerie_dir_count( dir ) == -1 )
+ mvcp_dir_close( dir );
+ dir = mvcp_dir_init( demo->dv, demo->last_directory );
+ if ( mvcp_dir_count( dir ) == -1 )
{
printf( "Invalid directory - going back to /\n" );
- valerie_dir_close( dir );
- dir = valerie_dir_init( demo->dv, "/" );
+ mvcp_dir_close( dir );
+ dir = mvcp_dir_init( demo->dv, "/" );
strcpy( demo->current_directory, "/" );
}
else
}
}
- terminated = valerie_dir_count( dir ) == -1;
+ terminated = mvcp_dir_count( dir ) == -1;
if ( !terminated )
{
int max = 9;
int end = 0;
- end = valerie_dir_count( dir );
+ end = mvcp_dir_count( dir );
strcpy( demo->last_directory, demo->current_directory );
while ( !selected && !terminated )
{
- valerie_dir_entry_t entry;
+ mvcp_dir_entry_t entry;
int pressed;
if ( refresh )
printf( "-: Parent directory\n" );
for ( index = start; index < end && ( index - start ) < max; index ++ )
{
- valerie_dir_get( dir, index, &entry );
+ mvcp_dir_get( dir, index, &entry );
printf( "%d: %s\n", index - start + 1, entry.name );
}
while ( ( index ++ % 9 ) != 0 )
refresh = 0;
}
- dv_demo_change_status( demo, 1 );
+ client_change_status( demo, 1 );
pressed = term_read( );
switch( pressed )
}
break;
case 't':
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
term_exit( );
- dv_demo_transport( demo );
+ client_transport( demo );
term_init( );
selected = 1;
break;
case 'x':
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
term_exit( );
- dv_demo_execute( demo );
+ client_execute( demo );
term_init( );
selected = 1;
break;
case 'q':
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
term_exit( );
- dv_demo_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
+ client_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
term_init( );
selected = 1;
break;
{
if ( ( start + pressed - '1' ) < end )
{
- valerie_dir_get( dir, start + pressed - '1', &entry );
+ mvcp_dir_get( dir, start + pressed - '1', &entry );
selected = 1;
strcat( demo->current_directory, entry.name );
}
break;
}
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
}
- valerie_dir_close( dir );
+ mvcp_dir_close( dir );
}
if ( !terminated && demo->current_directory[ strlen( demo->current_directory ) - 1 ] != '/' )
{
if ( demo->queues[ demo->selected_unit ].mode == 0 )
{
- error = valerie_unit_load( demo->dv, demo->selected_unit, demo->current_directory );
- valerie_unit_play( demo->dv, demo->selected_unit );
+ error = mvcp_unit_load( demo->dv, demo->selected_unit, demo->current_directory );
+ mvcp_unit_play( demo->dv, demo->selected_unit );
}
else
{
- dv_demo_queue_add( demo, &demo->queues[ demo->selected_unit ], demo->current_directory );
+ client_queue_add( demo, &demo->queues[ demo->selected_unit ], demo->current_directory );
printf( "File %s added to queue.\n", demo->current_directory );
}
strcpy( demo->current_directory, demo->last_directory );
/** Set the in point of the clip on the select unit.
*/
-valerie_error_code dv_demo_set_in( dv_demo demo )
+mvcp_error_code client_set_in( client demo )
{
int position = 0;
- valerie_status_t status;
- valerie_notifier notifier = valerie_parser_get_notifier( demo->parser );
- valerie_notifier_get( notifier, &status, demo->selected_unit );
+ mvcp_status_t status;
+ mvcp_notifier notifier = mvcp_parser_get_notifier( demo->parser );
+ mvcp_notifier_get( notifier, &status, demo->selected_unit );
position = status.position;
- return valerie_unit_set_in( demo->dv, demo->selected_unit, position );
+ return mvcp_unit_set_in( demo->dv, demo->selected_unit, position );
}
/** Set the out point of the clip on the selected unit.
*/
-valerie_error_code dv_demo_set_out( dv_demo demo )
+mvcp_error_code client_set_out( client demo )
{
int position = 0;
- valerie_status_t status;
- valerie_notifier notifier = valerie_parser_get_notifier( demo->parser );
- valerie_notifier_get( notifier, &status, demo->selected_unit );
+ mvcp_status_t status;
+ mvcp_notifier notifier = mvcp_parser_get_notifier( demo->parser );
+ mvcp_notifier_get( notifier, &status, demo->selected_unit );
position = status.position;
- return valerie_unit_set_out( demo->dv, demo->selected_unit, position );
+ return mvcp_unit_set_out( demo->dv, demo->selected_unit, position );
}
/** Clear the in and out points on the selected unit.
*/
-valerie_error_code dv_demo_clear_in_out( dv_demo demo )
+mvcp_error_code client_clear_in_out( client demo )
{
- return valerie_unit_clear_in_out( demo->dv, demo->selected_unit );
+ return mvcp_unit_clear_in_out( demo->dv, demo->selected_unit );
}
/** Goto a user specified frame on the selected unit.
*/
-valerie_error_code dv_demo_goto( dv_demo demo )
+mvcp_error_code client_goto( client demo )
{
int frame = 0;
printf( "Frame: " );
if ( get_int( &frame, 0 ) )
- return valerie_unit_goto( demo->dv, demo->selected_unit, frame );
- return valerie_ok;
+ return mvcp_unit_goto( demo->dv, demo->selected_unit, frame );
+ return mvcp_ok;
}
/** Manipulate playback on the selected unit.
*/
-valerie_error_code dv_demo_transport( dv_demo demo )
+mvcp_error_code client_transport( client demo )
{
- valerie_error_code error = valerie_ok;
+ mvcp_error_code error = mvcp_ok;
int refresh = 1;
int terminated = 0;
- valerie_status_t status;
- valerie_notifier notifier = valerie_get_notifier( demo->dv );
+ mvcp_status_t status;
+ mvcp_notifier notifier = mvcp_get_notifier( demo->dv );
while ( !terminated )
{
refresh = 0;
}
- dv_demo_change_status( demo, 1 );
+ client_change_status( demo, 1 );
switch( term_read( ) )
{
case -1:
break;
case ' ':
- error = valerie_unit_pause( demo->dv, demo->selected_unit );
+ error = mvcp_unit_pause( demo->dv, demo->selected_unit );
break;
case '1':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -5000 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -5000 );
break;
case '2':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -2500 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -2500 );
break;
case '3':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -1000 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -1000 );
break;
case '4':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -500 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -500 );
break;
case '5':
- error = valerie_unit_play( demo->dv, demo->selected_unit );
+ error = mvcp_unit_play( demo->dv, demo->selected_unit );
break;
case '6':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 500 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 500 );
break;
case '7':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 1250 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 1250 );
break;
case '8':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 2500 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 2500 );
break;
case '9':
- error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 5000 );
+ error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 5000 );
break;
case 's':
- error = valerie_unit_goto( demo->dv, demo->selected_unit, 0 );
+ error = mvcp_unit_goto( demo->dv, demo->selected_unit, 0 );
break;
case 'h':
- error = valerie_unit_step( demo->dv, demo->selected_unit, -1 );
+ error = mvcp_unit_step( demo->dv, demo->selected_unit, -1 );
break;
case 'j':
- valerie_notifier_get( notifier, &status, demo->selected_unit );
- error = valerie_unit_goto( demo->dv, demo->selected_unit, status.tail_out );
+ mvcp_notifier_get( notifier, &status, demo->selected_unit );
+ error = mvcp_unit_goto( demo->dv, demo->selected_unit, status.tail_out );
break;
case 'k':
- valerie_notifier_get( notifier, &status, demo->selected_unit );
- error = valerie_unit_goto( demo->dv, demo->selected_unit, status.in );
+ mvcp_notifier_get( notifier, &status, demo->selected_unit );
+ error = mvcp_unit_goto( demo->dv, demo->selected_unit, status.in );
break;
case 'l':
- error = valerie_unit_step( demo->dv, demo->selected_unit, 1 );
+ error = mvcp_unit_step( demo->dv, demo->selected_unit, 1 );
break;
case 'p':
- error = valerie_unit_set( demo->dv, demo->selected_unit, "eof", "pause" );
+ error = mvcp_unit_set( demo->dv, demo->selected_unit, "eof", "pause" );
break;
case 'r':
- error = valerie_unit_set( demo->dv, demo->selected_unit, "eof", "loop" );
+ error = mvcp_unit_set( demo->dv, demo->selected_unit, "eof", "loop" );
break;
case 't':
- error = valerie_unit_set( demo->dv, demo->selected_unit, "eof", "stop" );
+ error = mvcp_unit_set( demo->dv, demo->selected_unit, "eof", "stop" );
break;
case 'i':
- error = dv_demo_set_in( demo );
+ error = client_set_in( demo );
break;
case 'o':
- error = dv_demo_set_out( demo );
+ error = client_set_out( demo );
break;
case 'g':
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
term_exit( );
- error = dv_demo_goto( demo );
+ error = client_goto( demo );
refresh = 1;
break;
case 'c':
- error = dv_demo_clear_in_out( demo );
+ error = client_clear_in_out( demo );
break;
case 'u':
- error = valerie_unit_set( demo->dv, demo->selected_unit, "points", "use" );
+ error = mvcp_unit_set( demo->dv, demo->selected_unit, "points", "use" );
break;
case 'd':
- error = valerie_unit_set( demo->dv, demo->selected_unit, "points", "ignore" );
+ error = mvcp_unit_set( demo->dv, demo->selected_unit, "points", "ignore" );
break;
case 'x':
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
term_exit( );
- dv_demo_execute( demo );
+ client_execute( demo );
refresh = 1;
break;
case 'q':
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
term_exit( );
- dv_demo_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
+ client_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
refresh = 1;
break;
}
- dv_demo_change_status( demo, 0 );
+ client_change_status( demo, 0 );
}
term_exit( );
/** Recursive menu execution.
*/
-valerie_error_code dv_demo_run_menu( dv_demo demo, dv_demo_menu menu )
+mvcp_error_code client_run_menu( client demo, client_menu menu )
{
const char *items = "123456789abcdefghijklmnopqrstuvwxyz";
int refresh_menu = 1;
if ( demo->disconnected && key != '0' )
{
- valerie_error_code error = valerie_connect( demo->dv );
- if ( error == valerie_ok )
+ mvcp_error_code error = mvcp_connect( demo->dv );
+ if ( error == mvcp_ok )
demo->disconnected = 0;
else
beep();
}
}
- return valerie_ok;
+ return mvcp_ok;
}
/** Entry point for main menu.
*/
-void dv_demo_run( dv_demo this )
+void client_run( client this )
{
- this->dv = valerie_init( this->parser );
- this->dv_status = valerie_init( this->parser );
- if ( valerie_connect( this->dv ) == valerie_ok )
+ this->dv = mvcp_init( this->parser );
+ this->dv_status = mvcp_init( this->parser );
+ if ( mvcp_connect( this->dv ) == mvcp_ok )
{
- pthread_create( &this->thread, NULL, dv_demo_status_thread, this );
- dv_demo_run_menu( this, &connected_menu );
+ pthread_create( &this->thread, NULL, client_status_thread, this );
+ client_run_menu( this, &connected_menu );
this->terminated = 1;
pthread_join( this->thread, NULL );
this->terminated = 0;
wait_for_any_key( "" );
}
- valerie_close( this->dv_status );
- valerie_close( this->dv );
+ mvcp_close( this->dv_status );
+ mvcp_close( this->dv );
printf( "Demo Exit.\n" );
}
/** Close the demo structure.
*/
-void dv_demo_close( dv_demo demo )
+void client_close( client demo )
{
free( demo );
}