1 /* 2 * Copyright (c) 2021 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 HDI_SAMPLE_CLIENT_C_INF_H 17 #define HDI_SAMPLE_CLIENT_C_INF_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif /* __cplusplus */ 22 23 struct HdfRemoteService; 24 25 struct StructSample { 26 int8_t first; 27 int16_t second; 28 }; 29 30 enum EnumSample { 31 MEM_FIRST, 32 MEM_SECOND, 33 MEM_THIRD, 34 }; 35 36 enum { 37 CMD_BOOLEAN_TYPE_TEST, 38 CMD_BYTE_TYPE_TEST, 39 CMD_SHORT_TYPE_TEST, 40 CMD_INT_TYPE_TEST, 41 CMD_LONG_TYPE_TEST, 42 CMD_FLOAT_TYPE_TEST, 43 CMD_DOUBLE_TYPE_TEST, 44 CMD_STRING_TYPE_TEST, 45 CMD_UCHAR_TYPE_TEST, 46 CMD_USHORT_TYPE_TEST, 47 CMD_UINT_TYPE_TEST, 48 CMD_ULONG_TYPE_TEST, 49 CMD_LIST_TYPE_TEST, 50 CMD_ARRAY_TYPE_TEST, 51 CMD_STRUCT_TYPE_TEST, 52 CMD_ENUM_TYPE_TEST, 53 }; 54 55 struct ISample { 56 struct HdfRemoteService *remote; 57 58 int32_t (*BooleanTypeTest)(struct ISample *self, const bool input, bool *output); 59 60 int32_t (*ByteTypeTest)(struct ISample *self, const int8_t input, int8_t *output); 61 62 int32_t (*ShortTypeTest)(struct ISample *self, const int16_t input, int16_t *output); 63 64 int32_t (*IntTypeTest)(struct ISample *self, const int32_t input, int32_t *output); 65 66 int32_t (*LongTypeTest)(struct ISample *self, const int64_t input, int64_t *output); 67 68 int32_t (*FloatTypeTest)(struct ISample *self, const float input, float *output); 69 70 int32_t (*DoubleTypeTest)(struct ISample *self, const double input, double *output); 71 72 int32_t (*StringTypeTest)(struct ISample *self, const char* input, char **output); 73 74 int32_t (*UcharTypeTest)(struct ISample *self, const uint8_t input, uint8_t *output); 75 76 int32_t (*UshortTypeTest)(struct ISample *self, const uint16_t input, uint16_t *output); 77 78 int32_t (*UintTypeTest)(struct ISample *self, const uint32_t input, uint32_t *output); 79 80 int32_t (*UlongTypeTest)(struct ISample *self, const uint64_t input, uint64_t *output); 81 82 int32_t (*ListTypeTest)(struct ISample *self, const int8_t *input, const uint32_t inSize, 83 int8_t **output, uint32_t *outSize); 84 85 int32_t (*ArrayTypeTest)(struct ISample *self, const int8_t *input, const uint32_t inSize, 86 int8_t **output, uint32_t *outSize); 87 88 int32_t (*StructTypeTest)(struct ISample *self, const struct StructSample *input, struct StructSample *output); 89 90 int32_t (*EnumTypeTest)(struct ISample *self, const enum EnumSample input, enum EnumSample *output); 91 }; 92 93 struct ISample *HdiSampleGet(const char *serviceName); 94 95 void HdiSampleRelease(struct ISample *instance); 96 97 #ifdef __cplusplus 98 } 99 #endif /* __cplusplus */ 100 101 #endif // HDI_SAMPLE_CLIENT_C_INF_H