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