You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.7 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
4 years ago
4 years ago
​
​
​
​
​
​
2 years ago
​
​
​
2 years ago
4 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
  1. #ifndef __KERNEL_MODULE_MODEM_MANAGER_HEADER__
  2. #define __KERNEL_MODULE_MODEM_MANAGER_HEADER__
  3. #include "kernelModule.h"
  4. #include "../../components/base/basicThread.h"
  5. //*
  6. typedef std::vector<DBC_MODEM_DATA *> VECTOR_DBC_MODEM_DATA;
  7. class kernelModuleModemManager;
  8. typedef struct S_MDM_USER_DATA{
  9. uint8_t modem_id;
  10. char target[64];
  11. kernelModuleModemManager * parent;
  12. bool finished;
  13. pthread_t handler;
  14. }MDM_USER_DATA;
  15. typedef std::vector<MDM_USER_DATA *> VECTOR_MDM_USER_DATA;
  16. typedef struct S_MDM_CALL_DATA: public MDM_USER_DATA{
  17. uint8_t waitTillHangup;
  18. } MDM_CALL_DATA;
  19. typedef struct S_MDM_SMS_DATA: public MDM_USER_DATA{
  20. CSTR text;
  21. } MDM_SMS_DATA;
  22. //*/
  23. #define MDM_IDLE_WM 0x01
  24. #define MDM_INIT_CALL_WM 0x02
  25. #define MDM_MODEM_IS_BUSY_WM 0x03
  26. #define MDM_FETCH_NEXT_WM 0x04
  27. #define MDM_WAIT_WINDOW_WM 0x05
  28. #define MDM_STOP_WM 0x06
  29. typedef std::vector<DBC_MODEM_PHONEBOOK_RECORD*> VECTOR_MDM_PHONE_BOOK;
  30. class kernelModuleModemManager: public kernelModule, public basicThread {
  31. private:
  32. DBC_MODEM_MANAGER_DATA m_sMMData;
  33. VECTOR_MDM_USER_DATA m_vUserData;
  34. VECTOR_MDM_PHONE_BOOK m_vPhoneBook;
  35. bool moduleActive;
  36. bool sessionStarted;
  37. bool notificationSent;
  38. char m_cMyWanIP[32];
  39. //uint32_t m_nWindowCounterTO;
  40. // MThread procs
  41. static void * callProc( void * );
  42. static void * smsProc( void * );
  43. bool updateWanIP();
  44. protected:
  45. uint32_t startCall( CSTR number );
  46. void sendSMS( CSTR number, CSTR text );
  47. void hangupCall( uint32_t call_id );
  48. /* From Basic Thread */
  49. virtual void m_fThreadProc( void );
  50. public:
  51. explicit kernelModuleModemManager( uint32_t moduleID );
  52. ~kernelModuleModemManager();
  53. /* From Kernel Module */
  54. virtual bool reloadSettings();
  55. virtual bool startService();
  56. virtual bool stopService( bool force = false );
  57. virtual bool dispatchEvent(EVENT_CONTAINER *Evt);
  58. virtual bool validate();
  59. };
  60. #endif