Marco Zecchini
/
Example_RTOS
Rtos API example
mbed-os/features/netsocket/CellularInterface.h@0:9fca2b23d0ba, 2019-02-23 (annotated)
- Committer:
- marcozecchini
- Date:
- Sat Feb 23 12:13:36 2019 +0000
- Revision:
- 0:9fca2b23d0ba
final commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcozecchini | 0:9fca2b23d0ba | 1 | /* CellularInterface |
marcozecchini | 0:9fca2b23d0ba | 2 | * Copyright (c) 2015 ARM Limited |
marcozecchini | 0:9fca2b23d0ba | 3 | * |
marcozecchini | 0:9fca2b23d0ba | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
marcozecchini | 0:9fca2b23d0ba | 5 | * you may not use this file except in compliance with the License. |
marcozecchini | 0:9fca2b23d0ba | 6 | * You may obtain a copy of the License at |
marcozecchini | 0:9fca2b23d0ba | 7 | * |
marcozecchini | 0:9fca2b23d0ba | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
marcozecchini | 0:9fca2b23d0ba | 9 | * |
marcozecchini | 0:9fca2b23d0ba | 10 | * Unless required by applicable law or agreed to in writing, software |
marcozecchini | 0:9fca2b23d0ba | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
marcozecchini | 0:9fca2b23d0ba | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
marcozecchini | 0:9fca2b23d0ba | 13 | * See the License for the specific language governing permissions and |
marcozecchini | 0:9fca2b23d0ba | 14 | * limitations under the License. |
marcozecchini | 0:9fca2b23d0ba | 15 | */ |
marcozecchini | 0:9fca2b23d0ba | 16 | |
marcozecchini | 0:9fca2b23d0ba | 17 | #ifndef CELLULAR_INTERFACE_H |
marcozecchini | 0:9fca2b23d0ba | 18 | #define CELLULAR_INTERFACE_H |
marcozecchini | 0:9fca2b23d0ba | 19 | |
marcozecchini | 0:9fca2b23d0ba | 20 | #include "netsocket/NetworkInterface.h" |
marcozecchini | 0:9fca2b23d0ba | 21 | |
marcozecchini | 0:9fca2b23d0ba | 22 | |
marcozecchini | 0:9fca2b23d0ba | 23 | /** CellularInterface class |
marcozecchini | 0:9fca2b23d0ba | 24 | * |
marcozecchini | 0:9fca2b23d0ba | 25 | * Common interface that is shared between ethernet hardware |
marcozecchini | 0:9fca2b23d0ba | 26 | * @addtogroup netsocket |
marcozecchini | 0:9fca2b23d0ba | 27 | */ |
marcozecchini | 0:9fca2b23d0ba | 28 | class CellularInterface : public NetworkInterface |
marcozecchini | 0:9fca2b23d0ba | 29 | { |
marcozecchini | 0:9fca2b23d0ba | 30 | public: |
marcozecchini | 0:9fca2b23d0ba | 31 | /** CellularInterface lifetime |
marcozecchini | 0:9fca2b23d0ba | 32 | */ |
marcozecchini | 0:9fca2b23d0ba | 33 | virtual ~CellularInterface() {}; |
marcozecchini | 0:9fca2b23d0ba | 34 | |
marcozecchini | 0:9fca2b23d0ba | 35 | /** Set the cellular network APN and credentials |
marcozecchini | 0:9fca2b23d0ba | 36 | * |
marcozecchini | 0:9fca2b23d0ba | 37 | * @param apn Optional name of the network to connect to |
marcozecchini | 0:9fca2b23d0ba | 38 | * @param username Optional username for the APN |
marcozecchini | 0:9fca2b23d0ba | 39 | * @param password Optional password fot the APN |
marcozecchini | 0:9fca2b23d0ba | 40 | * @return 0 on success, negative error code on failure |
marcozecchini | 0:9fca2b23d0ba | 41 | */ |
marcozecchini | 0:9fca2b23d0ba | 42 | virtual nsapi_error_t set_credentials(const char *apn, |
marcozecchini | 0:9fca2b23d0ba | 43 | const char *username = 0, const char *password = 0) = 0; |
marcozecchini | 0:9fca2b23d0ba | 44 | |
marcozecchini | 0:9fca2b23d0ba | 45 | /** Start the interface |
marcozecchini | 0:9fca2b23d0ba | 46 | * |
marcozecchini | 0:9fca2b23d0ba | 47 | * @param apn Optional name of the network to connect to |
marcozecchini | 0:9fca2b23d0ba | 48 | * @param username Optional username for your APN |
marcozecchini | 0:9fca2b23d0ba | 49 | * @param password Optional password for your APN |
marcozecchini | 0:9fca2b23d0ba | 50 | * @return 0 on success, negative error code on failure |
marcozecchini | 0:9fca2b23d0ba | 51 | */ |
marcozecchini | 0:9fca2b23d0ba | 52 | virtual nsapi_error_t connect(const char *apn, |
marcozecchini | 0:9fca2b23d0ba | 53 | const char *username = 0, const char *password = 0) = 0; |
marcozecchini | 0:9fca2b23d0ba | 54 | |
marcozecchini | 0:9fca2b23d0ba | 55 | /** Start the interface |
marcozecchini | 0:9fca2b23d0ba | 56 | * |
marcozecchini | 0:9fca2b23d0ba | 57 | * Attempts to connect to a cellular network based on supplied credentials |
marcozecchini | 0:9fca2b23d0ba | 58 | * |
marcozecchini | 0:9fca2b23d0ba | 59 | * @return 0 on success, negative error code on failure |
marcozecchini | 0:9fca2b23d0ba | 60 | */ |
marcozecchini | 0:9fca2b23d0ba | 61 | virtual nsapi_error_t connect() = 0; |
marcozecchini | 0:9fca2b23d0ba | 62 | |
marcozecchini | 0:9fca2b23d0ba | 63 | /** Stop the interface |
marcozecchini | 0:9fca2b23d0ba | 64 | * |
marcozecchini | 0:9fca2b23d0ba | 65 | * @return 0 on success, negative error code on failure |
marcozecchini | 0:9fca2b23d0ba | 66 | */ |
marcozecchini | 0:9fca2b23d0ba | 67 | virtual nsapi_error_t disconnect() = 0; |
marcozecchini | 0:9fca2b23d0ba | 68 | }; |
marcozecchini | 0:9fca2b23d0ba | 69 | |
marcozecchini | 0:9fca2b23d0ba | 70 | |
marcozecchini | 0:9fca2b23d0ba | 71 | #endif |