Changeset 059490c2 in mainline


Ignore:
Timestamp:
2013-03-17T13:57:57Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
504f1ea3
Parents:
fe0b448
Message:

libhound: Add protocol header

Location:
uspace/lib/hound/src
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/src/client.c

    rfe0b448 r059490c2  
    4343
    4444#include "client.h"
    45 #include "server.h"
    46 
    47 static const char *HOUND_SERVICE = "audio/hound";
     45#include "protocol.h"
    4846
    4947/***
     
    5755
    5856typedef struct hound_context {
    59         async_sess_t *session;
     57        hound_sess_t *session;
    6058        const char *name;
    6159        bool record;
     
    7169} hound_context_t;
    7270
    73 async_sess_t *hound_get_session(void)
    74 {
    75         service_id_t id = 0;
    76         const int ret =
    77             loc_service_get_id(HOUND_SERVICE, &id, IPC_FLAG_BLOCKING);
    78         if (ret != EOK)
    79                 return NULL;
    80         return loc_service_connect(EXCHANGE_SERIALIZE, id, IPC_FLAG_BLOCKING);
    81 }
    82 
    83 void hound_release_session(async_sess_t *sess)
    84 {
    85         if (sess)
    86                 async_hangup(sess);
    87 }
    8871
    8972static hound_context_t *hound_context_create(const char *name, bool record,
     
    10184                new_context->name = cont_name;
    10285                new_context->record = record;
    103                 new_context->session = hound_get_session();
     86                new_context->session = hound_service_connect(HOUND_SERVICE);
    10487                new_context->main_stream = NULL;
    10588                new_context->main_format.sample = format;
  • uspace/lib/hound/src/protocol.c

    rfe0b448 r059490c2  
    4242#include <libarch/types.h>
    4343
     44#include "protocol.h"
    4445#include "client.h"
    4546#include "server.h"
    4647
    47 static const char *HOUND_SERVICE = "audio/hound";
     48const char *HOUND_SERVICE = "audio/hound";
     49
     50hound_sess_t *hound_service_connect(const char *service)
     51{
     52        service_id_t id = 0;
     53        const int ret =
     54            loc_service_get_id(service, &id, IPC_FLAG_BLOCKING);
     55        if (ret != EOK)
     56                return NULL;
     57        return loc_service_connect(EXCHANGE_PARALLEL, id, IPC_FLAG_BLOCKING);
     58}
     59
     60void hound_service_disconnect(hound_sess_t *sess)
     61{
     62        if (sess)
     63                async_hangup(sess);
     64}
    4865
    4966/***
     
    5572        void *arg;
    5673} callback_t;
     74
     75hound_sess_t *hound_get_session(void)
     76{
     77        return hound_service_connect(HOUND_SERVICE);
     78}
     79
     80void hound_release_session(hound_sess_t *sess)
     81{
     82        hound_service_disconnect(sess);
     83}
    5784
    5885
Note: See TracChangeset for help on using the changeset viewer.