Rizky Ardi Maulana / mbed-os
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CellularInterface.h Source File

CellularInterface.h

00001 
00002 /** \addtogroup netsocket */
00003 /** @{*/
00004 /* CellularInterface
00005  * Copyright (c) 2015 ARM Limited
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019  
00020 #ifndef CELLULAR_INTERFACE_H
00021 #define CELLULAR_INTERFACE_H
00022  
00023 #include "netsocket/NetworkInterface.h"
00024  
00025 
00026 /** CellularInterface class
00027  *
00028  *  Common interface that is shared between ethernet hardware
00029  */
00030 class CellularInterface : public NetworkInterface
00031 {
00032 public:
00033     /** CellularInterface lifetime
00034      */
00035     virtual ~CellularInterface() {};
00036 
00037     /** Set the cellular network APN and credentials
00038      *
00039      *  @param apn      Optional name of the network to connect to
00040      *  @param user     Optional username for the APN
00041      *  @param pass     Optional password fot the APN
00042      */
00043     virtual int set_credentials(const char *apn, const char *user = 0, const char *pass = 0) = 0;
00044 
00045     /** Start the interface
00046      *
00047      *  @param apn      Optional name of the network to connect to
00048      *  @param username Optional username for your APN
00049      *  @param password Optional password for your APN 
00050      *  @return         0 on success, negative error code on failure
00051      */
00052     virtual int connect(const char *apn, const char *username = 0, const char *password = 0) = 0;
00053 
00054     /** Start the interface
00055      *
00056      *  Attempts to connect to a cellular network based on supplied credentials
00057      *
00058      *  @return         0 on success, negative error code on failure
00059      */
00060     virtual int connect() = 0;
00061  
00062     /** Stop the interface
00063      *
00064      *  @return         0 on success, negative error code on failure
00065      */
00066     virtual int disconnect() = 0;
00067 };
00068 
00069  
00070 #endif
00071 
00072 /** @}*/