Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CNManager by
CNManager.h
00001 #pragma once 00002 00003 #include "CNLib.h" 00004 00005 #define TIMEOUT_RETRY_DATA_CONNECTION (5 * 1000) //!< timeout for bringing up data in case of faults 00006 #define TIMEOUT_CHECK_STATUS_DATA_CONNECITION (5 * 1000) //!< timeout for checking data connection status 00007 #define TIMEOUT_POLLING_NETWORK_STATUS (5 * 1000) //!< timeout for polling the network status 00008 #define MAX_ERROR_RETRIES 5 //!< number of error before reset 00009 #define SIM_WAIT_MAX_CYCLE 15 //!< wait cycle for sim init 00010 #define MEX_RESP_ERROR 5 00011 00012 //! Manager events 00013 typedef enum { 00014 MNG_EV_IDLE, //!< idle 00015 MNG_EV_DATA_UP, //!< data connection is active 00016 MNG_EV_DATA_DOWN, //!< data connection is active 00017 } MngEvents; 00018 00019 00020 /** Function handler for data status updates 00021 /param ev new data status 00022 /param param void pointer 00023 */ 00024 typedef void (*evMngHandler) (MngEvents ev, void* param); 00025 00026 /** Init Function 00027 This function has to be called before CNMLoop 00028 \param powerOn module power status at boot: enabled on, disabled off 00029 \param dataEnabled data connection status at boot: enabled on, disabled off 00030 \param roomingEnabled unsolicited messages status: enabled on, disabled off 00031 \return true if successful false otherwise 00032 */ 00033 bool cnInit(bool powerOn = true, bool dataEnabled = true, bool roomingEnabled = true); 00034 00035 /**Handler registration 00036 00037 \param handler Handler for data status changes 00038 \param param void paramter to be passed to the handler 00039 */ 00040 void cnRegHandler(evMngHandler handler, void* param=NULL); 00041 00042 /** Set the debug level. 00043 This function has to be called before CNMLoop 00044 \param level -1 = OFF, 0 = ERROR, 1 = INFO(default), 2 = TRACE, 3 = ATCMD,TEST 00045 \return true if successful, false not possible 00046 */ 00047 bool cnSetDebug(int level); 00048 00049 /** Cycle the connection manager loop. 00050 * \return true if successful, false otherwise 00051 */ 00052 int cnLoop(); 00053 00054 /** force module reset. 00055 This function can be called at any time. 00056 Force the reset of the connection manager and of the module. 00057 */ 00058 void cnReset(); 00059 00060 /** Set the module power. 00061 This function can be called at any time. 00062 \param on if true the module is switched on, if false is switched off 00063 */ 00064 void cnSetPower(bool on); 00065 00066 /** Register (Attach) the MT to the GPRS service. 00067 This function can be called at any time. 00068 \param enabled if true data connection is requested, if false not. 00069 */ 00070 void cnSetDataEnabled(bool enabled); 00071 00072 /** Set parameters for the GPRS service. 00073 This function has to be called before CNMLoop. 00074 If Apn parameters are not set, the internal APN info database will be used. 00075 \param apn the of the network provider e.g. "internet" or "apn.provider.com" 00076 \param username is the user name text string for the authentication phase 00077 \param password is the password text string for the authentication phase 00078 \param auth is the authentication mode (CHAP,PAP,NONE or DETECT) 00079 */ 00080 void cnSetApn(const char *apn,const char* username = NULL,const char* password = NULL); 00081 00082 /** Set Sim pin for unlocking the sim 00083 This function has to be called prior to CNMLoop. 00084 \param pin of the SIM card 00085 */ 00086 void cnSetSimPin(const char* pin); 00087 00088 /** Set if rooming is allowed. 00089 \param enabled if true rooming is allowed, false it is not 00090 */ 00091 void cnSetRoamingOn(bool enabled); 00092 00093 /** Get data connection status. 00094 * \return yes if connection is up, false otherways 00095 */ 00096 bool cnIsDataUp(); 00097 00098 /** Get the MDM library's pointer. 00099 * \return the MDM pointer 00100 */ 00101 MDMSerial* cnGetMDM(); 00102 00103 /** Get a copy of NetStatus. 00104 * \param net pointer where NetStatus will be copied into 00105 */ 00106 void getNetStatus(MDMParser::NetStatus* net); 00107 00108 /** Get a copy of DevStatus. 00109 * \param dev pointer where DevStatus will be copied into 00110 */ 00111 void getDevStatus(MDMParser::DevStatus* dev);
Generated on Fri Jul 15 2022 21:42:35 by
1.7.2
