19762338dSopenharmony_ci/*
29762338dSopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49762338dSopenharmony_ci * you may not use this file except in compliance with the License.
59762338dSopenharmony_ci * You may obtain a copy of the License at
69762338dSopenharmony_ci *
79762338dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89762338dSopenharmony_ci *
99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129762338dSopenharmony_ci * See the License for the specific language governing permissions and
139762338dSopenharmony_ci * limitations under the License.
149762338dSopenharmony_ci */
159762338dSopenharmony_ci#ifndef USBD_TRANSFER_TEST_H
169762338dSopenharmony_ci#define USBD_TRANSFER_TEST_H
179762338dSopenharmony_ci
189762338dSopenharmony_ci#include <gtest/gtest.h>
199762338dSopenharmony_ci#include "UsbSubscriberTest.h"
209762338dSopenharmony_ci#include "v1_0/iusbd_subscriber.h"
219762338dSopenharmony_ci#include "v1_0/usb_types.h"
229762338dSopenharmony_ci#include "v1_0/iusbd_bulk_callback.h"
239762338dSopenharmony_ci
249762338dSopenharmony_ciusing OHOS::HDI::Usb::V1_0::UsbDev;
259762338dSopenharmony_ci
269762338dSopenharmony_ci#define USB_DDK_REQ_GET_DESCRIPTOR    0x06
279762338dSopenharmony_ci#define USB_DDK_REQ_GET_CONFIGURATION 0x08
289762338dSopenharmony_ci#define USB_DDK_REQ_GET_INTERFACE     0x0A
299762338dSopenharmony_ci#define USB_DDK_REQ_SYNCH_FRAME       0x0C
309762338dSopenharmony_ciconst int32_t USB_ENDPOINT_DIR_IN = 0x80;
319762338dSopenharmony_ciconst int32_t USB_ENDPOINT_DIR_OUT = 0;
329762338dSopenharmony_ci
339762338dSopenharmony_citypedef enum {
349762338dSopenharmony_ci    USB_REQUEST_TARGET_DEVICE,
359762338dSopenharmony_ci    USB_REQUEST_TARGET_INTERFACE,
369762338dSopenharmony_ci    USB_REQUEST_TARGET_ENDPOINT,
379762338dSopenharmony_ci    USB_REQUEST_TARGET_OTHER,
389762338dSopenharmony_ci} UsbRequestTargetType;
399762338dSopenharmony_ci
409762338dSopenharmony_cinamespace {
419762338dSopenharmony_ciclass UsbdTransferTest : public testing::Test {
429762338dSopenharmony_cipublic:
439762338dSopenharmony_ci    static void SetUpTestCase();
449762338dSopenharmony_ci    static void TearDownTestCase();
459762338dSopenharmony_ci    void SetUp();
469762338dSopenharmony_ci    void TearDown();
479762338dSopenharmony_ci
489762338dSopenharmony_ci    static UsbDev dev_;
499762338dSopenharmony_ci    static OHOS::sptr<OHOS::USB::UsbSubscriberTest> subscriber_;
509762338dSopenharmony_ci};
519762338dSopenharmony_ciclass UsbdBulkCallbackTest : public OHOS::HDI::Usb::V1_0::IUsbdBulkCallback {
529762338dSopenharmony_cipublic:
539762338dSopenharmony_ci    UsbdBulkCallbackTest() = default;
549762338dSopenharmony_ci    ~UsbdBulkCallbackTest() = default;
559762338dSopenharmony_ci    int32_t OnBulkWriteCallback(int32_t status, int32_t actLength) override
569762338dSopenharmony_ci    {
579762338dSopenharmony_ci        return 0;
589762338dSopenharmony_ci    };
599762338dSopenharmony_ci    int32_t OnBulkReadCallback(int32_t status, int32_t actLength) override
609762338dSopenharmony_ci    {
619762338dSopenharmony_ci        return 0;
629762338dSopenharmony_ci    };
639762338dSopenharmony_ci};
649762338dSopenharmony_ci}
659762338dSopenharmony_ci#endif // USBD_TRANSFER_TEST_H
66