ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

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      *  @return         0 on success, negative error code on failure
00043      */
00044     virtual nsapi_error_t set_credentials(const char *apn,
00045             const char *username = 0, const char *password = 0) = 0;
00046 
00047     /** Start the interface
00048      *
00049      *  @param apn      Optional name of the network to connect to
00050      *  @param username Optional username for your APN
00051      *  @param password Optional password for your APN 
00052      *  @return         0 on success, negative error code on failure
00053      */
00054     virtual nsapi_error_t connect(const char *apn,
00055             const char *username = 0, const char *password = 0) = 0;
00056 
00057     /** Start the interface
00058      *
00059      *  Attempts to connect to a cellular network based on supplied credentials
00060      *
00061      *  @return         0 on success, negative error code on failure
00062      */
00063     virtual nsapi_error_t connect() = 0;
00064  
00065     /** Stop the interface
00066      *
00067      *  @return         0 on success, negative error code on failure
00068      */
00069     virtual nsapi_error_t disconnect() = 0;
00070 };
00071 
00072  
00073 #endif
00074 
00075 /** @}*/