Add license headers, update namespaces

This commit is contained in:
David Cermak
2021-03-29 19:34:45 +02:00
parent 30bde53d46
commit 246572d286
27 changed files with 813 additions and 437 deletions

View File

@ -1,13 +1,25 @@
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
//
// Created by david on 2/26/21.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
#ifndef SIMPLE_CXX_CLIENT_ESP_MODEM_NETIF_HPP
#define SIMPLE_CXX_CLIENT_ESP_MODEM_NETIF_HPP
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_MODEM_NETIF_HPP
#define _ESP_MODEM_NETIF_HPP
#include "esp_netif.h"
#include "cxx_include/esp_modem_primitives.hpp"
namespace esp_modem {
class DTE;
class Netif;
@ -16,19 +28,25 @@ struct ppp_netif_driver {
Netif *ppp;
};
class Netif {
public:
explicit Netif(std::shared_ptr<DTE> e, esp_netif_t *netif);
~Netif();
void start();
// void notify_ppp_exit() { signal.set(PPP_EXIT); }
void wait_until_ppp_exits() { signal.wait(PPP_EXIT, 50000); }
void wait_until_ppp_exits() { signal.wait(PPP_EXIT, 30000); }
void stop();
private:
void receive(uint8_t *data, size_t len);
static esp_err_t esp_modem_dte_transmit(void *h, void *buffer, size_t len);
static esp_err_t esp_modem_post_attach(esp_netif_t * esp_netif, void * args);
static esp_err_t esp_modem_post_attach(esp_netif_t *esp_netif, void *args);
static void on_ppp_changed(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
std::shared_ptr<DTE> ppp_dte;
@ -37,8 +55,8 @@ private:
signal_group signal;
static const size_t PPP_STARTED = BIT0;
static const size_t PPP_EXIT = BIT1;
};
} // namespace esp_modem
#endif //SIMPLE_CXX_CLIENT_ESP_MODEM_NETIF_HPP
#endif // _ESP_MODEM_NETIF_HPP