Base library for cellular modem implementations

Dependencies:   Socket lwip-sys lwip

Dependents:   CellularUSBModem CellularUSBModem

Deprecated

This is an mbed 2 networking library. For mbed 5, the networking libraries have been revised to better support additional network stacks and thread safety here.

Committer:
bogdanm
Date:
Thu Oct 17 12:29:05 2013 +0300
Revision:
1:4a23efdf0da9
Child:
5:9a57892f206c
Initial release of the CellularModem library

Who changed what in which revision?

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