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) : 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 void ATHandler::set_urc_handler(const char *urc, mbed::Callback<void()> cb) 00083 { 00084 ATHandler_stub::callback = cb; 00085 } 00086 00087 nsapi_error_t ATHandler::get_last_error() const 00088 { 00089 if (ATHandler_stub::nsapi_error_ok_counter) { 00090 ATHandler_stub::nsapi_error_ok_counter--; 00091 return NSAPI_ERROR_OK ; 00092 } 00093 return ATHandler_stub::nsapi_error_value; 00094 } 00095 00096 void ATHandler::lock() 00097 { 00098 } 00099 00100 void ATHandler::unlock() 00101 { 00102 } 00103 00104 nsapi_error_t ATHandler::unlock_return_error() 00105 { 00106 return ATHandler_stub::nsapi_error_value; 00107 } 00108 00109 void ATHandler::set_at_timeout(uint32_t timeout_milliseconds, bool default_timeout) 00110 { 00111 } 00112 00113 void ATHandler::restore_at_timeout() 00114 { 00115 } 00116 00117 void ATHandler::process_oob() 00118 { 00119 } 00120 00121 void ATHandler::clear_error() 00122 { 00123 } 00124 00125 void ATHandler::skip_param(uint32_t count) { 00126 00127 } 00128 00129 void ATHandler::skip_param(ssize_t len, uint32_t count) 00130 { 00131 } 00132 00133 ssize_t ATHandler::read_bytes(uint8_t *buf, size_t len) 00134 { 00135 return ATHandler_stub::ssize_value; 00136 } 00137 00138 ssize_t ATHandler::read_string(char *buf, size_t size, bool read_even_stop_tag) 00139 { 00140 if (ATHandler_stub::read_string_value && ATHandler_stub::ssize_value >= 0) { 00141 memcpy(buf, ATHandler_stub::read_string_value, ATHandler_stub::ssize_value); 00142 } 00143 return ATHandler_stub::ssize_value; 00144 } 00145 00146 int ATHandler::read_int() 00147 { 00148 return ATHandler_stub::int_value; 00149 } 00150 00151 void ATHandler::set_delimiter(char delimiter) 00152 { 00153 } 00154 00155 void ATHandler::set_default_delimiter() 00156 { 00157 } 00158 00159 void ATHandler::set_stop_tag(const char *stop_tag_seq) 00160 { 00161 } 00162 00163 int ATHandler::get_3gpp_error() 00164 { 00165 return ATHandler_stub::int_value; 00166 } 00167 00168 void ATHandler::resp_start(const char *prefix, bool stop) 00169 { 00170 } 00171 00172 bool ATHandler::info_resp() 00173 { 00174 if (ATHandler_stub::resp_info_true_counter) { 00175 ATHandler_stub::resp_info_true_counter--; 00176 return true; 00177 } 00178 return ATHandler_stub::bool_value; 00179 } 00180 00181 bool ATHandler::info_elem(char start_tag) 00182 { 00183 return ATHandler_stub::bool_value; 00184 } 00185 00186 bool ATHandler::consume_to_stop_tag() 00187 { 00188 return ATHandler_stub::bool_value; 00189 } 00190 00191 void ATHandler::resp_stop() 00192 { 00193 } 00194 00195 void ATHandler::cmd_start(const char* cmd) 00196 { 00197 } 00198 00199 void ATHandler::write_int(int param) 00200 { 00201 } 00202 00203 void ATHandler::write_string(const char* param, bool useQuotations) 00204 { 00205 } 00206 00207 size_t ATHandler::write_bytes(const uint8_t* param, size_t len) 00208 { 00209 if (ATHandler_stub::return_given_size) { 00210 return len; 00211 } 00212 return ATHandler_stub::size_value; 00213 } 00214 00215 void ATHandler::cmd_stop() 00216 { 00217 } 00218 00219 device_err_t ATHandler::get_last_device_error() const 00220 { 00221 return ATHandler_stub::device_err_value; 00222 } 00223 00224 void ATHandler::flush() 00225 { 00226 00227 }
Generated on Tue Jul 12 2022 14:23:23 by
