/*
 * main.c:
 *
 * Copyright (c) 2000 James McKenzie <james@fishsoup.dhs.org>.
 * All rights reserved.
 *
 * $Log: main.c,v $
 * Revision 1.13  2001/01/30 06:16:30  root
 * #
 *
 * Revision 1.12  2000/12/01 04:42:19  root
 * #
 *
 * Revision 1.11  2000/11/23 23:45:28  root
 * #
 *
 * Revision 1.10  2000/10/07 18:30:09  root
 * #
 *
 * Revision 1.9  2000/10/06 19:52:44  root
 * #
 *
 * Revision 1.8  2000/09/24 01:46:08  root
 * #
 *
 * Revision 1.7  2000/09/24 01:12:55  root
 * #
 *
 * Revision 1.6  2000/02/21 04:11:27  root
 * #
 *
 * Revision 1.5  2000/02/21 04:01:00  root
 * #
 *
 * Revision 1.4  2000/02/20 03:03:53  root
 * #
 *
 * Revision 1.3  2000/02/20 02:52:13  root
 * #
 *
 * Revision 1.2  2000/02/16 13:51:59  root
 * #
 *
 * Revision 1.1  2000/02/16 13:50:11  root
 * Initial revision
 *
 *
 */

static char rcsid[] = "$Id: main.c,v 1.13 2001/01/30 06:16:30 root Exp $";

#include "project.h"

#include <sys/socket.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <signal.h>

#include <endian.h>


void *msglib;


void
timeout (int signo)
{

  tuner_status ();
  return;

}

void
dispatch (void)
{
  hifi_dispatch ();
}

/*
 * Function main (argc, )
 *
 *    Initialize and try to receive test frames
 *
 */
int tunerunit;

int
main (int argc, char *argv[])
{
  struct itimerval itime;

  tunerunit = hifi_getunit ("tuner");
  msglib = hifi_open (HIFI_CLASS_TUNER, tunerunit);


  tuner_open ();
  mixer_open ();

  itime.it_value.tv_sec = 3;
  itime.it_value.tv_usec = 0;

  itime.it_interval.tv_sec = 3;
  itime.it_interval.tv_usec = 0;
  setitimer (ITIMER_REAL, &itime, NULL);

  signal (SIGALRM, timeout);

  while (1)
    {
      dispatch ();
    }
  hifimsg_close (msglib);
}
