local fork
Dependencies: Socket USBHostWANDongle_bleedingedge lwip-sys lwip
Fork of VodafoneUSBModem_bleedingedge by
link/LinkMonitor.h@12:66dc2c8eba2d, 2012-07-11 (annotated)
- Committer:
- donatien
- Date:
- Wed Jul 11 21:25:03 2012 +0000
- Revision:
- 12:66dc2c8eba2d
- Child:
- 22:06fb2a93a1f6
Link Monitoring / Dual serial port support
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 12:66dc2c8eba2d | 1 | /* LinkMonitor.h */ |
donatien | 12:66dc2c8eba2d | 2 | /* |
donatien | 12:66dc2c8eba2d | 3 | Copyright (C) 2012 ARM Limited. |
donatien | 12:66dc2c8eba2d | 4 | |
donatien | 12:66dc2c8eba2d | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
donatien | 12:66dc2c8eba2d | 6 | this software and associated documentation files (the "Software"), to deal in |
donatien | 12:66dc2c8eba2d | 7 | the Software without restriction, including without limitation the rights to |
donatien | 12:66dc2c8eba2d | 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
donatien | 12:66dc2c8eba2d | 9 | of the Software, and to permit persons to whom the Software is furnished to do |
donatien | 12:66dc2c8eba2d | 10 | so, subject to the following conditions: |
donatien | 12:66dc2c8eba2d | 11 | |
donatien | 12:66dc2c8eba2d | 12 | The above copyright notice and this permission notice shall be included in all |
donatien | 12:66dc2c8eba2d | 13 | copies or substantial portions of the Software. |
donatien | 12:66dc2c8eba2d | 14 | |
donatien | 12:66dc2c8eba2d | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 12:66dc2c8eba2d | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 12:66dc2c8eba2d | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 12:66dc2c8eba2d | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 12:66dc2c8eba2d | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 12:66dc2c8eba2d | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
donatien | 12:66dc2c8eba2d | 21 | SOFTWARE. |
donatien | 12:66dc2c8eba2d | 22 | */ |
donatien | 12:66dc2c8eba2d | 23 | |
donatien | 12:66dc2c8eba2d | 24 | #ifndef LINKMONITOR_H_ |
donatien | 12:66dc2c8eba2d | 25 | #define LINKMONITOR_H_ |
donatien | 12:66dc2c8eba2d | 26 | |
donatien | 12:66dc2c8eba2d | 27 | #include "core/fwk.h" |
donatien | 12:66dc2c8eba2d | 28 | |
donatien | 12:66dc2c8eba2d | 29 | #include "rtos.h" |
donatien | 12:66dc2c8eba2d | 30 | |
donatien | 12:66dc2c8eba2d | 31 | #include "at/ATCommandsInterface.h" |
donatien | 12:66dc2c8eba2d | 32 | |
donatien | 12:66dc2c8eba2d | 33 | /** Component to monitor link quality |
donatien | 12:66dc2c8eba2d | 34 | * |
donatien | 12:66dc2c8eba2d | 35 | */ |
donatien | 12:66dc2c8eba2d | 36 | class LinkMonitor : protected IATCommandsProcessor |
donatien | 12:66dc2c8eba2d | 37 | { |
donatien | 12:66dc2c8eba2d | 38 | public: |
donatien | 12:66dc2c8eba2d | 39 | /** Create LinkMonitor instance |
donatien | 12:66dc2c8eba2d | 40 | @param pIf Pointer to the ATCommandsInterface instance to use |
donatien | 12:66dc2c8eba2d | 41 | */ |
donatien | 12:66dc2c8eba2d | 42 | LinkMonitor(ATCommandsInterface* pIf); |
donatien | 12:66dc2c8eba2d | 43 | |
donatien | 12:66dc2c8eba2d | 44 | /** Initialize monitor |
donatien | 12:66dc2c8eba2d | 45 | */ |
donatien | 12:66dc2c8eba2d | 46 | int init(); |
donatien | 12:66dc2c8eba2d | 47 | |
donatien | 12:66dc2c8eba2d | 48 | /** Registration State |
donatien | 12:66dc2c8eba2d | 49 | */ |
donatien | 12:66dc2c8eba2d | 50 | enum REGISTRATION_STATE |
donatien | 12:66dc2c8eba2d | 51 | { |
donatien | 12:66dc2c8eba2d | 52 | REGISTRATION_STATE_UNKNOWN, //!< Unknown |
donatien | 12:66dc2c8eba2d | 53 | REGISTRATION_STATE_REGISTERING, //!< Registering |
donatien | 12:66dc2c8eba2d | 54 | REGISTRATION_STATE_DENIED, //!< Denied |
donatien | 12:66dc2c8eba2d | 55 | REGISTRATION_STATE_NO_SIGNAL, //!< No Signal |
donatien | 12:66dc2c8eba2d | 56 | REGISTRATION_STATE_HOME_NETWORK, //!< Registered on home network |
donatien | 12:66dc2c8eba2d | 57 | REGISTRATION_STATE_ROAMING //!< Registered on roaming network |
donatien | 12:66dc2c8eba2d | 58 | }; |
donatien | 12:66dc2c8eba2d | 59 | |
donatien | 12:66dc2c8eba2d | 60 | /** Bearer type |
donatien | 12:66dc2c8eba2d | 61 | */ |
donatien | 12:66dc2c8eba2d | 62 | enum BEARER |
donatien | 12:66dc2c8eba2d | 63 | { |
donatien | 12:66dc2c8eba2d | 64 | BEARER_UNKNOWN, //!< Unknown |
donatien | 12:66dc2c8eba2d | 65 | BEARER_GSM, //!< GSM (2G) |
donatien | 12:66dc2c8eba2d | 66 | BEARER_EDGE, //!< EDGE (2.5G) |
donatien | 12:66dc2c8eba2d | 67 | BEARER_UMTS, //!< UMTS (3G) |
donatien | 12:66dc2c8eba2d | 68 | BEARER_HSPA, //!< HSPA (3G+) |
donatien | 12:66dc2c8eba2d | 69 | BEARER_LTE //!< LTE (4G) |
donatien | 12:66dc2c8eba2d | 70 | }; |
donatien | 12:66dc2c8eba2d | 71 | |
donatien | 12:66dc2c8eba2d | 72 | /** Get link state |
donatien | 12:66dc2c8eba2d | 73 | @param pRssi pointer to store the current RSSI in dBm, between -51 dBm and -113 dBm if known; -51 dBm means -51 dBm or more; -113 dBm means -113 dBm or less; 0 if unknown |
donatien | 12:66dc2c8eba2d | 74 | @param pRegistrationState pointer to store the current registration state |
donatien | 12:66dc2c8eba2d | 75 | @param pBearer pointer to store the current bearer |
donatien | 12:66dc2c8eba2d | 76 | @return 0 on success, error code on failure |
donatien | 12:66dc2c8eba2d | 77 | */ |
donatien | 12:66dc2c8eba2d | 78 | int getState(int* pRssi, REGISTRATION_STATE* pRegistrationState, BEARER* pBearer); |
donatien | 12:66dc2c8eba2d | 79 | |
donatien | 12:66dc2c8eba2d | 80 | protected: |
donatien | 12:66dc2c8eba2d | 81 | //IATCommandsProcessor |
donatien | 12:66dc2c8eba2d | 82 | virtual int onNewATResponseLine(ATCommandsInterface* pInst, const char* line); |
donatien | 12:66dc2c8eba2d | 83 | virtual int onNewEntryPrompt(ATCommandsInterface* pInst); |
donatien | 12:66dc2c8eba2d | 84 | |
donatien | 12:66dc2c8eba2d | 85 | private: |
donatien | 12:66dc2c8eba2d | 86 | ATCommandsInterface* m_pIf; |
donatien | 12:66dc2c8eba2d | 87 | |
donatien | 12:66dc2c8eba2d | 88 | int m_rssi; |
donatien | 12:66dc2c8eba2d | 89 | REGISTRATION_STATE m_registrationState; |
donatien | 12:66dc2c8eba2d | 90 | BEARER m_bearer; |
donatien | 12:66dc2c8eba2d | 91 | |
donatien | 12:66dc2c8eba2d | 92 | }; |
donatien | 12:66dc2c8eba2d | 93 | |
donatien | 12:66dc2c8eba2d | 94 | #endif /* LINKMONITOR_H_ */ |