nfc_test.c revision 26620e3108f6a0f32f5f0a0725e28e5ae66017d6
1/*****************************************************************************
2**
3**  Name:          nfc_main.c
4**
5**  Description:   This file contains functions that interface with the NFC NCI
6**                 transport. On the receive side, it routes events to
7**                 the appropriate handler (callback). On the
8**                 transmit side, it manages the command transmission.
9**
10**
11**  Copyright (c) 2010-2011, Broadcom Corp., All Rights Reserved.
12**  Broadcom Bluetooth Core. Proprietary and confidential.
13**
14******************************************************************************/
15#include <string.h>
16#include "gki.h"
17#include "nfc_target.h"
18#include "bt_types.h"
19
20#if (NFC_INCLUDED == TRUE)
21#include "nfc_int.h"
22#include "nci_hmsgs.h"
23
24/****************************************************************************
25** Declarations
26****************************************************************************/
27
28/*******************************************************************************
29**
30** Function         NFC_TestLoopback
31**
32** Description      This function is called to send the given data packet
33**                  to NFCC for loopback test.
34**                  When loopback data is received from NFCC, tNFC_TEST_CBACK .
35**                  reports a NFC_LOOPBACK_TEVT.
36**
37** Parameters       p_data - the data packet
38**
39** Returns          tNFC_STATUS
40**
41*******************************************************************************/
42tNFC_STATUS NFC_TestLoopback(BT_HDR *p_data)
43{
44    tNFC_STATUS     status  = NFC_STATUS_FAILED;
45    tNFC_CONN_CB    *p_cb   = nfc_find_conn_cb_by_handle(NCI_TEST_ID);
46
47    if (p_data && p_cb && (p_data->offset >= (NCI_MSG_OFFSET_SIZE + NCI_DATA_HDR_SIZE)))
48    {
49        status = nfc_ncif_send_data (p_cb, p_data);
50    }
51
52    if(status != NFC_STATUS_OK)
53        GKI_freebuf (p_data);
54
55    return status;
56}
57
58
59
60
61#endif /* NFC_INCLUDED == TRUE */
62