/test/ttest.c

http://bdremote-ng.googlecode.com/ · C · 92 lines · 36 code · 21 blank · 35 comment · 3 complexity · 4fd8edf9bb174a16b49ff9d681da7ea7 MD5 · raw file

  1. /*
  2. * bdremoteng - helper daemon for Sony(R) BD Remote Control
  3. * Based on bdremoted, written by Anton Starikov <antst@mail.ru>.
  4. *
  5. * Copyright (C) 2009 Michael Wojciechowski <wojci@wojci.dk>
  6. *
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. */
  23. /* The following was based on some pthread examples written by Andrae
  24. * Muys.
  25. */
  26. /** \ingroup Test
  27. * @{
  28. */
  29. /*! \file ttest.c
  30. \brief Test timers.
  31. Test application which tests if simple timers behave as expected.
  32. */
  33. #include <globaldefs.h>
  34. #include <stdio.h>
  35. #include <unistd.h>
  36. #include <stdlib.h>
  37. #include <string.h>
  38. #include <lirc_srv.h>
  39. unsigned int globalLogMask =
  40. MODULEMASK_LIRC_THR | MODULEMASK_LIRC_SOCK |
  41. MODULEMASK_LIRC_CB | MODULEMASK_BT_IF | MODULEMASK_BT_IMPL |
  42. MODULEMASK_QUEUE | MODULEMASK_SPARE | MODULEMASK_MAIN;
  43. static const unsigned int moduleMask = MODULEMASK_MAIN;
  44. int main(int argc, char *argv[])
  45. {
  46. int i = 0;
  47. keyState ks;
  48. if (argc > 1)
  49. {
  50. printf("Arguments are not supported.\n");
  51. for (i = 1; i < argc; i++)
  52. {
  53. printf("Unhandled argument: %s.\n", argv[i]);
  54. }
  55. return -1;
  56. }
  57. initTime(&ks);
  58. /* sleep(1); */
  59. i = 0;
  60. while (i < 50)
  61. {
  62. printf("Sleep #%d.\n", i);
  63. usleep(10000);
  64. updateTime(&ks);
  65. printf("Elapsed ms: %lu\n.", ks.elapsed);
  66. i++;
  67. }
  68. return 0;
  69. }
  70. /*\@}*/