2021-03-29 19:34:45 +02:00
|
|
|
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
2021-03-07 19:43:45 +01:00
|
|
|
//
|
2021-03-29 19:34:45 +02:00
|
|
|
// 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
|
|
|
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-03-07 19:43:45 +01:00
|
|
|
//
|
2021-03-29 19:34:45 +02:00
|
|
|
// 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.
|
2021-03-07 19:43:45 +01:00
|
|
|
|
2021-03-29 19:34:45 +02:00
|
|
|
#ifndef _ESP_MODEM_COMMAND_DECLARE_INC_
|
|
|
|
#define _ESP_MODEM_COMMAND_DECLARE_INC_
|
2021-03-07 19:43:45 +01:00
|
|
|
|
2021-04-13 20:29:55 +02:00
|
|
|
#if GENERATE_DOCS
|
|
|
|
#define _ARG(arg) arg
|
|
|
|
#else
|
|
|
|
#define _ARG(arg) x
|
|
|
|
#endif
|
|
|
|
|
2021-03-07 19:43:45 +01:00
|
|
|
#ifdef __cplusplus
|
2021-03-16 21:36:13 +01:00
|
|
|
#include <string>
|
2021-04-13 20:29:55 +02:00
|
|
|
#define STRING_IN(x) const std::string& _ARG(x)
|
|
|
|
#define STRING_OUT(x) std::string& _ARG(x)
|
2021-03-24 21:06:27 +01:00
|
|
|
#define BOOL_IN(x) const bool x
|
2021-04-13 20:29:55 +02:00
|
|
|
#define BOOL_OUT(x) bool& _ARG(x)
|
2021-03-30 08:25:16 +02:00
|
|
|
#define INT_OUT(x) int& x
|
|
|
|
|
2021-03-24 21:06:27 +01:00
|
|
|
#define STRUCT_OUT(struct_name, x) struct_name& x
|
2021-03-07 19:43:45 +01:00
|
|
|
#else
|
2021-03-24 21:06:27 +01:00
|
|
|
#define STRING_IN(x) const char* x
|
|
|
|
#define STRING_OUT(x) char* x
|
|
|
|
#define BOOL_IN(x) const bool x
|
|
|
|
#define BOOL_OUT(x) bool* x
|
2021-03-30 08:25:16 +02:00
|
|
|
#define INT_OUT(x) int* x
|
2021-03-24 21:06:27 +01:00
|
|
|
#define STRUCT_OUT(struct_name, x) struct struct_name* x
|
2021-03-07 19:43:45 +01:00
|
|
|
#endif
|
|
|
|
|
2021-03-29 19:34:45 +02:00
|
|
|
#define _ESP_MODEM_COMMAND_DECLARE_INC_
|
2021-03-07 19:43:45 +01:00
|
|
|
#define ESP_MODEM_DEFINE_DCE_COMMAND(...) ESP_MODEM_DECLARE_DCE_COMMAND(##__VA_ARGS__)
|
|
|
|
#define DEFINE_ALL_COMMAND_APIS() DECLARE_ALL_COMMAND_APIS()
|
|
|
|
|
|
|
|
#define DECLARE_ALL_COMMAND_APIS(...) \
|
|
|
|
/**
|
|
|
|
* @brief Sends the supplied PIN code
|
|
|
|
*
|
|
|
|
* @param pin Pin
|
2021-04-13 20:29:55 +02:00
|
|
|
*
|
2021-03-07 19:43:45 +01:00
|
|
|
*/ \
|
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_pin, command_result, 1, MUX_ARG, STRING_IN(pin)) \
|
|
|
|
\
|
|
|
|
\
|
2021-03-07 19:43:45 +01:00
|
|
|
/**
|
|
|
|
* @brief Checks if the SIM needs a PIN
|
|
|
|
*
|
|
|
|
* @param[out] pin_ok Pin
|
|
|
|
*/ \
|
2021-04-13 20:29:55 +02:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(read_pin, command_result, 1, MUX_ARG, BOOL_OUT(pin_ok)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
|
|
|
* @param[out] name module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_echo, command_result, 1, MUX_ARG, BOOL_IN(x)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
|
|
|
* @param[out] name module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(resume_data_mode, command_result, 0, MUX_ARG) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
|
|
|
* @param[out] name module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_pdp_context, command_result, 1, MUX_ARG, STRUCT_OUT(PdpContext, x)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
|
|
|
* @param[out] name module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_command_mode, command_result, 0, MUX_ARG) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
|
|
|
* @param[out] name module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_cmux, command_result, 0, MUX_ARG) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
|
|
|
* @param[out] name module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(get_imsi, command_result, 1, MUX_ARG, STRING_OUT(x)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
2021-04-13 20:29:55 +02:00
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
|
|
|
* @param[out] name module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(get_imei, command_result, 1, MUX_ARG, STRING_OUT(x)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
|
|
|
/**
|
|
|
|
* @brief Reads the module name
|
|
|
|
*
|
2021-04-13 20:29:55 +02:00
|
|
|
* @param[out] name module name
|
2021-03-07 19:43:45 +01:00
|
|
|
*/ \
|
2021-04-13 20:29:55 +02:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(get_module_name, command_result, 1, MUX_ARG, STRING_OUT(name)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
|
|
|
/**
|
|
|
|
* @brief Sets the modem to data mode
|
|
|
|
*
|
|
|
|
*/ \
|
2021-03-30 08:25:16 +02:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_data_mode, command_result, 0, MUX_ARG) \
|
|
|
|
\
|
|
|
|
/**
|
|
|
|
* @brief Get Signal quality
|
|
|
|
*
|
|
|
|
*/ \
|
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(get_signal_quality, command_result, 2, MUX_ARG, INT_OUT(x), INT_OUT(y))
|
2021-03-07 19:43:45 +01:00
|
|
|
|
|
|
|
#ifdef GENERATE_DOCS
|
2021-04-13 20:29:55 +02:00
|
|
|
// cat ../include/generate/esp_modem_command_declare.inc | clang++ -E -P -CC -xc++ -I../include -DGENERATE_DOCS - | sed -n '1,/DCE command documentation/!p'
|
|
|
|
// cat ../include/generate/esp_modem_command_declare.inc | clang -E -P -CC -xc -I../include -DGENERATE_DOCS - | sed -n '1,/DCE command documentation/!p' > c_api.h
|
|
|
|
// --- DCE command documentation starts here ---
|
|
|
|
#ifdef __cplusplus
|
|
|
|
class DCE: public DCE_T<GenericModule> {
|
|
|
|
public:
|
|
|
|
using DCE_T<GenericModule>::DCE_T;
|
|
|
|
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, TEMPLATE_ARG, MUX_ARG, ...) return_type name (__VA_ARGS__);
|
|
|
|
#else
|
|
|
|
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, TEMPLATE_ARG, MUX_ARG, ...) return_type esp_modem_ ## name (__VA_ARGS__);
|
|
|
|
#endif
|
2021-03-07 19:43:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
DECLARE_ALL_COMMAND_APIS()
|
2021-04-13 20:29:55 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
};
|
2021-03-07 19:43:45 +01:00
|
|
|
#endif
|
|
|
|
|
2021-04-13 20:29:55 +02:00
|
|
|
#endif
|
2021-03-07 19:43:45 +01:00
|
|
|
|
2021-03-29 19:34:45 +02:00
|
|
|
#endif // _ESP_MODEM_COMMAND_DECLARE_INC_
|