xref: /drivers/peripheral/nfc/test/unittest/mock/mock.h (revision 094332d3)
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#ifndef MOCK_VENDOR_ADAPTIONS_H
16#define MOCK_VENDOR_ADAPTIONS_H
17
18#include <string>
19#include "nfc_vendor_adaptions.h"
20
21namespace OHOS {
22namespace HDI {
23namespace Nfc {
24class Mock : public NfcVendorAdaptions {
25public:
26    int VendorOpen(NfcStackCallbackT *pCback, NfcStackDataCallbackT *pDataCback);
27    int VendorWrite(uint16_t dataLen, const uint8_t *pData);
28    int VendorCoreInitialized(uint16_t coreInitRspLen, uint8_t *pCoreInitRspParams);
29    int VendorPrediscover(void);
30    int VendorClose(bool bShutdown);
31    int VendorControlGranted(void);
32    int VendorPowerCycle(void);
33    int VendorIoctl(long arg, void *pData);
34    int VendorIoctlWithResponse(long arg, void *pData, uint16_t dataLen, std::vector<uint8_t> &pRetVal);
35    int VendorGetConfig(V1_1::NfcVendorConfig &config);
36    int VendorFactoryReset(void);
37    int VendorShutdownCase(void);
38
39private:
40    std::string GetChipType(void);
41    std::string GetNfcHalFuncNameSuffix(const std::string &chipType);
42    void ResetNfcInterface(void);
43    int8_t InitNfcHalInterfaces(std::string nfcHalSoName, std::string suffix);
44    void CheckFirmwareUpdate(void);
45
46    void *nfcHalHandle; // handle of nfc hal so
47    NfcHalInterface nfcHalInf;
48
49    void *nfcExtHandle; // handle of nfc ext service
50    NfcExtInterface nfcExtInf;
51};
52} // Nfc
53} // HDI
54} // OHOS
55
56#endif // MOCK_VENDOR_ADAPTIONS_H
57