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