• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2010-2014 Broadcom Corporation
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 
20 /******************************************************************************
21  *
22  *  This file contains functions that interface with the NFC NCI transport.
23  *  On the receive side, it routes events to the appropriate handler
24  *  (callback). On the transmit side, it manages the command transmission.
25  *
26  ******************************************************************************/
27 #include <string.h>
28 #include "gki.h"
29 #include "nfc_target.h"
30 #include "bt_types.h"
31 
32 #if (NFC_INCLUDED == TRUE)
33 #include "nfc_int.h"
34 #include "nci_hmsgs.h"
35 
36 /****************************************************************************
37 ** Declarations
38 ****************************************************************************/
39 
40 /*******************************************************************************
41 **
42 ** Function         NFC_TestLoopback
43 **
44 ** Description      This function is called to send the given data packet
45 **                  to NFCC for loopback test.
46 **                  When loopback data is received from NFCC, tNFC_TEST_CBACK .
47 **                  reports a NFC_LOOPBACK_TEVT.
48 **
49 ** Parameters       p_data - the data packet
50 **
51 ** Returns          tNFC_STATUS
52 **
53 *******************************************************************************/
NFC_TestLoopback(BT_HDR * p_data)54 tNFC_STATUS NFC_TestLoopback (BT_HDR *p_data)
55 {
56     tNFC_STATUS     status  = NFC_STATUS_FAILED;
57     tNFC_CONN_CB    *p_cb   = nfc_find_conn_cb_by_handle (NCI_TEST_ID);
58 
59     if (p_data && p_cb && (p_data->offset >= (NCI_MSG_OFFSET_SIZE + NCI_DATA_HDR_SIZE)))
60     {
61         status = nfc_ncif_send_data (p_cb, p_data);
62     }
63 
64     if (status != NFC_STATUS_OK)
65         GKI_freebuf (p_data);
66 
67     return status;
68 }
69 
70 
71 
72 
73 #endif /* NFC_INCLUDED == TRUE */
74