From: Dan Dennedy Date: Tue, 31 May 2011 16:19:35 +0000 (-0700) Subject: Make mvcp_unit_get actually return property value. X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=0bbeb1246503d876635589d7e02912c7aea5da24;p=melted Make mvcp_unit_get actually return property value. Patch provided by Maksym Veremeyenko. --- diff --git a/src/mvcp/mvcp.c b/src/mvcp/mvcp.c index c9fd6ff..87b2148 100644 --- a/src/mvcp/mvcp.c +++ b/src/mvcp/mvcp.c @@ -542,9 +542,15 @@ mvcp_error_code mvcp_unit_set( mvcp this, int unit, const char *name, const char /** Get a unit configuration property. */ -mvcp_error_code mvcp_unit_get( mvcp this, int unit, char *name ) +mvcp_error_code mvcp_unit_get( mvcp this, int unit, char *name, char *value, int length ) { - return mvcp_execute( this, 1024, "UGET U%d %s", unit, name ); + mvcp_error_code error = mvcp_execute( this, 1024, "UGET U%d %s", unit, name ); + if ( error == mvcp_ok ) + { + mvcp_response response = mvcp_get_last_response( this ); + strncpy( value, mvcp_response_get_line( response, 1 ), length ); + } + return error; } /** Get a units status. diff --git a/src/mvcp/mvcp.h b/src/mvcp/mvcp.h index 47c042b..568c4d7 100644 --- a/src/mvcp/mvcp.h +++ b/src/mvcp/mvcp.h @@ -123,7 +123,7 @@ extern mvcp_error_code mvcp_unit_clear_in( mvcp, int ); extern mvcp_error_code mvcp_unit_clear_out( mvcp, int ); extern mvcp_error_code mvcp_unit_clear_in_out( mvcp, int ); extern mvcp_error_code mvcp_unit_set( mvcp, int, const char *, const char * ); -extern mvcp_error_code mvcp_unit_get( mvcp, int, char * ); +extern mvcp_error_code mvcp_unit_get( mvcp, int, char *, char *, int ); extern mvcp_error_code mvcp_unit_status( mvcp, int, mvcp_status ); extern mvcp_error_code mvcp_unit_transfer( mvcp, int, int );