1 /******************************************************************************
2  *
3  *  Copyright 2024 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 #pragma once
19 
20 #include <stdint.h>
21 
22 // Opaque WiredSe Service object.
23 struct WiredSeService;
24 
25 typedef enum WiredSeEvtType {
26   NFC_STATE_CHANGE,
27   NFC_PKT_RECEIVED,
28   SENDING_HCI_PKT,
29   DISABLING_NFCEE,
30   NFC_EVT_UNKNOWN
31 } WiredSeEvtType;
32 
33 typedef enum { NFC_ON, NFC_OFF, NFC_STATE_UNKNOWN } NfcState;
34 
35 typedef struct NfcPkt {
36   uint8_t* data;
37   uint16_t len;
NfcPktNfcPkt38   NfcPkt() {
39     data = NULL;
40     len = 0;
41   }
42   // Constructor
NfcPktNfcPkt43   NfcPkt(uint8_t* inData, uint16_t inLen) {
44     data = inData;
45     len = inLen;
46   }
47 } NfcPkt;
48 
49 typedef union WiredSeEvtData {
50   NfcState nfcState;
51   NfcPkt nfcPkt;
52   // Default
WiredSeEvtData()53   WiredSeEvtData() {}
54   // For typecasting from NfcState to WiredSeEvtData
WiredSeEvtData(NfcState inNfcState)55   WiredSeEvtData(NfcState inNfcState) { nfcState = inNfcState; }
56   // For typecasting from NfcPkt to WiredSeEvtData
WiredSeEvtData(NfcPkt inNfcPkt)57   WiredSeEvtData(NfcPkt inNfcPkt) { nfcPkt = inNfcPkt; }
58 
59 } WiredSeEvtData;
60 
61 typedef struct WiredSeEvt {
62   WiredSeEvtType event;
63   WiredSeEvtData eventData;
64 
WiredSeEvtWiredSeEvt65   WiredSeEvt() { event = NFC_EVT_UNKNOWN; }
66 } WiredSeEvt;
67 
68 extern "C" int32_t WiredSeService_Start(WiredSeService** wiredSeService);
69 extern "C" int32_t WiredSeService_DispatchEvent(WiredSeService* wiredSeService,
70                                                 WiredSeEvt evt);
71