diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-04-25 18:19:04 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-04-25 18:19:04 +0200 |
commit | 134aea8dd229daf938b109af7176be667e4201fb (patch) | |
tree | 61a4191d2a7a3309cb1c9601b7753e9ddc67c395 /doc/examples/telephony-and-music/end-call.c | |
parent | typo (diff) | |
download | bus-134aea8dd229daf938b109af7176be667e4201fb.tar.gz bus-134aea8dd229daf938b109af7176be667e4201fb.tar.bz2 bus-134aea8dd229daf938b109af7176be667e4201fb.tar.xz |
add telephony-and-music example
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | doc/examples/telephony-and-music/end-call.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/examples/telephony-and-music/end-call.c b/doc/examples/telephony-and-music/end-call.c new file mode 100644 index 0000000..edd9754 --- /dev/null +++ b/doc/examples/telephony-and-music/end-call.c @@ -0,0 +1,29 @@ +#include <bus.h> +#include <stdio.h> +#include <unistd.h> +#include <stdint.h> + +#define t(stmt) if (stmt) goto fail + + + +static char message[BUS_MEMORY_SIZE]; + + + +int main() +{ + bus_t bus; + sprintf(message, "%ji unforce-pause", (intmax_t)getppid()); + /* Yes, PPID; in this example we pretend the shell is the telephony process. */ + t(bus_open(&bus, "/tmp/example-bus", BUS_WRONLY)); + t(bus_write(&bus, message)); + bus_close(&bus); + return 0; + +fail: + perror("end-call"); + bus_close(&bus); + return 1; +} + |