event.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* $Id: event.c,v 1.4.8.1 2001/09/23 22:24:59 kai Exp $
  2. *
  3. * Copyright (C) 1996 SpellCaster Telecommunications Inc.
  4. *
  5. * This software may be used and distributed according to the terms
  6. * of the GNU General Public License, incorporated herein by reference.
  7. *
  8. * For more information, please contact gpl-info@spellcast.com or write:
  9. *
  10. * SpellCaster Telecommunications Inc.
  11. * 5621 Finch Avenue East, Unit #3
  12. * Scarborough, Ontario Canada
  13. * M1B 2T9
  14. * +1 (416) 297-8565
  15. * +1 (416) 297-6433 Facsimile
  16. */
  17. #include "includes.h"
  18. #include "hardware.h"
  19. #include "message.h"
  20. #include "card.h"
  21. #ifdef DEBUG
  22. static char *events[] = { "ISDN_STAT_STAVAIL",
  23. "ISDN_STAT_ICALL",
  24. "ISDN_STAT_RUN",
  25. "ISDN_STAT_STOP",
  26. "ISDN_STAT_DCONN",
  27. "ISDN_STAT_BCONN",
  28. "ISDN_STAT_DHUP",
  29. "ISDN_STAT_BHUP",
  30. "ISDN_STAT_CINF",
  31. "ISDN_STAT_LOAD",
  32. "ISDN_STAT_UNLOAD",
  33. "ISDN_STAT_BSENT",
  34. "ISDN_STAT_NODCH",
  35. "ISDN_STAT_ADDCH",
  36. "ISDN_STAT_CAUSE" };
  37. #endif
  38. int indicate_status(int card, int event,ulong Channel,char *Data)
  39. {
  40. isdn_ctrl cmd;
  41. #ifdef DEBUG
  42. pr_debug("%s: Indicating event %s on Channel %d\n",
  43. sc_adapter[card]->devicename, events[event-256], Channel);
  44. #endif
  45. if (Data != NULL){
  46. pr_debug("%s: Event data: %s\n", sc_adapter[card]->devicename,
  47. Data);
  48. switch (event) {
  49. case ISDN_STAT_BSENT:
  50. memcpy(&cmd.parm.length, Data, sizeof(cmd.parm.length));
  51. break;
  52. case ISDN_STAT_ICALL:
  53. memcpy(&cmd.parm.setup, Data, sizeof(cmd.parm.setup));
  54. break;
  55. default:
  56. strcpy(cmd.parm.num, Data);
  57. }
  58. }
  59. cmd.command = event;
  60. cmd.driver = sc_adapter[card]->driverId;
  61. cmd.arg = Channel;
  62. return sc_adapter[card]->card->statcallb(&cmd);
  63. }