1 /******************************************************************************
2  *
3  *  Copyright 2020 NXP
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 #pragma once
20 #include <NfccTransport.h>
21 #include <memory>
22 
23 #define transportFactory (NfccTransportFactory::getInstance())
24 typedef std::shared_ptr<NfccTransport> spTransport;
25 enum transportIntf { I2C, UNKNOWN };
26 
27 extern spTransport gpTransportObj;
28 class NfccTransportFactory {
29   /*****************************************************************************
30    **
31    ** Function         NfccTransportFactory
32    **
33    ** Description      Constructor for transportFactory. This will be private to
34    **                  support singleton
35    **
36    ** Parameters       none
37    **
38    ** Returns          none
39    ****************************************************************************/
40   NfccTransportFactory();
41 
42  public:
43   /*****************************************************************************
44    **
45    ** Function         getInstance
46    **
47    ** Description      returns the static instance of TransportFactory
48    **
49    ** Parameters       none
50    **
51    ** Returns          TransportFactory instance
52    ****************************************************************************/
53   static NfccTransportFactory& getInstance();
54 
55   /*****************************************************************************
56   **
57   ** Function         getTransport
58   **
59   ** Description      selects and returns transport channel based on the input
60   **                  parameter
61   **
62   ** Parameters       Required transport Type
63   **
64   ** Returns          Selected transport channel
65   ****************************************************************************/
66   spTransport getTransport(transportIntf transportType);
67 };
68