1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef COMMON_EVENT_DEFINATION_H 17 #define COMMON_EVENT_DEFINATION_H 18 19 #include "cj_common_ffi.h" 20 21 struct CParameters { 22 int8_t valueType; 23 char *key; 24 void *value; 25 int64_t size; 26 }; 27 28 struct CArrParameters { 29 CParameters *head; 30 int64_t size; 31 }; 32 33 struct CommonEventPublishDataBycj { 34 char *bundleName; 35 char *data; 36 int32_t code; 37 CArrString permissions; 38 bool isOrdered; 39 bool isSticky; 40 CArrParameters parameters; 41 }; 42 43 struct CCommonEventData { 44 char *event; 45 char *bundleName; 46 int32_t code; 47 char *data; 48 CArrParameters parameters; 49 }; 50 51 namespace OHOS::CommonEventManager { 52 constexpr int32_t NO_ERROR = 0; 53 constexpr int32_t ERR_CES_FAILED = 1; 54 constexpr int32_t ERR_NO_MEMORY = -2; 55 56 char *MallocCString(const std::string &origin); 57 char *MallocCString(const std::string &origin, int32_t &code); 58 } 59 #endif // COMMON_EVENT_CONSTANT_H