/[svn]/liblscp/trunk/src/client.c
ViewVC logotype

Diff of /liblscp/trunk/src/client.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 562 by capela, Sun May 22 11:27:56 2005 UTC revision 623 by capela, Thu Jun 9 10:37:19 2005 UTC
# Line 14  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15     Lesser General Public License for more details.     Lesser General Public License for more details.
16    
17     You should have received a copy of the GNU Lesser General Public     You should 14have received a copy of the GNU Lesser General Public
18     License along with this library; if not, write to the Free Software     License along with this library; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20    
# Line 337  lscp_client_t* lscp_client_create ( cons Line 337  lscp_client_t* lscp_client_create ( cons
337      lscp_device_port_info_init(&(pClient->midi_port_info));      lscp_device_port_info_init(&(pClient->midi_port_info));
338      lscp_param_info_init(&(pClient->audio_channel_param_info));      lscp_param_info_init(&(pClient->audio_channel_param_info));
339      lscp_param_info_init(&(pClient->midi_port_param_info));      lscp_param_info_init(&(pClient->midi_port_param_info));
340        lscp_server_info_init(&(pClient->server_info));
341      lscp_engine_info_init(&(pClient->engine_info));      lscp_engine_info_init(&(pClient->engine_info));
342      lscp_channel_info_init(&(pClient->channel_info));      lscp_channel_info_init(&(pClient->channel_info));
343      // Initialize error stuff.      // Initialize error stuff.
# Line 347  lscp_client_t* lscp_client_create ( cons Line 348  lscp_client_t* lscp_client_create ( cons
348      pClient->iStreamCount = 0;      pClient->iStreamCount = 0;
349      // Default timeout value.      // Default timeout value.
350      pClient->iTimeout = LSCP_TIMEOUT_MSECS;      pClient->iTimeout = LSCP_TIMEOUT_MSECS;
351        pClient->iTimeoutCount = 0;
352    
353      // Initialize the transaction mutex.      // Initialize the transaction mutex.
354      lscp_mutex_init(pClient->mutex);      lscp_mutex_init(pClient->mutex);
# Line 400  lscp_status_t lscp_client_destroy ( lscp Line 402  lscp_status_t lscp_client_destroy ( lscp
402      // Free up all cached members.      // Free up all cached members.
403      lscp_channel_info_free(&(pClient->channel_info));      lscp_channel_info_free(&(pClient->channel_info));
404      lscp_engine_info_free(&(pClient->engine_info));      lscp_engine_info_free(&(pClient->engine_info));
405        lscp_server_info_free(&(pClient->server_info));
406      lscp_param_info_free(&(pClient->midi_port_param_info));      lscp_param_info_free(&(pClient->midi_port_param_info));
407      lscp_param_info_free(&(pClient->audio_channel_param_info));      lscp_param_info_free(&(pClient->audio_channel_param_info));
408      lscp_device_port_info_free(&(pClient->midi_port_info));      lscp_device_port_info_free(&(pClient->midi_port_info));
# Line 1467  lscp_status_t lscp_reset_sampler ( lscp_ Line 1470  lscp_status_t lscp_reset_sampler ( lscp_
1470  }  }
1471    
1472    
1473    /**
1474     *  Getting information about the server.
1475     *  GET SERVER INFO
1476     *
1477     *  @param pClient  Pointer to client instance structure.
1478     *
1479     *  @returns A pointer to a @ref lscp_server_info_t structure, with all the
1480     *  information of the current connected server, or NULL in case of failure.
1481     */
1482    lscp_server_info_t *lscp_get_server_info ( lscp_client_t *pClient )
1483    {
1484        lscp_server_info_t *pServerInfo;
1485        const char *pszResult;
1486        const char *pszSeps = ":";
1487        const char *pszCrlf = "\r\n";
1488        char *pszToken;
1489        char *pch;
1490    
1491        // Lock this section up.
1492        lscp_mutex_lock(pClient->mutex);
1493    
1494        pServerInfo = &(pClient->server_info);
1495        lscp_server_info_reset(pServerInfo);
1496    
1497        if (lscp_client_call(pClient, "GET SERVER INFO\r\n") == LSCP_OK) {
1498            pszResult = lscp_client_get_result(pClient);
1499            pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
1500            while (pszToken) {
1501                if (strcasecmp(pszToken, "DESCRIPTION") == 0) {
1502                    pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
1503                    if (pszToken)
1504                        lscp_unquote_dup(&(pServerInfo->description), &pszToken);
1505                }
1506                else if (strcasecmp(pszToken, "VERSION") == 0) {
1507                    pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
1508                    if (pszToken)
1509                        lscp_unquote_dup(&(pServerInfo->version), &pszToken);
1510                }
1511                pszToken = lscp_strtok(NULL, pszSeps, &(pch));
1512            }
1513        }
1514        else pServerInfo = NULL;
1515    
1516        // Unlock this section down.
1517        lscp_mutex_unlock(pClient->mutex);
1518    
1519        return pServerInfo;
1520    }
1521    
1522    
1523  // end of client.c  // end of client.c

Legend:
Removed from v.562  
changed lines
  Added in v.623

  ViewVC Help
Powered by ViewVC