upsv

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UbloxCellularBase.h Source File

UbloxCellularBase.h

00001 /* Copyright (c) 2017 ARM Limited
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifndef _UBLOX_CELLULAR_BASE_
00017 #define _UBLOX_CELLULAR_BASE_
00018 
00019 #include "mbed.h"
00020 #include "mbed_toolchain.h" // for MBED_DEPRECATED
00021 #include "ubloxATCmdParser.h"
00022 #include "FileHandle.h"
00023 
00024 /**********************************************************************
00025  * CLASSES
00026  **********************************************************************/
00027 
00028 /** UbloxCellularBase class.
00029  *
00030  *  This class provides all the base support for generic u-blox modems
00031  *  on C030 and C027 boards: module identification, power-up, network
00032  *  registration, etc.
00033  */
00034 class UbloxCellularBase {
00035 
00036 public:
00037     /** Circuit Switched network registration status (CREG Usage).
00038      * UBX-13001820 - AT Commands Example Application Note (Section 7.10.3).
00039      */
00040     typedef enum {
00041         CSD_NOT_REGISTERED_NOT_SEARCHING = 0,
00042         CSD_REGISTERED = 1,
00043         CSD_NOT_REGISTERED_SEARCHING = 2,
00044         CSD_REGISTRATION_DENIED = 3,
00045         CSD_UNKNOWN_COVERAGE = 4,
00046         CSD_REGISTERED_ROAMING = 5,
00047         CSD_SMS_ONLY = 6,
00048         CSD_SMS_ONLY_ROAMING = 7,
00049         CSD_CSFB_NOT_PREFERRED = 9
00050     } NetworkRegistrationStatusCsd;
00051 
00052     /** Packet Switched network registration status (CGREG Usage).
00053      * UBX-13001820 - AT Commands Example Application Note (Section 18.27.3).
00054      */
00055     typedef enum {
00056         PSD_NOT_REGISTERED_NOT_SEARCHING = 0,
00057         PSD_REGISTERED = 1,
00058         PSD_NOT_REGISTERED_SEARCHING = 2,
00059         PSD_REGISTRATION_DENIED = 3,
00060         PSD_UNKNOWN_COVERAGE = 4,
00061         PSD_REGISTERED_ROAMING = 5,
00062         PSD_EMERGENCY_SERVICES_ONLY = 8
00063     } NetworkRegistrationStatusPsd;
00064 
00065     /** EPS network registration status (CEREG Usage).
00066      * UBX-13001820 - AT Commands Example Application Note (Section 18.36.3).
00067      */
00068     typedef enum {
00069         EPS_NOT_REGISTERED_NOT_SEARCHING = 0,
00070         EPS_REGISTERED = 1,
00071         EPS_NOT_REGISTERED_SEARCHING = 2,
00072         EPS_REGISTRATION_DENIED = 3,
00073         EPS_UNKNOWN_COVERAGE = 4,
00074         EPS_REGISTERED_ROAMING = 5,
00075         EPS_EMERGENCY_SERVICES_ONLY = 8
00076     } NetworkRegistrationStatusEps;
00077 
00078     /** modem PSM states.
00079      *
00080      */
00081     typedef enum {
00082         AWAKE = 0,
00083         ASLEEP = 1
00084     } ModemPSMState;
00085 
00086     /** Initialise the modem, ready for use.
00087      *
00088      *  @param pin     PIN for the SIM card.
00089      *  @return        true if successful, otherwise false.
00090      */
00091     bool init(const char *pin = 0);
00092 
00093     /** Perform registration with the network.
00094      *
00095      * @return true if successful, otherwise false.
00096      */
00097     bool nwk_registration();
00098 
00099     /** True if the modem is registered for circuit
00100      * switched data, otherwise false.
00101      */
00102     bool is_registered_csd();
00103 
00104     /** True if the modem is registered for packet
00105      * switched data, otherwise false.
00106      */
00107     bool is_registered_psd();
00108 
00109     /** True if the modem is registered for enhanced
00110      * packet switched data (i.e. LTE and beyond),
00111      * otherwise false.
00112      */
00113     bool is_registered_eps();
00114 
00115     /** Perform deregistration from the network.
00116      *
00117      * @return true if successful, otherwise false.
00118      */
00119     bool nwk_deregistration();
00120 
00121     /** Put the modem into its lowest power state.
00122      */
00123     void deinit();
00124 
00125     /** Set the PIN code for the SIM card.
00126      *
00127      *  @param pin PIN for the SIM card.
00128      */
00129     void set_pin(const char *pin);
00130 
00131     /** Enable or disable SIM pin checking.
00132      *
00133      * @param enableNotDisable true if SIM PIN checking is to be enabled,
00134      *                         otherwise false.
00135      * @return                 true if successful, otherwise false.
00136      */
00137     bool sim_pin_check_enable(bool enableNotDisable);
00138 
00139     /** Change the SIM pin.
00140      *
00141      * @param new_pin the new PIN to use.
00142      * @return        true if successful, otherwise false.
00143      */
00144     bool change_sim_pin(const char *new_pin);
00145 
00146     /** Get the IMEI.
00147      *
00148      * @return true if successful, otherwise false.
00149      */
00150     MBED_DEPRECATED("This method is now replaced by const char * imei(), please use that instead")
00151     bool get_imei(char *imei_to_send, int size);
00152 
00153     /** Get the IMEI of the module.
00154      *
00155      * @return a pointer to the IMEI as a null-terminated string.
00156      */
00157     const char *imei();
00158 
00159     /** Get the Mobile Equipment ID (which may be the same as the IMEI).
00160      *
00161      * @return a pointer to the Mobile Equipment ID as a null-terminated string.
00162      */
00163     const char *meid();
00164 
00165     /** Get the IMSI of the SIM.
00166      *
00167      * @return a pointer to the IMSI as a null-terminated string.
00168      */
00169     const char *imsi();
00170 
00171     /** Get the ICCID of the SIM.
00172      *
00173      * @return a pointer to the ICCID as a null-terminated string.
00174      */
00175     const char *iccid();
00176 
00177     /** Get the RSSI.
00178      *
00179      * @return the RSSI in dBm. If it is not possible to obtain an
00180      *         RSSI reading at the time (e.g. because the modem is in
00181      *         data mode rather than AT command mode) then 0 is returned.
00182      */
00183     int rssi();
00184 
00185     /** RAT values for +URAT command
00186      * R412M only supports value 7 (CatM1), 8 (NB1), and 9 (GPRS)
00187      */
00188     typedef enum {
00189         GSM_GPRS_EGPRS = 0,
00190         GSM_UMTS = 1,
00191         UMTS = 2,
00192         URAT_LTE = 3,
00193         GSM_UMTS_LTE = 4,
00194         GSM_LTE = 5,
00195         UMTS_LTE = 6,
00196         LTE_CATM1 = 7,
00197         LTE_CATNB1 = 8,
00198         GPRS_EGPRS = 9,
00199         NOT_USED = -1
00200     } RAT;
00201 
00202     /** Module functionality modes. Ref to section 5.3.3 of UBX-13002752 for details.
00203      */
00204     typedef enum {
00205         FUNC_MIN = 0,
00206         FUNC_FULL = 1,
00207         FUNC_AIRPLANE = 4,
00208         FUNC_EN_SIM_TLKT_DEDICATED = 6,
00209         FUNC_DS_SIM_TLKT = 7,
00210         FUNC_EN_SIM_TLKT_RAW = 9,
00211         FUNC_RESET = 15,
00212         FUNC_RESET_WITH_SIM = 16,
00213         FUNC_MIN_WITH_SIM = 19,
00214         FUNC_HALT = 127
00215     } FunctionalityMode;
00216 
00217 #ifdef TARGET_UBLOX_C030_R41XM
00218     /** Supported MNO profiles for SARA-R4.
00219      */
00220     typedef enum {
00221         SW_DEFAULT = 0,
00222         SIM_ICCID = 1,
00223         ATT = 2,
00224         VERIZON = 3,
00225         TELSTRA = 4,
00226         TMO = 5,
00227         CT = 6,
00228         VODAFONE = 19,
00229         TELUS = 21,
00230         DT = 31,
00231         STANDARD_EU = 100
00232     } MNOProfile;
00233 
00234     #if MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE
00235     #define DEFAULT_MNO_PROFILE     (MNOProfile)MBED_CONF_UBLOX_CELL_DEFAULT_MNO_PROFILE
00236     #else
00237     #define DEFAULT_MNO_PROFILE     SW_DEFAULT
00238     #endif
00239 
00240     /** Reads the current MNO profile from modem and sets it to user specified profile.
00241      * User can also specify profile in mbed_lib.json file and call set_mno_profile without any arguments.
00242      *
00243      * Note: MNO profile should only be set in detached state and a reboot is required for settings to take effect
00244      *
00245      * @param profile MNO profile to use
00246      * @return    true if operation was successful, false if there was an error
00247      */
00248     bool set_mno_profile(MNOProfile profile = DEFAULT_MNO_PROFILE);
00249 
00250     /** Get current MNO profile.
00251      *
00252      * @param profile pointer to variable that can hold the value for returned profile
00253      * @return    true if operation was successful, false if there was an error
00254      */
00255     bool get_mno_profile(int *profile);
00256 
00257     /** Enable or disable the UPSV Power Saving Mode.
00258      *
00259      * @param idle_mode_value  1: enable idle mode
00260      *                         0: disable idle mode
00261      * @return                 true if successful, otherwise false.
00262      */
00263     bool set_idle_mode(bool enable = false);
00264 
00265     /** Queries the modem for idle mode status.
00266      *
00267      * @param status pointer to variable that can hold the value for idle mode status
00268      *                         1: enabled
00269      *                         0: disabled
00270      * @return                 true if successful, otherwise false.
00271      */
00272     bool get_idle_mode(int *status);
00273 #endif
00274 
00275     /** Set Radio Access Technology on modem.
00276      *
00277      * Note: RAT should only be set in detached state and a reboot is required for settings to take effect
00278      *
00279      * @param selected_rat Radio Access Technology to use
00280      * @param preferred_rat Radio Access Technology to use if selected_rat is not available
00281      * @param second_preferred_rat Radio Access Technology to use if selected_rat and preferred_rat are not available
00282      *
00283      * @return        true if successful, otherwise false.
00284      */
00285     bool set_modem_rat(RAT selected_rat, RAT preferred_rat = NOT_USED, RAT second_preferred_rat = NOT_USED);
00286 
00287     /** Get last saved values for RAT using +URAT read command. Note: The current selected RAT is indicated by DeviceInfo.rat
00288      *
00289      * @param selected_rat pointer to variable that can hold the value for selected_rat
00290      * @param preferred_rat pointer to variable that can hold the value for preferred_rat
00291      * @param second_preferred_rat pointer to variable that can hold the value for second_preferred_rat
00292      *
00293      * Note: NOT_USED will be returned in the variables if dual or tri modes are not enabled.
00294      *
00295      * @return        true if successful, otherwise false.
00296      */
00297     bool get_modem_rat(int *selected_rat, int *preferred_rat, int *second_preferred_rat);
00298 
00299     /** Sets the modem to specified functionality mode.
00300      *
00301      * @return true if successful, otherwise false.
00302      */
00303     bool set_functionality_mode(FunctionalityMode mode);
00304 
00305     /** Get the modem functionality mode
00306      *
00307      * @return true if successful, otherwise false.
00308      */
00309     bool get_functionality_mode(int *mode);
00310 
00311     /** reboot the modem using AT+CFUN=15. Application should call init() or connect() before making any other API calls.
00312      *
00313      * @return        true if successful, otherwise false.
00314      */
00315     bool reboot_modem();
00316 
00317 #ifdef TARGET_UBLOX_C030_R412M
00318     /** Important: Callback function is executed in context of AT parser so a user should not issue any AT commands from inside the callback.
00319      * It is recommended to set a flag/event/signal in callback and application can use that to wake up the modem and re-initialize it
00320      *
00321      * application callback for modem going in to PSM sleep
00322      *
00323      * @param func     callback function to be executed when modem is going in to PSM sleep
00324      * @param param    parameter to be passed to callback function.
00325      */
00326     void attach_cb_psm_going_in(Callback<void(void*)> func, void *param)
00327     {
00328         _func_psm_going_in = func;
00329         _cb_param_psm_going_in = param;
00330     }
00331 
00332     /** Important: Callback function is executed in context of AT parser so a user should not issue any AT commands from inside the callback.
00333      * It is recommended to set a flag/event/signal in callback and application can use that to wake up the modem and re-initialize it
00334      *
00335      * application callback for modem coming out of PSM sleep
00336      *
00337      * @param func     callback function to be executed when modem is coming out of PSM sleep.
00338      * @param param    parameter to be passed to callback function.
00339      */
00340     void attach_cb_psm_coming_out(Callback<void(void*)> func, void *param)
00341     {
00342         _func_psm_coming_out = func;
00343         _cb_param_psm_coming_out = param;
00344     }
00345 
00346     /** de-register the application callback for modem going in to PSM sleep
00347      *
00348      */
00349     void detach_cb_psm_going_in()
00350     {
00351         _func_psm_going_in = NULL;
00352         _cb_param_psm_going_in = NULL;
00353     }
00354 
00355     /** de-register application callback for modem coming out of PSM sleep
00356      *
00357      */
00358     void detach_cb_psm_coming_out()
00359     {
00360         _func_psm_coming_out = NULL;
00361         _cb_param_psm_coming_out = NULL;
00362     }
00363 
00364     /** Enable or disable the 3GPP PSM.
00365      *
00366      *  Note: Application should reboot the module after enabling PSM in order to enter PSM state. (reboot_modem())
00367      *  Note: Modem can be woken up by toggling the power-on signal. (wakeup_modem())
00368      *  Note: When device enters PSM, all connections(PPP, sockets) and settings that are not saved in NV memory(ATE0, CREG etc) are lost.
00369      *        host application should be prepared to re-initialize the modem and re-establish the connections.
00370      *  Note: PSM is disabled if both periodic_time and active_time are 0.
00371      *  Note: Not all variants/firmware versions support PSM URCs and in that case function will return false.
00372      *
00373      *  PSM string encoding code is borrowed from AT_CellularPower.cpp
00374      *
00375      * @param periodic_time    requested periodic TAU in seconds.
00376      * @param active_time      requested active time in seconds.
00377      * @param func             callback function to execute when modem goes to sleep
00378      * @param ptr              parameter to callback function
00379      * @return         True if successful, otherwise false.
00380      */
00381     bool set_power_saving_mode(int periodic_tau, int active_time);
00382 
00383     /** Reads the 3GPP PSM status (enabled or disabled) and returns assigned periodic tau and active time values.
00384      *
00385      * @param status           0: PSM disabled, 1: PSM enabled
00386      * @param periodic_tau     assigned periodic TAU in seconds.
00387      * @param active_time      assigned active time in seconds
00388      * @return         True if command successful, otherwise false.
00389      */
00390     bool get_power_saving_mode(int *status, int *periodic_tau, int *active_time);
00391 
00392     /** Wake up the modem from PSM. Ref to comment on set_power_saving_mode, application should call init() or connect()
00393      * before making any other API calls.
00394      */
00395     void wakeup_modem();
00396 
00397     /** True if the modem is not in PSM sleep
00398      * otherwise false.
00399      */
00400     bool is_modem_awake();
00401 #endif
00402 
00403 protected:
00404 
00405     #define OUTPUT_ENTER_KEY  "\r"
00406 
00407     #if MBED_CONF_UBLOX_CELL_GEN_DRV_AT_PARSER_BUFFER_SIZE
00408     #define AT_PARSER_BUFFER_SIZE   MBED_CONF_UBLOX_CELL_GEN_DRV_AT_PARSER_BUFFER_SIZE
00409     #else
00410     #define AT_PARSER_BUFFER_SIZE   256
00411     #endif
00412 
00413     #if MBED_CONF_UBLOX_CELL_GEN_DRV_AT_PARSER_TIMEOUT
00414     #define AT_PARSER_TIMEOUT       MBED_CONF_UBLOX_CELL_GEN_DRV_AT_PARSER_TIMEOUT
00415     #else
00416     #define AT_PARSER_TIMEOUT       8*1000 // Milliseconds
00417     #endif
00418 
00419     /** A string that would not normally be sent by the modem on the AT interface.
00420      */
00421     #define UNNATURAL_STRING "\x01"
00422 
00423     /** Supported u-blox modem variants.
00424      */
00425     typedef enum {
00426         DEV_TYPE_NONE = 0,
00427         DEV_SARA_G35,
00428         DEV_LISA_U2,
00429         DEV_LISA_U2_03S,
00430         DEV_SARA_U2,
00431         DEV_SARA_R4,
00432         DEV_LEON_G2,
00433         DEV_TOBY_L2,
00434         DEV_MPCI_L2
00435     } DeviceType;
00436 
00437     /** Network registration status.
00438      * UBX-13001820 - AT Commands Example Application Note (Section 4.1.4.5).
00439      */
00440     typedef enum {
00441        GSM = 0,
00442        COMPACT_GSM = 1,
00443        UTRAN = 2,
00444        EDGE = 3,
00445        HSDPA = 4,
00446        HSUPA = 5,
00447        HSDPA_HSUPA = 6,
00448        LTE = 7,
00449        EC_GSM_IoT = 8,
00450        E_UTRAN_NB_S1 = 9
00451     } RadioAccessNetworkType;
00452 
00453     /** Info about the modem.
00454      */
00455     typedef struct {
00456         DeviceType dev;
00457         char iccid[20 + 1];   //!< Integrated Circuit Card ID.
00458         char imsi[15 + 1];    //!< International Mobile Station Identity.
00459         char imei[15 + 1];    //!< International Mobile Equipment Identity.
00460         char meid[18 + 1];    //!< Mobile Equipment IDentifier.
00461         volatile RadioAccessNetworkType rat;  //!< Type of network (e.g. 2G, 3G, LTE).
00462         volatile NetworkRegistrationStatusCsd reg_status_csd; //!< Circuit switched attach status.
00463         volatile NetworkRegistrationStatusPsd reg_status_psd; //!< Packet switched attach status.
00464         volatile NetworkRegistrationStatusEps reg_status_eps; //!< Evolved Packet Switched (e.g. LTE) attach status.
00465 #ifdef TARGET_UBLOX_C030_R412M
00466         volatile ModemPSMState modem_psm_state; //!< last known modem PSM state
00467 #endif
00468     } DeviceInfo;
00469 
00470     /* IMPORTANT: the variables below are available to
00471      * classes that inherit this in order to keep things
00472      * simple. However, ONLY this class should free
00473      * any of the pointers, or there will be havoc.
00474      */
00475 
00476     /** Point to the instance of the AT parser in use.
00477      */
00478 #ifdef TARGET_UBLOX_C030_R41XM
00479     UbloxATCmdParser *_at;
00480 #else
00481     ATCmdParser *_at;
00482 #endif
00483 
00484     /** The current AT parser timeout value.
00485      */
00486     int _at_timeout;
00487 
00488     /** File handle used by the AT parser.
00489      */
00490     FileHandle *_fh;
00491 
00492     /** The mutex resource.
00493      */
00494     Mutex _mtx;
00495 
00496     /** General info about the modem as a device.
00497      */
00498     DeviceInfo _dev_info;
00499 
00500     /** The SIM PIN to use.
00501      */
00502     const char *_pin;
00503 
00504     /** Set to true to spit out debug traces.
00505      */
00506     bool _debug_trace_on;
00507     
00508     /** The baud rate to the modem.
00509      */
00510     int _baud;
00511 
00512     /** True if the modem is ready register to the network,
00513      * otherwise false.
00514      */
00515     bool _modem_initialised;
00516 
00517     /** True it the SIM requires a PIN, otherwise false.
00518      */
00519     bool _sim_pin_check_enabled;
00520 
00521     /** Sets the modem up for powering on
00522      *
00523      *  modem_init() is equivalent to plugging in the device, e.g., attaching power and serial port.
00524      *  Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
00525      */
00526     virtual void modem_init();
00527 
00528     /** Sets the modem in unplugged state
00529      *
00530      *  modem_deinit() will be equivalent to pulling the plug off of the device, i.e., detaching power
00531      *  and serial port. This puts the modem in lowest power state.
00532      *  Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
00533      */
00534     virtual void modem_deinit();
00535 
00536     /** Powers up the modem
00537      *
00538      *  modem_power_up() is equivalent to pressing the soft power button.
00539      *  The driver may repeat this if the modem is not responsive to AT commands.
00540      *  Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
00541      */
00542     virtual void modem_power_up();
00543 
00544     /** Powers down the modem
00545      *
00546      *  modem_power_down() is equivalent to turning off the modem by button press.
00547      *  Uses onboard_modem_api.h where the implementation of onboard_modem_api is provided by the target.
00548      */
00549     virtual void modem_power_down();
00550 
00551     /* Note: constructor and destructor protected so that this
00552     * class can only ever be inherited, never used directly.
00553     */
00554     UbloxCellularBase();
00555     ~UbloxCellularBase();
00556 
00557     /** Initialise this class.
00558      *
00559      * @param tx       the UART TX data pin to which the modem is attached.
00560      * @param rx       the UART RX data pin to which the modem is attached.
00561      * @param baud     the UART baud rate.
00562      * @param debug_on true to switch AT interface debug on, otherwise false.
00563      *
00564      * Note: it would be more natural to do this in the constructor
00565      * however, to avoid the diamond of death, this class is only
00566      * every inherited virtually.  Classes that are inherited virtually
00567      * do not get passed parameters in their constructor and hence
00568      * classInit() must be called separately by the first one to wake
00569      * the beast.
00570      */
00571     void baseClassInit(PinName tx = MDMTXD,
00572                        PinName rx = MDMRXD,
00573                        int baud = MBED_CONF_UBLOX_CELL_BAUD_RATE,
00574                        bool debug_on = false);
00575 
00576     /** Set the AT parser timeout.
00577      */
00578     void at_set_timeout(int timeout);
00579 
00580     /** Read up to size characters from buf
00581      * or until the character "end" is reached, overwriting
00582      * the newline with 0 and ensuring a terminator
00583      * in all cases.
00584      *
00585      * @param buf  the buffer to write to.
00586      * @param size the size of the buffer.
00587      * @param end  the character to stop at.
00588      * @return     the number of characters read,
00589      *             not including the terminator.
00590      */
00591     int read_at_to_char(char * buf, int size, char end);
00592 
00593     /** Powers up the modem.
00594      *
00595      * @return true if successful, otherwise false.
00596      */
00597     bool power_up();
00598 
00599     /** Power down the modem.
00600      */
00601     void power_down();
00602 
00603     /** Lock a mutex when accessing the modem.
00604      */
00605     void lock(void)     { _mtx.lock(); }
00606 
00607     /** Helper to make sure that lock unlock pair is always balanced
00608      */
00609     #define LOCK()         { lock()
00610 
00611     /** Unlock the modem when done accessing it.
00612      */
00613     void unlock(void)   { _mtx.unlock(); }
00614 
00615     /** Helper to make sure that lock unlock pair is always balanced
00616      */
00617     #define UNLOCK()       } unlock()
00618 
00619     /** Set the device identity in _dev_info
00620      * based on the ATI string returned by
00621      * the module.
00622      *
00623      * @return true if dev is a known value,
00624      *         otherwise false.
00625      */
00626     bool set_device_identity(DeviceType *dev);
00627 
00628     /** Perform any modem initialisation that is
00629      * specialised by device type.
00630      *
00631      * @return true if successful, otherwise false.
00632      */
00633     bool device_init(DeviceType dev);
00634 
00635     /** Set up the SIM.
00636      *
00637      * @return true if successful, otherwiss false.
00638      */
00639     bool initialise_sim_card();
00640 
00641 #ifdef TARGET_UBLOX_C030_R412M
00642     /** Converts the given uint to binary string. Fills the given str starting from [0] with the number of bits defined by bit_cnt
00643      *  For example uint_to_binary_string(9, str, 10) would fill str "0000001001"
00644      *  For example uint_to_binary_string(9, str, 3) would fill str "001"
00645      *
00646      *  @param num       uint to converts to binary string
00647      *  @param str       buffer for converted binary string
00648      *  @param str_size  size of the str buffer
00649      *  @param bit_cnt   defines how many bits are filled to buffer started from lsb
00650      */
00651     void uint_to_binary_str(uint32_t num, char* str, int str_size, int bit_cnt);
00652 #endif
00653 
00654 private:
00655 
00656     void set_nwk_reg_status_csd(int status);
00657     void set_nwk_reg_status_psd(int status);
00658     void set_nwk_reg_status_eps(int status);
00659     void set_rat(int AcTStatus);
00660     bool get_iccid();
00661     bool get_imsi();
00662     bool get_imei();
00663     bool get_meid();
00664     bool set_sms();
00665     void parser_abort_cb();
00666     void CMX_ERROR_URC();
00667     void CREG_URC();
00668     void CGREG_URC();
00669     void CEREG_URC();
00670     void UMWI_URC();
00671 #ifdef TARGET_UBLOX_C030_R412M
00672     void UUPSMR_URC();
00673     bool _psm_status;
00674     void *_cb_param_psm_going_in;
00675     Callback<void(void*)>    _func_psm_going_in;  /**< Callback. */
00676     void *_cb_param_psm_coming_out;
00677     Callback<void(void*)>    _func_psm_coming_out;  /**< Callback. */
00678     void set_modem_psm_state(int state);
00679 #endif
00680 };
00681 
00682 #endif // _UBLOX_CELLULAR_BASE_
00683