ublox-at-cellular-interface-ext

Dependencies:   ublox-at-cellular-interface

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UbloxATCellularInterfaceExt.h Source File

UbloxATCellularInterfaceExt.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_AT_CELLULAR_INTERFACE_EXT_
00017 #define _UBLOX_AT_CELLULAR_INTERFACE_EXT_
00018 
00019 #include "UbloxATCellularInterface.h"
00020 #include "UbloxCellularDriverGen.h"
00021 
00022 /**UbloxATCellularInterfaceExt class.
00023  *
00024  * This interface extends the UbloxATCellularInterface to
00025  * include other features that use the IP stack on board the
00026  * cellular modem: HTTP, FTP and Cell Locate.
00027  *
00028  * Note: the UbloxCellularGeneric class is required because
00029  * reading a large HTTP response is performed via a modem
00030  * file system call and the UbloxCellularGeneric class is
00031  * where modem file system support is provided.
00032  */
00033 class UbloxATCellularInterfaceExt : public  UbloxATCellularInterface, public UbloxCellularDriverGen {
00034 
00035 public:
00036     /** Constructor.
00037      *
00038      * @param tx       the UART TX data pin to which the modem is attached.
00039      * @param rx       the UART RX data pin to which the modem is attached.
00040      * @param baud     the UART baud rate.
00041      * @param debugOn  true to switch AT interface debug on, otherwise false.
00042      */
00043     UbloxATCellularInterfaceExt(PinName tx = MDMTXD,
00044                                 PinName rx = MDMRXD,
00045                                 int baud = MBED_CONF_UBLOX_CELL_BAUD_RATE,
00046                                 bool debugOn = false,
00047                                 osPriority priority = osPriorityNormal);
00048 
00049      /* Destructor.
00050       */
00051      virtual ~UbloxATCellularInterfaceExt();
00052 
00053     /**********************************************************************
00054      * PUBLIC: General
00055      **********************************************************************/
00056 
00057     /** Infinite timeout.
00058      */
00059     #define TIMEOUT_BLOCKING -1
00060 
00061     /** A struct containing an HTTP or FTP error class and code
00062      */
00063      typedef struct {
00064         int eClass;
00065         int eCode;
00066     } Error;
00067 
00068     /**********************************************************************
00069      * PUBLIC: HTTP
00070      **********************************************************************/
00071 
00072     /** HTTP profile unused marker.
00073      */
00074     #define HTTP_PROF_UNUSED -1
00075 
00076     /** HTTP configuration parameters (reference to HTTP control +UHTTP).
00077      */
00078     typedef enum {
00079         HTTP_IP_ADDRESS = 0,
00080         HTTP_SERVER_NAME = 1,
00081         HTTP_USER_NAME = 2,
00082         HTTP_PASSWORD = 3,
00083         HTTP_AUTH_TYPE = 4,
00084         HTTP_SERVER_PORT = 5,
00085         HTTP_SECURE = 6,
00086         HTTP_REQ_HEADER = 9
00087     } HttpOpCode;
00088 
00089     /** Type of HTTP Command.
00090      */
00091     typedef enum {
00092         HTTP_HEAD = 0,
00093         HTTP_GET = 1,
00094         HTTP_DELETE = 2,
00095         HTTP_PUT = 3,
00096         HTTP_POST_FILE = 4,
00097         HTTP_POST_DATA = 5
00098     } HttpCmd;
00099 
00100     /** HTTP content types.
00101      */
00102     typedef enum {
00103         HTTP_CONTENT_URLENCODED = 0,
00104         HTTP_CONTENT_TEXT = 1,
00105         HTTP_CONTENT_OCTET_STREAM = 2,
00106         HTTP_CONTENT_FORM_DATA = 3,
00107         HTTP_CONTENT_JSON = 4,
00108         HTTP_CONTENT_XML = 5,
00109         HTTP_CONTENT_USER_DEFINED = 6
00110     } HttpContentType;
00111 
00112     /** Find a free HTTP profile.
00113      *
00114      * A profile will be blocking when first allocated.
00115      *
00116      * @return the profile or negative if none are available.
00117      */
00118     int httpAllocProfile();
00119     
00120     /** Free the HTTP profile.
00121      *
00122      * @param profile the HTTP profile handle.
00123      * @return           true if successful, otherwise false.
00124      */
00125     bool httpFreeProfile(int profile);
00126 
00127     /** Set the timeout for this profile.
00128      *
00129      * @param profile    the HTTP profile handle.
00130      * @param timeout    -1 blocking, else non-blocking timeout in milliseconds.
00131      * @return           true if successful, otherwise false.
00132      */
00133     bool httpSetTimeout(int profile, int timeout);
00134     
00135     /** Reset a HTTP profile back to defaults.
00136      *
00137      * This may be called if the state of a HTTP profile
00138      * during parameter setting or exchange of HTTP commands
00139      * has become confusing/unknown.
00140      *
00141      * @param httpProfile the HTTP profile to be reset.
00142      * @return            true if successful, false otherwise.
00143      */
00144     bool httpResetProfile(int httpProfile);
00145     
00146     /** Set HTTP parameters.
00147      *
00148      * This should be called as many times as is necessary
00149      * to set all the possible parameters (HttpOpCode).
00150      *
00151      * See section 28.1 of u-blox-ATCommands_Manual(UBX-13002752).pdf
00152      * for full details.  By example:
00153      *
00154      * httpOpCode          httpInPar
00155      * HTTP_IP_ADDRESS     "145.33.18.10" (the target HTTP server IP address)
00156      * HTTP_SERVER_NAME    "www.myhttpserver.com" (the target HTTP server name)
00157      * HTTP_USER_NAME      "my_username"
00158      * HTTP_PASSWORD       "my_password"
00159      * HTTP_AUTH_TYPE      "0" for no authentication, "1" for username/password
00160      *                     authentication (the default is 0)
00161      * HTTP_SERVER_PORT    "81" (default is port 80)
00162      * HTTP_SECURE         "0" for no security, "1" for TLS (the default is 0),
00163      *                     not all modems support this parameter
00164      *
00165      * @param httpProfile the HTTP profile identifier.
00166      * @param httpOpCode  the HTTP operation code.
00167      * @param httpInPar   the HTTP input parameter.
00168      * @return            true if successful, false otherwise.
00169      */
00170     bool httpSetPar(int httpProfile, HttpOpCode httpOpCode, const char * httpInPar);
00171     
00172     /** Perform a HTTP command.
00173      *
00174      * See section 28.3 of u-blox-ATCommands_Manual(UBX-13002752).pdf
00175      * for full details.  By example, it works like this:
00176      *
00177      * httpCmd        httpPath       rspFile     sendStr  httpContentType httpCustomPar
00178      * HEAD       "path/file.html"     NULL       NULL         0             NULL
00179      * GET        "path/file.html"     NULL       NULL         0             NULL
00180      * DELETE     "path/file.html"     NULL       NULL         0             NULL
00181      * PUT        "path/file.html"     NULL    "myfile.txt"  0 to 6         Note 1
00182      * POST_FILE  "path/file.html"     NULL    "myfile.txt"  0 to 6         Note 1
00183      * POST       "path/file.html"     NULL   "hello there!" 0 to 6         Note 1
00184      *
00185      * Note 1: httpCustomPar is only applicable when httpContentType = HTTP_CONTENT_USER_DEFINED.
00186      *
00187      * The server to which this command is directed must have previously been
00188      * set with a call to httpSetPar().  If the server requires TLS (i.e. "HTTPS"),
00189      * then set that up with httpSetPar() also (HTTP_SECURE).
00190      *
00191      * rspFile may be left as NULL as the server response will be returned in buf.
00192      * Alternatively, a rspFile may be given (e.g. "myresponse.txt") and this can
00193      * later be read from the modem file system using readFile().
00194      *
00195      * @param httpProfile     the HTTP profile identifier.
00196      * @param httpCmd         the HTTP command.
00197      * @param httpPath        the path of resource on the HTTP server.
00198      * @param rspFile         the local modem file where the server
00199      *                        response will be stored, use NULL for
00200      *                        don't care.
00201      * @param sendStr         the filename or string to be sent
00202      *                        to the HTTP server with the command request.
00203      * @param httpContentType the HTTP Content-Type identifier.
00204      * @param httpCustomPar   the parameter for a user defined HTTP Content-Type.
00205      * @param buf             the buffer to read into.
00206      * @param len             the size of the buffer to read into.
00207      * @param read_size       Zero initialized variable address
00208      * @return                NULL if successful, otherwise a pointer to
00209      *                        a Error struct containing the error class and error
00210      *                        code, see section Appendix A.B of
00211      *                        u-blox-ATCommands_Manual(UBX-13002752).pdf for details.
00212      */
00213     Error * httpCommand(int httpProfile, HttpCmd httpCmd, const char* httpPath,
00214                         const char* rspFile, const char* sendStr,
00215                         int httpContentType, const char* httpCustomPar,
00216                         char* buf, int len, int *read_size = NULL);
00217 
00218     /**********************************************************************
00219      * PUBLIC: FTP
00220      **********************************************************************/
00221 
00222     /** FTP configuration parameters (reference to FTP control +UFTP).
00223      */
00224     typedef enum {
00225         FTP_IP_ADDRESS = 0,
00226         FTP_SERVER_NAME = 1,
00227         FTP_USER_NAME = 2,
00228         FTP_PASSWORD = 3,
00229         FTP_ACCOUNT = 4,
00230         FTP_INACTIVITY_TIMEOUT = 5,
00231         FTP_MODE = 6,
00232         FTP_SERVER_PORT = 7,
00233         FTP_SECURE = 8,
00234         NUM_FTP_OP_CODES
00235     } FtpOpCode;
00236 
00237     /** Type of FTP Command.
00238      */
00239     typedef enum {
00240         FTP_LOGOUT = 0,
00241         FTP_LOGIN = 1,
00242         FTP_DELETE_FILE = 2,
00243         FTP_RENAME_FILE = 3,
00244         FTP_GET_FILE = 4,
00245         FTP_PUT_FILE = 5,
00246         FTP_GET_DIRECT = 6,
00247         FTP_PUT_DIRECT = 7,
00248         FTP_CD = 8,
00249         FTP_MKDIR = 10,
00250         FTP_RMDIR = 11,
00251         FTP_FILE_INFO = 13,
00252         FTP_LS = 14,
00253         FTP_FOTA_FILE = 100
00254     } FtpCmd;
00255 
00256     /** Set the timeout for FTP operations.
00257      *
00258      * @param timeout -1 blocking, else non-blocking timeout in milliseconds.
00259      * @return         true if successful, otherwise false.
00260      */
00261     bool ftpSetTimeout(int timeout);
00262 
00263     /** Reset the FTP configuration back to defaults.
00264      */
00265     void ftpResetPar();
00266     
00267     /** Set FTP parameters.
00268      *
00269      * This should be called as many times as is necessary
00270      * to set all the possible parameters (FtpOpCode).
00271      *
00272      * See section 27.1 of u-blox-ATCommands_Manual(UBX-13002752).pdf
00273      * for full details.  By example:
00274      *
00275      * ftpOpCode              ftpInPar
00276      * FTP_IP_ADDRESS         "145.33.18.10" (the target FTP server IP address)
00277      * FTP_SERVER_NAME        "www.ftpserver.com" (the target FTP server name)
00278      * FTP_USER_NAME          "my_username"
00279      * FTP_PASSWORD           "my_password"
00280      * FTP_ACCOUNT            "my_account" (not required by most FTP servers)
00281      * FTP_INACTIVITY_TIMEOUT "60" (the default is 0, which means no timeout)
00282      * FTP_MODE               "0" for active, "1" for passive (the default is 0) 
00283      * FTP_SERVER_PORT        "25" (default is port 21)
00284      * FTP_SECURE             "0" for no security, "1" for SFTP (the default is 0)
00285      *
00286      * @param ftpOpCode  the FTP operation code.
00287      * @param ftpInPar   the FTP input parameter.
00288      * @return           true if successful, false otherwise.
00289      */
00290     bool ftpSetPar(FtpOpCode ftpOpCode, const char * ftpInPar);
00291     
00292     /** Perform an FTP command.
00293      *
00294      * Connect() must have been called previously to establish a data
00295      * connection.
00296      *
00297      * See section 27.2 of u-blox-ATCommands_Manual(UBX-13002752).pdf
00298      * for full details.  By example, it works like this:
00299      *
00300      * ftpCmd               file1      file2    buf     len  offset
00301      * FTP_LOGOUT            N/A        N/A     N/A     N/A    N/A 
00302      * FTP_LOGIN             N/A        N/A     N/A     N/A    N/A 
00303      * FTP_DELETE_FILE   "the_file"     N/A     N/A     N/A    N/A
00304      * FTP_RENAME_FILE   "old_name"  "new_name" N/A     N/A    N/A 
00305      * FTP_GET_FILE      "the_file"    Note 1   N/A     N/A   0 - 1    (Notes 2 & 3)
00306      * FTP_PUT_FILE      "the_file"    Note 1   N/A     N/A  0 - 65535 (Notes 2 & 4 & 5)
00307      * FTP_CD            "dir1\dir2"    N/A     N/A     N/A    N/A 
00308      * FTP_MKDIR         "newdir"       N/A     N/A     N/A    N/A 
00309      * FTP_RMDIR         "dir"          N/A     N/A     N/A    N/A 
00310      * FTP_FILE_INFO     "the_path"     N/A        Note 6      N/A
00311      * FTP_LS            "the_path"     N/A        Note 6      N/A
00312      * FTP_FOTA_FILE     "the_file"     N/A        Note 7      N/A
00313      *
00314      * Note 1: for this case, file2 is the name that the file should be
00315      * given when it arrives (in the modem file system for a GET, at the FTP
00316      * server for a PUT); if set to NULL then file1 is used.
00317      * Note 2: the file will placed into the modem file system for the
00318      * GET case (and can be read with readFile()), or must already be in the
00319      * modem file system, (can be written using writeFile()) for the PUT case.
00320      * Note 3: if offset is 1 then, where supported, the FTP GET
00321      * will be continued from the point it previously stopped.
00322      * Note 4: if the file already exists in the modem file system some
00323      * modems will return an error.  It is up to the caller to ensure that
00324      * the file does not exist before the FTP PUT operation.
00325      * Note 5: where supported, offset is the position in the file to continue
00326      * the FTP PUT from.
00327      * Note 6: buf should point to the location where the file info
00328      * or directory listing is to be stored and len should be the maximum
00329      * length that can be stored.
00330      * Note 7: a hex string representing the MD5 sum of the FOTA file will be
00331      * stored at buf; len must be at least 32 as an MD5 sum is 16 bytes.
00332      * FTP_FOTA_FILE is not supported on SARA-U2.
00333      * Note 8: FTP_GET_DIRECT and FTP_PUT_DIRECT are not supported by
00334      * this driver.
00335      *
00336      * @param ftpCmd     the FTP command.
00337      * @param file1      the first file name if required (NULL otherwise).
00338      * @param file2      the second file name if required (NULL otherwise).
00339      * @param buf        pointer to a buffer, required for FTP_DIRECT mode
00340      *                   and FTP_LS only.
00341      * @param len        the size of buf.
00342      * @param continue   if true then attempt to continue a download that
00343      *                   was previously interrupted.
00344      * @return           NULL if successful, otherwise a pointer to
00345      *                   a Error struct containing the error class and error
00346      *                   code, see section Appendix A.B of
00347      *                   u-blox-ATCommands_Manual(UBX-13002752).pdf for details.
00348      */
00349     Error *ftpCommand(FtpCmd ftpCmd, const char* file1 = NULL, const char* file2 = NULL,
00350                       char* buf = NULL, int len = 0, int offset = 0);
00351 
00352     /**********************************************************************
00353      * PUBLIC: Cell Locate
00354      **********************************************************************/
00355  
00356     /** Which form of Cell Locate sensing to use.
00357      */
00358     typedef enum {
00359         CELL_LAST,
00360         CELL_GNSS,
00361         CELL_LOCATE,
00362         CELL_HYBRID
00363     } CellSensType;
00364 
00365     /** Types of Cell Locate response.
00366      */
00367     typedef enum {
00368         CELL_DETAILED = 1,
00369         CELL_MULTIHYP = 2
00370     } CellRespType;
00371 
00372     /** Cell Locate data.
00373      */
00374     typedef struct {
00375         volatile bool validData;      //!< Flag for indicating if data is valid.
00376         volatile struct tm time;      //!< GPS Timestamp.
00377         volatile float longitude;     //!< Estimated longitude, in degrees.
00378         volatile float latitude;      //!< Estimated latitude, in degrees.
00379         volatile int altitude;        //!< Estimated altitude, in meters^2.
00380         volatile int uncertainty;     //!< Maximum possible error, in meters.
00381         volatile int speed;           //!< Speed over ground m/s^2.
00382         volatile int direction;       //!< Course over ground in degrees.
00383         volatile int verticalAcc;     //!< Vertical accuracy, in meters^2.
00384         volatile CellSensType sensor; //!< Sensor used for last calculation.
00385         volatile int svUsed;          //!< number of satellite used.
00386     } CellLocData;
00387 
00388     /** Configure the Cell Locate TCP aiding server.
00389      *
00390      * Connect() must have been called previously to establish
00391      * a data connection.
00392      *
00393      * @param server_1   host name of the primary MGA server.
00394      * @param server_2   host name of the secondary MGA server.
00395      * @param token      authentication token for MGA server access.
00396      * @param days       the number of days into the future the off-line
00397      *                   data for the u-blox 7.
00398      * @param period     the number of weeks into the future the off-line
00399      *                   data for u-blox M8.
00400      * @param resolution resolution of off-line data for u-blox M8: 1 every
00401      *                   day, 0 every other day.
00402      * @return           true if the request is successful, otherwise false.
00403      */
00404     bool cellLocSrvTcp(const char* token, const char* server_1 = "cell-live1.services.u-blox.com",
00405                        const char* server_2 = "cell-live2.services.u-blox.com",
00406                        int days = 14, int period = 4, int resolution = 1);
00407  
00408     /** Configure Cell Locate UDP aiding server.
00409      *
00410      * Connect() must have been called previously to establish
00411      * a data connection.
00412      *
00413      * @param server_1   host name of the primary MGA server.
00414      * @param port       server port.
00415      * @param latency    expected network latency in seconds from 0 to 10000 milliseconds.
00416      * @param mode       Assist Now management, mode of operation:
00417      *                   0 data downloaded at GNSS power up,
00418      *                   1 automatically kept alive, manual download.
00419      * @return           true if the request is successful, otherwise false.
00420      */
00421     bool cellLocSrvUdp(const char* server_1 = "cell-live1.services.u-blox.com",
00422                        int port = 46434, int latency = 1000, int mode = 0);
00423  
00424     /** Configure Cell Locate location sensor.
00425      *
00426      * @param scanMode network scan mode: 0 normal, 1 deep scan.
00427      * @return         true if the request is successful, otherwise false.
00428      */
00429     bool cellLocConfig(int scanMode);
00430  
00431     /** Request a one-shot Cell Locate.
00432      *
00433      * This function is non-blocking, the result is retrieved using cellLocGetxxx.
00434      *
00435      * Note: none of the CellLocate methods switch on the GNSS receiver chip.
00436      * That should be done by instantiating the GnssSerial or GnssI2C classes and
00437      * calling the init() method.
00438      *
00439      * Note: during the location process, unsolicited result codes will be returned
00440      * by the modem indicating progress and potentially flagging interesting errors.
00441      * In order to see these errors, instantiate this class with debugOn set to true.
00442      *   
00443      * @param sensor     sensor selection.
00444      * @param timeout    timeout period in seconds (1 - 999).
00445      * @param accuracy   target accuracy in meters (1 - 999999).
00446      * @param type       detailed or multi-hypothesis.
00447      * @param hypothesis maximum desired number of responses from CellLocate (up to 16),
00448      *                   must be 1 if type is CELL_DETAILED.
00449      * @return           true if the request is successful, otherwise false.
00450      */
00451     bool cellLocRequest(CellSensType sensor, int timeout, int accuracy,
00452                         CellRespType type = CELL_DETAILED, int hypothesis = 1);
00453 
00454     /** Get a position record.
00455      *
00456      * @param data  pointer to a CellLocData structure where the location will be put.
00457      * @param index of the position to retrieve.
00458      * @return      true if data has been retrieved and copied, false otherwise.
00459      */
00460     bool cellLocGetData(CellLocData *data, int index = 0);
00461     
00462     /** Get the number of position records received.
00463      *
00464      * @return number of position records received.
00465      */
00466     int cellLocGetRes();
00467     
00468     /** Get the number of position records expected to be received.
00469      *
00470      * @return number of position records expected to be received.
00471      */
00472     int cellLocGetExpRes();
00473     
00474 protected:
00475 
00476     /**********************************************************************
00477      * PROTECTED: HTTP
00478      **********************************************************************/
00479 
00480     /** Check for timeout.
00481      */
00482     #define TIMEOUT(t, ms)  ((ms != TIMEOUT_BLOCKING) && (ms < t.read_ms()))
00483 
00484     /** Check for a valid profile.
00485      */
00486     #define IS_PROFILE(p) (((p) >= 0) && (((unsigned int) p) < (sizeof(_httpProfiles)/sizeof(_httpProfiles[0]))) \
00487                            && (_httpProfiles[p].modemHandle != HTTP_PROF_UNUSED))
00488 
00489     /** Management structure for HTTP profiles.
00490      *
00491      * It is possible to have up to 4 different HTTP profiles (LISA-C200, LISA-U200 and SARA-G350) having:
00492      *
00493      * @param handle     the current HTTP profile is in handling state or not (default value is HTTP_ERROR).
00494      * @param timeout    the timeout for the current HTTP command.
00495      * @param pending    the status for the current HTTP command (in processing state or not).
00496      * @param cmd        the code for the current HTTP command.
00497      * @param result     the result for the current HTTP command once processed.
00498      */
00499      typedef struct {
00500          int modemHandle;
00501          int timeout;
00502          volatile bool pending;
00503          volatile int cmd;
00504          volatile int result;
00505          Error httpError;
00506      } HttpProfCtrl;
00507 
00508     /** The HTTP profile storage.
00509      */
00510     HttpProfCtrl _httpProfiles[4];
00511 
00512     /** Callback to capture the response to an HTTP command.
00513      */
00514     void UUHTTPCR_URC();
00515 
00516     /** Find a profile with a given handle.  If no handle is given, find the next
00517      * free profile.
00518      *
00519      * @param modemHandle the handle of the profile to find.
00520      * @return            the profile handle or negative if not found/created.
00521      */
00522     int findProfile(int modemHandle = HTTP_PROF_UNUSED);
00523 
00524     /** Helper function to get a HTTP command as a text string, useful
00525      * for debug purposes.
00526      *
00527      * @param httpCmdCode the HTTP command.
00528      * @return            HTTP command in string format.
00529      */
00530     const char* getHttpCmd(HttpCmd httpCmd);
00531 
00532     /**********************************************************************
00533      * PROTECTED: FTP
00534      **********************************************************************/
00535 
00536     /** Unused FTP op code marker.
00537      */
00538     #define FTP_OP_CODE_UNUSED -1
00539 
00540     /** The FTP timeout in milliseconds.
00541      */
00542     int _ftpTimeout;
00543 
00544     /** A place to store the FTP op code for the last result.
00545      */
00546     volatile int _lastFtpOpCodeResult;
00547 
00548     /** A place to store the last FTP result.
00549      */
00550     volatile int _lastFtpResult;
00551 
00552     /** A place to store the last FTP op code for data response.
00553      */
00554     volatile int _lastFtpOpCodeData;
00555 
00556     /** A place to store data returns from an FTP operation.
00557      */
00558     char * _ftpBuf;
00559 
00560     /** The length of FTP data that can be stored (at _ftpBuf).
00561      */
00562     int _ftpBufLen;
00563 
00564     /** storage for the last FTP error
00565      */
00566     Error _ftpError;
00567 
00568     /** Callback to capture the result of an FTP command.
00569      */
00570     void UUFTPCR_URC();
00571 
00572     /** Callback to capture data returned from an FTP command.
00573      */
00574     void UUFTPCD_URC();
00575 
00576     /** Helper function to get an FTP command as a text string, useful
00577      * for debug purposes.
00578      *
00579      * @param ftpCmdCode  the FTP command.
00580      * @return            FTP command in string format.
00581      */
00582     const char * getFtpCmd(FtpCmd ftpCmd);
00583 
00584     /**********************************************************************
00585      * PROTECTED: Cell Locate
00586      **********************************************************************/
00587 
00588     /**  The maximum number of hypotheses
00589      */
00590     #define CELL_MAX_HYP    (16 + 1)
00591 
00592     /** Received positions.
00593      */
00594     volatile int _locRcvPos;
00595 
00596     /** Expected positions.
00597      */
00598     volatile int _locExpPos;
00599 
00600     /**  The Cell Locate data.
00601      */
00602     CellLocData _loc[CELL_MAX_HYP];
00603 
00604     /** Buffer for the URC to work with
00605      */
00606     char urcBuf[128];
00607 
00608     /** Callback to capture +UULOCIND.
00609      */
00610     void UULOCIND_URC();
00611 
00612     /** Callback to capture +UULOC.
00613      */
00614     void UULOC_URC();
00615 };
00616 
00617 #endif // _UBLOX_AT_CELLULAR_INTERFACE_EXT_
00618