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 REQUEST_H 17 #define REQUEST_H 18 19 #include "protocol/data_channel/include/i_request.h" 20 21 namespace OHOS { 22 namespace AI { 23 class Request { 24 public: 25 Request(); 26 ~Request(); 27 28 /** 29 * Get inner sequence Id, which is globally unique. 30 * Inner sequence Id indicates the future class, which is used to process asynchronous tasks. 31 * 32 * @return Inner sequence Id. 33 */ 34 long long GetInnerSequenceId() const; 35 36 /** 37 * Set inner sequence Id, which is globally unique. 38 * 39 * @param [in] seqId Inner sequence Id. 40 */ 41 void SetInnerSequenceId(long long seqId); 42 43 /** 44 * Get request Id. 45 * 46 * @return Request Id. 47 */ 48 int GetRequestId() const; 49 50 /** 51 * Set request Id. 52 * 53 * @param [in] requestId Request Id. 54 */ 55 void SetRequestId(int requestId); 56 57 /** 58 * Get request operation Id. 59 * 60 * @return Request operation Id. 61 */ 62 int GetOperationId() const; 63 64 /** 65 * Set request operation Id. 66 * 67 * @param [in] operationId Operation Id. 68 */ 69 void SetOperationId(int operationId); 70 71 /** 72 * Get client uid. 73 * 74 * @return Client uid. 75 */ 76 uid_t GetClientUid() const; 77 78 /** 79 * Set client uid. 80 * 81 * @param [in] Client uid. 82 */ 83 void SetClientUid(const uid_t clientUid); 84 85 /** 86 * Get request transaction Id. 87 * 88 * @return Request transaction Id. 89 */ 90 long long GetTransactionId() const; 91 92 /** 93 * Set request transaction Id. 94 * 95 * @param [in] transactionId Transaction Id. 96 */ 97 void SetTransactionId(long long transactionId); 98 99 /** 100 * Get algorithm plugin type. 101 * 102 * @return Algorithm plugin type. 103 */ 104 int GetAlgoPluginType() const; 105 106 /** 107 * Set algorithm plugin type. 108 * 109 * @param [in] type Algorithm plugin type. 110 */ 111 void SetAlgoPluginType(int type); 112 113 /** 114 * Get the message body carried by this request. 115 * 116 * @return Message. 117 */ 118 const DataInfo &GetMsg() const; 119 120 /** 121 * Get the message body carried by this request. 122 * 123 * @param [in] msg Message. 124 */ 125 void SetMsg(const DataInfo &msg); 126 127 private: 128 long long innerSequenceId_; 129 int requestId_; 130 int operationId_; 131 uid_t clientUid_; 132 long long transactionId_; 133 int algoPluginType_; 134 DataInfo msg_; 135 }; 136 } // namespace AI 137 } // namespace OHOS 138 139 #endif // REQUEST_H 140