aboutsummaryrefslogblamecommitdiffstats
path: root/doc/examples/telephony-and-music/end-call.c
blob: c03eedf88044287285e257cdbab52b6c0f4c1f86 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                     

      




                                                                                       
                                       








                           
#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, 0));
	bus_close(&bus);
	return 0;

fail:
	perror("end-call");
	bus_close(&bus);
	return 1;
}