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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
mbed_error_hist.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 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 #ifndef MBED_ERROR_HIST_H 00018 #define MBED_ERROR_HIST_H 00019 00020 #ifndef MBED_CONF_PLATFORM_ERROR_HIST_SIZE 00021 #define MBED_CONF_PLATFORM_ERROR_HIST_SIZE 4 00022 #else 00023 #if MBED_CONF_PLATFORM_ERROR_HIST_SIZE == 0 00024 #define MBED_CONF_PLATFORM_ERROR_HIST_SIZE 1 00025 #endif 00026 #endif 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /** \ingroup mbed-os-internal */ 00033 /** \addtogroup platform-internal-api */ 00034 /** @{*/ 00035 00036 /* 00037 * Puts/Adds an error entry into the error history list 00038 * 00039 * @param error_ctx pointer to the mbed_error_ctx struct with the error context 00040 * @return 0 or MBED_SUCCESS on success. 00041 * MBED_ERROR_WRITE_FAILED if writing to file failed 00042 * MBED_ERROR_INVALID_ARGUMENT if path is not valid 00043 * 00044 * 00045 */ 00046 mbed_error_status_t mbed_error_hist_put(mbed_error_ctx *error_ctx); 00047 00048 /* 00049 * Reads the error entry from the error list with the specified index 00050 * 00051 * @param index Index of the error context to be retrieved. It starts from 0 and 0 is the oldest. 00052 * @param error_ctx pointer to the mbed_error_ctx struct where the error context will be filled, this should be allocated by the caller 00053 * @return 0 or MBED_SUCCESS on success. 00054 * MBED_ERROR_WRITE_FAILED if writing to file failed 00055 * MBED_ERROR_INVALID_ARGUMENT if path is not valid 00056 * 00057 * 00058 */ 00059 mbed_error_status_t mbed_error_hist_get(int index, mbed_error_ctx *error_ctx); 00060 00061 /* 00062 * Gets a reference to the next error entry in the error log where in the error ctx can be filled in. 00063 * Its like reserving the next error entry to fill in the error info 00064 * 00065 * @return Returns the pointer to the next error ctx entry 00066 * 00067 * 00068 */ 00069 mbed_error_ctx *mbed_error_hist_get_entry(void); 00070 00071 /* 00072 * Reads the last(latest) error entry from the error history 00073 * 00074 * @param error_ctx pointer to the mbed_error_ctx struct where the error context will be filled, this should be allocated by the caller 00075 * @return 0 or MBED_SUCCESS on success. 00076 * MBED_ERROR_WRITE_FAILED if writing to file failed 00077 * MBED_ERROR_INVALID_ARGUMENT if path is not valid 00078 * 00079 * 00080 */ 00081 mbed_error_status_t mbed_error_hist_get_last_error(mbed_error_ctx *error_ctx); 00082 00083 /* 00084 * Returns the number of error entries in the error history list 00085 * 00086 * @return Number of entries in the history list 00087 * 00088 * 00089 */ 00090 int mbed_error_hist_get_count(void); 00091 00092 /* 00093 * Resets the error log by resetting the number of errors to 0 and clears all previous errors in the history list 00094 * 00095 * @return 0 or MBED_SUCCESS on success. 00096 * MBED_ERROR_WRITE_FAILED if writing to file failed 00097 * MBED_ERROR_INVALID_ARGUMENT if path is not valid 00098 * 00099 * 00100 */ 00101 mbed_error_status_t mbed_error_hist_reset(void); 00102 00103 /* 00104 * Saves the error log information to a file 00105 * 00106 * @param path path to the file in the filesystem 00107 * @return 0 or MBED_SUCCESS on success. 00108 * MBED_ERROR_WRITE_FAILED if writing to file failed 00109 * MBED_ERROR_INVALID_ARGUMENT if path is not valid 00110 * 00111 * @note Filesystem support is required in order for this function to work. 00112 * 00113 */ 00114 mbed_error_status_t mbed_save_error_hist(const char *path); 00115 00116 #ifdef __cplusplus 00117 } 00118 #endif 00119 00120 /**@}*/ 00121 00122 #endif
Generated on Tue Jul 12 2022 13:54:33 by
