Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ATHandler_stub.cpp
00001 /* 00002 * Copyright (c) 2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #include <ctype.h> 00019 #include "nsapi_types.h" 00020 #include "ATHandler.h" 00021 #include "EventQueue.h" 00022 #include "ATHandler_stub.h" 00023 00024 using namespace mbed; 00025 using namespace events; 00026 00027 #include "CellularLog.h" 00028 00029 const int DEFAULT_AT_TIMEOUT = 1000; // at default timeout in milliseconds 00030 00031 nsapi_error_t ATHandler_stub::nsapi_error_value = 0; 00032 uint8_t ATHandler_stub::nsapi_error_ok_counter = 0; 00033 int ATHandler_stub::int_value = -1; 00034 ssize_t ATHandler_stub::ssize_value = 0; 00035 char* ATHandler_stub::read_string_value = NULL; 00036 size_t ATHandler_stub::size_value = 0; 00037 size_t ATHandler_stub::return_given_size = false; 00038 bool ATHandler_stub::bool_value = false; 00039 uint8_t ATHandler_stub::uint8_value = 0; 00040 FileHandle_stub *ATHandler_stub::fh_value = NULL; 00041 device_err_t ATHandler_stub::device_err_value; 00042 Callback<void()> ATHandler_stub::callback = NULL; 00043 uint8_t ATHandler_stub::resp_info_true_counter = false; 00044 00045 ATHandler::ATHandler(FileHandle *fh, EventQueue &queue, int timeout, const char *output_delimiter, uint16_t send_delay) : 00046 _nextATHandler(0), 00047 _fileHandle(fh), 00048 _queue(queue) 00049 { 00050 } 00051 00052 void ATHandler::enable_debug(bool enable) 00053 { 00054 } 00055 00056 ATHandler::~ATHandler() 00057 { 00058 } 00059 00060 void ATHandler::inc_ref_count() 00061 { 00062 } 00063 00064 void ATHandler::dec_ref_count() 00065 { 00066 } 00067 00068 int ATHandler::get_ref_count() 00069 { 00070 return ATHandler_stub::int_value; 00071 } 00072 00073 FileHandle *ATHandler::get_file_handle() 00074 { 00075 return ATHandler_stub::fh_value; 00076 } 00077 00078 void ATHandler::set_file_handle(FileHandle *fh) 00079 { 00080 } 00081 00082 nsapi_error_t ATHandler::set_urc_handler(const char *urc, mbed::Callback<void()> cb) 00083 { 00084 ATHandler_stub::callback = cb; 00085 return NSAPI_ERROR_OK ; 00086 } 00087 00088 nsapi_error_t ATHandler::get_last_error() const 00089 { 00090 if (ATHandler_stub::nsapi_error_ok_counter) { 00091 ATHandler_stub::nsapi_error_ok_counter--; 00092 return NSAPI_ERROR_OK ; 00093 } 00094 return ATHandler_stub::nsapi_error_value; 00095 } 00096 00097 void ATHandler::lock() 00098 { 00099 } 00100 00101 void ATHandler::unlock() 00102 { 00103 } 00104 00105 nsapi_error_t ATHandler::unlock_return_error() 00106 { 00107 return ATHandler_stub::nsapi_error_value; 00108 } 00109 00110 void ATHandler::set_at_timeout(uint32_t timeout_milliseconds, bool default_timeout) 00111 { 00112 } 00113 00114 void ATHandler::restore_at_timeout() 00115 { 00116 } 00117 00118 void ATHandler::process_oob() 00119 { 00120 } 00121 00122 void ATHandler::clear_error() 00123 { 00124 } 00125 00126 void ATHandler::skip_param(uint32_t count) { 00127 00128 } 00129 00130 void ATHandler::skip_param(ssize_t len, uint32_t count) 00131 { 00132 } 00133 00134 ssize_t ATHandler::read_bytes(uint8_t *buf, size_t len) 00135 { 00136 return ATHandler_stub::ssize_value; 00137 } 00138 00139 ssize_t ATHandler::read_string(char *buf, size_t size, bool read_even_stop_tag) 00140 { 00141 if (ATHandler_stub::read_string_value && ATHandler_stub::ssize_value >= 0) { 00142 memcpy(buf, ATHandler_stub::read_string_value, ATHandler_stub::ssize_value); 00143 } 00144 return ATHandler_stub::ssize_value; 00145 } 00146 00147 int ATHandler::read_int() 00148 { 00149 return ATHandler_stub::int_value; 00150 } 00151 00152 void ATHandler::set_delimiter(char delimiter) 00153 { 00154 } 00155 00156 void ATHandler::set_default_delimiter() 00157 { 00158 } 00159 00160 void ATHandler::set_stop_tag(const char *stop_tag_seq) 00161 { 00162 } 00163 00164 int ATHandler::get_3gpp_error() 00165 { 00166 return ATHandler_stub::int_value; 00167 } 00168 00169 void ATHandler::resp_start(const char *prefix, bool stop) 00170 { 00171 } 00172 00173 bool ATHandler::info_resp() 00174 { 00175 if (ATHandler_stub::resp_info_true_counter) { 00176 ATHandler_stub::resp_info_true_counter--; 00177 return true; 00178 } 00179 return ATHandler_stub::bool_value; 00180 } 00181 00182 bool ATHandler::info_elem(char start_tag) 00183 { 00184 return ATHandler_stub::bool_value; 00185 } 00186 00187 bool ATHandler::consume_to_stop_tag() 00188 { 00189 return ATHandler_stub::bool_value; 00190 } 00191 00192 void ATHandler::resp_stop() 00193 { 00194 } 00195 00196 void ATHandler::cmd_start(const char* cmd) 00197 { 00198 } 00199 00200 void ATHandler::write_int(int param) 00201 { 00202 } 00203 00204 void ATHandler::write_string(const char* param, bool useQuotations) 00205 { 00206 } 00207 00208 size_t ATHandler::write_bytes(const uint8_t* param, size_t len) 00209 { 00210 if (ATHandler_stub::return_given_size) { 00211 return len; 00212 } 00213 return ATHandler_stub::size_value; 00214 } 00215 00216 void ATHandler::cmd_stop() 00217 { 00218 } 00219 00220 device_err_t ATHandler::get_last_device_error() const 00221 { 00222 return ATHandler_stub::device_err_value; 00223 } 00224 00225 void ATHandler::flush() 00226 { 00227 00228 }
Generated on Tue Jul 12 2022 18:18:27 by
