diff options
author | John Crispin <john@openwrt.org> | 2010-11-03 19:12:34 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2010-11-03 19:12:34 +0000 |
commit | a8b2a07f375edefec242de9f20d4aefafa927517 (patch) | |
tree | d15f5bb696bfa9dfd9555788d411e0ba59b99a65 /package/libtapi/src/tapidemo.c | |
parent | 72ae8452cda47d6e18e664097a4adbc0eee3fc7b (diff) | |
download | upstream-a8b2a07f375edefec242de9f20d4aefafa927517.tar.gz upstream-a8b2a07f375edefec242de9f20d4aefafa927517.tar.bz2 upstream-a8b2a07f375edefec242de9f20d4aefafa927517.zip |
* adds a rewrite of the tapi drivers + sip app. this is the result of lars' gsoc 2010 project, Thanks !
SVN-Revision: 23840
Diffstat (limited to 'package/libtapi/src/tapidemo.c')
-rw-r--r-- | package/libtapi/src/tapidemo.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/package/libtapi/src/tapidemo.c b/package/libtapi/src/tapidemo.c new file mode 100644 index 0000000000..63098b89cf --- /dev/null +++ b/package/libtapi/src/tapidemo.c @@ -0,0 +1,56 @@ + +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <sys/ioctl.h> +#include <fcntl.h> +#include <errno.h> +#include <poll.h> + +#include <linux/input.h> +/*#include <sys/timerfd.h>*/ +#include "timerfd.h" +#include "dialdetector.h" + +#include "tapi-ioctl.h" + +#include "tapi-device.h" +#include "tapi-port.h" + +static struct tapi_device dev; +static struct tapi_port ports[2]; + +void dial_callback(struct tapi_port *port, size_t num_digits, const unsigned char *digits) +{ + unsigned int link; + + if (num_digits != 1) + return; + if (port->id == digits[0] || digits[0] > 1) + return; + + tapi_port_set_ring(&ports[digits[0]], true); + + tapi_session_alloc(&dev, port, &ports[digits[0]]); +} + +int main(int argc, char *argv[]) +{ + struct dialdetector *dd, *dd2; + unsigned int link; + unsigned char buf[1024]; + int ret; + + tapi_device_open(0, &dev); + tapi_port_open(0, 0, &ports[0]); + tapi_port_open(0, 1, &ports[1]); + + dd = dialdetector_alloc(&ports[0]); + dd->dial_callback = dial_callback; + dd2 = dialdetector_alloc(&ports[1]); + dd2->dial_callback = dial_callback; + + tapi_mainloop(); + + return 0; +} |