Changeset 7e7def5 in mainline
- Timestamp:
- 2013-04-05T16:58:55Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2373ba7
- Parents:
- f465461
- Location:
- uspace/lib/hound
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/hound/include/hound/server.h
rf465461 r7e7def5 38 38 39 39 #include <async.h> 40 #include <stdbool.h>41 40 #include <loc.h> 42 #include <pcm/format.h>43 44 45 46 enum {47 HOUND_REGISTER_PLAYBACK = IPC_FIRST_USER_METHOD,48 HOUND_REGISTER_RECORDING,49 HOUND_UNREGISTER_PLAYBACK,50 HOUND_UNREGISTER_RECORDING,51 HOUND_CONNECT,52 HOUND_DISCONNECT,53 };54 41 55 42 typedef void (*dev_change_callback_t)(void); 56 43 typedef int (*device_callback_t)(service_id_t, const char *); 57 58 44 59 45 int hound_server_register(const char *name, service_id_t *id); … … 61 47 int hound_server_set_device_change_callback(dev_change_callback_t cb); 62 48 int hound_server_devices_iterate(device_callback_t callback); 63 int hound_server_get_register_params(const char **name, async_sess_t **sess,64 unsigned *channels, unsigned *rate, pcm_sample_format_t *format);65 int hound_server_get_unregister_params(const char **name);66 int hound_server_get_connection_params(const char **source, const char **sink);67 49 68 50 #endif -
uspace/lib/hound/src/protocol.c
rf465461 r7e7def5 554 554 } 555 555 556 556 557 /*** 557 * SERVER SIDE - DEPRECATED558 * SERVER SIDE 558 559 ***/ 559 560 static const char * get_name(void);561 560 562 561 int hound_server_register(const char *name, service_id_t *id) … … 581 580 return loc_register_cat_change_cb(cb); 582 581 } 582 583 583 584 584 int hound_server_devices_iterate(device_callback_t callback) … … 612 612 return EOK; 613 613 } 614 615 int hound_server_get_register_params(const char **name, async_sess_t **sess,616 unsigned *channels, unsigned *rate, pcm_sample_format_t *format)617 {618 if (!name || !sess || !channels || !rate || !format)619 return EINVAL;620 621 const char *n = get_name();622 if (!n)623 return ENOMEM;624 625 ipc_call_t call;626 ipc_callid_t callid = async_get_call(&call);627 628 unsigned ch = IPC_GET_ARG1(call);629 unsigned r = IPC_GET_ARG2(call);630 pcm_sample_format_t f = IPC_GET_ARG3(call);631 632 async_sess_t *s = async_callback_receive_start(EXCHANGE_ATOMIC, &call);633 async_answer_0(callid, s ? EOK : ENOMEM);634 635 *name = n;636 *sess = s;637 *channels = ch;638 *rate = r;639 *format = f;640 641 return ENOTSUP;642 }643 644 int hound_server_get_unregister_params(const char **name)645 {646 if (!name)647 return EINVAL;648 *name = get_name();649 if (!*name)650 return ENOMEM;651 return EOK;652 }653 654 int hound_server_get_connection_params(const char **source, const char **sink)655 {656 if (!source || !sink)657 return EINVAL;658 659 const char *source_name = get_name();660 if (!source_name)661 return ENOMEM;662 663 const char *sink_name = get_name();664 if (!sink_name)665 return ENOMEM;666 667 *source = source_name;668 *sink = sink_name;669 return EOK;670 }671 672 static const char * get_name(void)673 {674 size_t size = 0;675 ipc_callid_t callid;676 async_data_write_receive(&callid, &size);677 char *buffer = malloc(size + 1);678 if (buffer) {679 async_data_write_finalize(callid, buffer, size);680 buffer[size] = 0;681 }682 return buffer;683 }684 685 614 /** 686 615 * @}
Note:
See TracChangeset
for help on using the changeset viewer.