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.

74 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. uint8_t m_bCurrentMode;
  40. //uint32_t m_nWindowCounterTO;
  41. // MThread procs
  42. static void * callProc( void * );
  43. static void * smsProc( void * );
  44. bool updateWanIP();
  45. protected:
  46. uint32_t startCall( CSTR number );
  47. void sendSMS( CSTR number, CSTR text );
  48. void hangupCall( uint32_t call_id );
  49. /* From Basic Thread */
  50. virtual void m_fThreadProc( void );
  51. public:
  52. explicit kernelModuleModemManager( uint32_t moduleID );
  53. ~kernelModuleModemManager();
  54. /* From Kernel Module */
  55. virtual bool reloadSettings();
  56. virtual bool startService();
  57. virtual bool stopService( bool force = false );
  58. virtual bool dispatchEvent(EVENT_CONTAINER *Evt);
  59. virtual bool validate();
  60. };
  61. #endif