142103316Sopenharmony_ci/* 242103316Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 342103316Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 442103316Sopenharmony_ci * you may not use this file except in compliance with the License. 542103316Sopenharmony_ci * You may obtain a copy of the License at 642103316Sopenharmony_ci * 742103316Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 842103316Sopenharmony_ci * 942103316Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1042103316Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1142103316Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1242103316Sopenharmony_ci * See the License for the specific language governing permissions and 1342103316Sopenharmony_ci * limitations under the License. 1442103316Sopenharmony_ci */ 1542103316Sopenharmony_ci 1642103316Sopenharmony_ci#ifndef USB_REQUEST_H 1742103316Sopenharmony_ci#define USB_REQUEST_H 1842103316Sopenharmony_ci 1942103316Sopenharmony_ci#include "iusb_srv.h" 2042103316Sopenharmony_ci#include "usb_device_pipe.h" 2142103316Sopenharmony_ci#include "usb_endpoint.h" 2242103316Sopenharmony_ci 2342103316Sopenharmony_cinamespace OHOS { 2442103316Sopenharmony_cinamespace USB { 2542103316Sopenharmony_ciclass UsbRequest { 2642103316Sopenharmony_cipublic: 2742103316Sopenharmony_ci UsbRequest() {} 2842103316Sopenharmony_ci ~UsbRequest() {} 2942103316Sopenharmony_ci int32_t Initialize(const USBDevicePipe &pipe, const USBEndpoint &endpoint); 3042103316Sopenharmony_ci int32_t Queue(); 3142103316Sopenharmony_ci int32_t Free(); 3242103316Sopenharmony_ci int32_t Abort(); 3342103316Sopenharmony_ci void SetPipe(const USBDevicePipe &pipe) 3442103316Sopenharmony_ci { 3542103316Sopenharmony_ci this->pipe_ = pipe; 3642103316Sopenharmony_ci } 3742103316Sopenharmony_ci void SetEndpoint(const USBEndpoint &endpoint) 3842103316Sopenharmony_ci { 3942103316Sopenharmony_ci this->endpoint_ = endpoint; 4042103316Sopenharmony_ci } 4142103316Sopenharmony_ci void SetClientData(std::vector<uint8_t> bufferData) 4242103316Sopenharmony_ci { 4342103316Sopenharmony_ci clientData_ = bufferData; 4442103316Sopenharmony_ci } 4542103316Sopenharmony_ci void SetReqData(std::vector<uint8_t> bufferData) 4642103316Sopenharmony_ci { 4742103316Sopenharmony_ci reqData_ = bufferData; 4842103316Sopenharmony_ci } 4942103316Sopenharmony_ci std::vector<uint8_t> &GetClientData() 5042103316Sopenharmony_ci { 5142103316Sopenharmony_ci return clientData_; 5242103316Sopenharmony_ci } 5342103316Sopenharmony_ci std::vector<uint8_t> &GetReqData() 5442103316Sopenharmony_ci { 5542103316Sopenharmony_ci return reqData_; 5642103316Sopenharmony_ci } 5742103316Sopenharmony_ci const USBDevicePipe &GetPipe() const 5842103316Sopenharmony_ci { 5942103316Sopenharmony_ci return pipe_; 6042103316Sopenharmony_ci } 6142103316Sopenharmony_ci const USBEndpoint &GetEndpoint() const 6242103316Sopenharmony_ci { 6342103316Sopenharmony_ci return endpoint_; 6442103316Sopenharmony_ci } 6542103316Sopenharmony_ci 6642103316Sopenharmony_ciprivate: 6742103316Sopenharmony_ci USBDevicePipe pipe_; 6842103316Sopenharmony_ci USBEndpoint endpoint_; 6942103316Sopenharmony_ci std::vector<uint8_t> clientData_; 7042103316Sopenharmony_ci std::vector<uint8_t> reqData_; 7142103316Sopenharmony_ci}; 7242103316Sopenharmony_ci} // namespace USB 7342103316Sopenharmony_ci} // namespace OHOS 7442103316Sopenharmony_ci 7542103316Sopenharmony_ci#endif // USB_REQUEST_H 76