1b049dde5Sopenharmony_ci/* 2b049dde5Sopenharmony_ci * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 3b049dde5Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 4b049dde5Sopenharmony_ci * 5b049dde5Sopenharmony_ci * Redistribution and use in source and binary forms, with or without modification, 6b049dde5Sopenharmony_ci * are permitted provided that the following conditions are met: 7b049dde5Sopenharmony_ci * 8b049dde5Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright notice, this list of 9b049dde5Sopenharmony_ci * conditions and the following disclaimer. 10b049dde5Sopenharmony_ci * 11b049dde5Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12b049dde5Sopenharmony_ci * of conditions and the following disclaimer in the documentation and/or other materials 13b049dde5Sopenharmony_ci * provided with the distribution. 14b049dde5Sopenharmony_ci * 15b049dde5Sopenharmony_ci * 3. Neither the name of the copyright holder nor the names of its contributors may be used 16b049dde5Sopenharmony_ci * to endorse or promote products derived from this software without specific prior written 17b049dde5Sopenharmony_ci * permission. 18b049dde5Sopenharmony_ci * 19b049dde5Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20b049dde5Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21b049dde5Sopenharmony_ci * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22b049dde5Sopenharmony_ci * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 23b049dde5Sopenharmony_ci * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24b049dde5Sopenharmony_ci * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25b049dde5Sopenharmony_ci * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26b049dde5Sopenharmony_ci * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27b049dde5Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28b049dde5Sopenharmony_ci * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29b049dde5Sopenharmony_ci * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30b049dde5Sopenharmony_ci */ 31b049dde5Sopenharmony_ci 32b049dde5Sopenharmony_ci#ifndef HIVIEW_HIEVENT_H 33b049dde5Sopenharmony_ci#define HIVIEW_HIEVENT_H 34b049dde5Sopenharmony_ci 35b049dde5Sopenharmony_ci#define MAX_PATH_NUMBER 10 36b049dde5Sopenharmony_ci 37b049dde5Sopenharmony_ci/* hievent struct */ 38b049dde5Sopenharmony_cistruct HiviewHievent { 39b049dde5Sopenharmony_ci unsigned int eventid; 40b049dde5Sopenharmony_ci 41b049dde5Sopenharmony_ci long long time; 42b049dde5Sopenharmony_ci 43b049dde5Sopenharmony_ci /* payload linked list */ 44b049dde5Sopenharmony_ci struct HiviewHieventPayload *head; 45b049dde5Sopenharmony_ci 46b049dde5Sopenharmony_ci /* file path needs uploaded */ 47b049dde5Sopenharmony_ci char *filePath[MAX_PATH_NUMBER]; 48b049dde5Sopenharmony_ci}; 49b049dde5Sopenharmony_ci 50b049dde5Sopenharmony_ci 51b049dde5Sopenharmony_cistruct HiviewHievent *HiviewHieventCreate(unsigned int eventid); 52b049dde5Sopenharmony_ciint HiviewHieventPutIntegral(struct HiviewHievent *event, 53b049dde5Sopenharmony_ci const char *key, long value); 54b049dde5Sopenharmony_ciint HiviewHieventPutString(struct HiviewHievent *event, 55b049dde5Sopenharmony_ci const char *key, const char *value); 56b049dde5Sopenharmony_ciint HiviewHieventSetTime(struct HiviewHievent *event, long long seconds); 57b049dde5Sopenharmony_ciint HiviewHieventAddFilePath(struct HiviewHievent *event, const char *path); 58b049dde5Sopenharmony_ciint HiviewHieventReport(struct HiviewHievent *obj); 59b049dde5Sopenharmony_civoid HiviewHieventDestroy(struct HiviewHievent *event); 60b049dde5Sopenharmony_civoid HiviewHieventFlush(void); 61b049dde5Sopenharmony_ci 62b049dde5Sopenharmony_ci#endif /* HIVIEW_HIEVENT_H */ 63