aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/telephony-and-music/receive-or-make-call.c
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/telephony-and-music/receive-or-make-call.c')
-rw-r--r--doc/examples/telephony-and-music/receive-or-make-call.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/examples/telephony-and-music/receive-or-make-call.c b/doc/examples/telephony-and-music/receive-or-make-call.c
new file mode 100644
index 0000000..cdd7390
--- /dev/null
+++ b/doc/examples/telephony-and-music/receive-or-make-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 force-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("receive-or-make-call");
+ bus_close(&bus);
+ return 1;
+}
+