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
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2021-03-16 21:36:13 +01:00
|
|
|
#include <string>
|
2021-03-24 21:06:27 +01:00
|
|
|
#define STRING_IN(x) const std::string& x
|
|
|
|
#define STRING_OUT(x) std::string& x
|
|
|
|
#define BOOL_IN(x) const bool x
|
|
|
|
#define BOOL_OUT(x) bool& x
|
|
|
|
#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
|
|
|
|
#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-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_pin, command_result, 1, MUX_ARG, STRING_IN(x)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
/**
|
|
|
|
* @brief Checks if the SIM needs a PIN
|
|
|
|
*
|
|
|
|
* @param[out] pin_ok Pin
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(read_pin, command_result, 1, MUX_ARG, BOOL_OUT(x)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
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-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-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-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-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-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-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
|
|
|
|
*
|
|
|
|
* @param[out] module name
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(get_module_name, command_result, 1, MUX_ARG, STRING_OUT(x)) \
|
2021-03-07 19:43:45 +01:00
|
|
|
\
|
|
|
|
/**
|
|
|
|
* @brief Sets the modem to data mode
|
|
|
|
*
|
|
|
|
*/ \
|
2021-03-24 21:06:27 +01:00
|
|
|
ESP_MODEM_DECLARE_DCE_COMMAND(set_data_mode, command_result, 0, MUX_ARG)
|
2021-03-07 19:43:45 +01:00
|
|
|
|
|
|
|
// --- DCE command documentation starts here ---
|
|
|
|
#ifdef GENERATE_DOCS
|
|
|
|
// gcc -E -CC -P -DGENERATE_DOCS esp_modem_command_declare.inc | sed -n '/DCE command documentation/,//p'
|
|
|
|
|
|
|
|
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, TEMPLATE_ARG, MUX_ARG, ...) \
|
|
|
|
return_type name (__VA_ARGS__);
|
|
|
|
|
|
|
|
DECLARE_ALL_COMMAND_APIS()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2021-03-29 19:34:45 +02:00
|
|
|
#endif // _ESP_MODEM_COMMAND_DECLARE_INC_
|