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