Skip to content

Commit f8c0620

Browse files
Deomid Ryabkovdimonomid
authored andcommitted
Basic PPPoS / cellullar modem support
Currently only for ESP32 and only as the sole connectivity method (not as a backup). PUBLISHED_FROM=747eac5aa1dcd4880449eaa24519c724ae52c924
1 parent a7096e0 commit f8c0620

File tree

6 files changed

+435
-0
lines changed

6 files changed

+435
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# PPPoS / cellullar modem support
2+
3+
This library provides IP over serial port. Encapsulation is PPP.
4+
5+
## Settings
6+
7+
```
8+
"pppos": {
9+
"enable": false, # Enable PPPoS
10+
"uart_no": 1, # Which UART to use.
11+
"baud_rate": 115200, # Baud rate, data mode is 8-N-1.
12+
"fc_enable": false, # Enable hardware CTS/RTS flow control
13+
"apn": "", # APN name
14+
"user": "", # User name
15+
"pass": "", # Password
16+
"connect_cmd": "ATDT*99***1#", # AT command to send to initiate PPP data mode
17+
"echo_interval": 10, # LCP Echo interval, seconds
18+
"echo_fails": 3, # Number of failed echos before connection is declared dead are retried
19+
"hexdump_enable": false # Dump all the data sent over UART to stderr
20+
}
21+
```
22+
23+
Default UART pin assignments are used and they can be found [here](https://github.com/cesanta/mongoose-os/blob/aa89bc237e4ba492e791a069617a5c6f74ee63f4/fw/platforms/esp32/src/esp32_uart.c#L228).
24+
25+
## Example configuration
26+
27+
Access Point Name, PPP username and password depend on the operator. They are usually public and can be found [here](http://wiki.apnchanger.org/Main_Page).
28+
29+
Here's an example for Vodafone Ireland:
30+
31+
```
32+
"pppos": {
33+
"enable": true,
34+
"uart_no": 1,
35+
"apn": "live.vodafone.ie",
36+
"user": "dublin",
37+
"pass": "dublin",
38+
}
39+
```

include/mgos_pppos.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2014-2017 Cesanta Software Limited
3+
* All rights reserved
4+
*/
5+
6+
#ifndef CS_MOS_LIBS_PPPOS_INCLUDE_MGOS_PPPOS_H_
7+
#define CS_MOS_LIBS_PPPOS_INCLUDE_MGOS_PPPOS_H_
8+
9+
#include "mgos_net.h"
10+
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif /* __cplusplus */
14+
15+
bool mgos_pppos_dev_get_ip_info(int if_instance,
16+
struct mgos_net_ip_info *ip_info);
17+
18+
#ifdef __cplusplus
19+
}
20+
#endif /* __cplusplus */
21+
22+
#endif /* CS_MOS_LIBS_PPPOS_INCLUDE_MGOS_PPPOS_H_ */

mos.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
author: mongoose-os
2+
description: PPPoS support
3+
type: lib
4+
version: 1.0
5+
6+
platforms: [ esp32 ]
7+
8+
includes: [ include ]
9+
sources: [ src ]
10+
11+
config_schema:
12+
- ["pppos", "o", {title: "PPPoS settings"}]
13+
- ["pppos.enable", "b", false, {title: "Enable PPPoS"}]
14+
- ["pppos.uart_no", "i", 1, {title: "Which UART to use"}]
15+
- ["pppos.baud_rate", "i", 115200, {title: "Baud rate"}]
16+
- ["pppos.fc_enable", "b", false, {title: "Enable hardware CTS/RTS flow control"}]
17+
# These depend on the operator and are usually well known.
18+
- ["pppos.apn", "s", "", {title: "APN name"}]
19+
- ["pppos.user", "s", "", {title: "User name"}]
20+
- ["pppos.pass", "s", "", {title: "Password"}]
21+
- ["pppos.connect_cmd", "s", "ATDT*99***1#", {title: "AT command to send to initiate PPP data mode"}]
22+
# Misc settings.
23+
- ["pppos.echo_interval", "i", 10, {title: "LCP Echo interval, seconds"}]
24+
- ["pppos.echo_fails", "i", 3, {title: "Number of failed echos before connection is declared dead and retried"}]
25+
- ["pppos.hexdump_enable", "b", false, {title: "Dump all the data sent over UART to stderr"}]
26+
27+
tags:
28+
- hw
29+
- net
30+
31+
manifest_version: 2017-09-29

mos_esp32.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build_vars:
2+
ESP_IDF_SDKCONFIG_OPTS: "${build_vars.ESP_IDF_SDKCONFIG_OPTS} CONFIG_PPP_SUPPORT=y"

0 commit comments

Comments
 (0)