nfc_ee.c revision e29968cf3e053557a9c2efc5a7a42d0767c51d9d
1/*****************************************************************************
2**
3**  Name:          nfc_ee.c
4**
5**  Description:   This file contains functions that interface with the NFCEEs.
6**
7**  Copyright (c) 2010-2012, Broadcom Corp., All Rights Reserved.
8**  Broadcom Bluetooth Core. Proprietary and confidential.
9**
10******************************************************************************/
11#include <string.h>
12#include "gki.h"
13#include "nfc_target.h"
14#include "bt_types.h"
15
16#if (NFC_INCLUDED == TRUE)
17#include "nfc_api.h"
18#include "nfc_int.h"
19#include "nci_int.h"
20#include "nci_hmsgs.h"
21
22
23/*******************************************************************************
24**
25** Function         NFC_NfceeDiscover
26**
27** Description      This function is called to enable or disable NFCEE Discovery.
28**                  The response from NFCC is reported by tNFC_RESPONSE_CBACK
29**                  as NFC_NFCEE_DISCOVER_REVT.
30**                  The notification from NFCC is reported by tNFC_RESPONSE_CBACK
31**                  as NFC_NFCEE_INFO_REVT.
32**
33** Parameters       discover - 1 to enable discover, 0 to disable.
34**
35** Returns          tNFC_STATUS
36**
37*******************************************************************************/
38tNFC_STATUS NFC_NfceeDiscover (BOOLEAN discover)
39{
40    return nci_snd_nfcee_discover ((UINT8)(discover ? NCI_DISCOVER_ACTION_ENABLE : NCI_DISCOVER_ACTION_DISABLE));
41}
42
43/*******************************************************************************
44**
45** Function         NFC_NfceeModeSet
46**
47** Description      This function is called to activate or de-activate an NFCEE
48**                  connected to the NFCC.
49**                  The response from NFCC is reported by tNFC_RESPONSE_CBACK
50**                  as NFC_NFCEE_MODE_SET_REVT.
51**
52** Parameters       nfcee_id - the NFCEE to activate or de-activate.
53**                  mode - NFC_MODE_ACTIVATE to activate NFCEE,
54**                         NFC_MODE_DEACTIVATE to de-activate.
55**
56** Returns          tNFC_STATUS
57**
58*******************************************************************************/
59tNFC_STATUS NFC_NfceeModeSet (UINT8              nfcee_id,
60                              tNFC_NFCEE_MODE    mode)
61{
62    if (mode >= NCI_NUM_NFCEE_MODE)
63    {
64        NFC_TRACE_ERROR1 ( "NFC_NfceeModeSet bad mode:%d", mode);
65        return NFC_STATUS_FAILED;
66    }
67
68    return nci_snd_nfcee_mode_set (nfcee_id, mode);
69}
70
71
72
73
74/*******************************************************************************
75**
76** Function         NFC_SetRouting
77**
78** Description      This function is called to configure the CE routing table.
79**                  The response from NFCC is reported by tNFC_RESPONSE_CBACK
80**                  as NFC_SET_ROUTING_REVT.
81**
82** Parameters
83**
84** Returns          tNFC_STATUS
85**
86*******************************************************************************/
87tNFC_STATUS NFC_SetRouting(BOOLEAN     more,
88                             UINT8       nfcee_id,
89                             UINT8       num_tlv,
90                             UINT8       tlv_size,
91                             UINT8      *p_param_tlvs)
92{
93    return nci_snd_set_routing_cmd (more, nfcee_id, num_tlv, tlv_size, p_param_tlvs);
94}
95
96/*******************************************************************************
97**
98** Function         NFC_GetRouting
99**
100** Description      This function is called to retrieve the CE routing table from
101**                  NFCC. The response from NFCC is reported by tNFC_RESPONSE_CBACK
102**                  as NFC_GET_ROUTING_REVT.
103**
104** Returns          tNFC_STATUS
105**
106*******************************************************************************/
107tNFC_STATUS NFC_GetRouting(void)
108{
109    return nci_snd_get_routing_cmd ();
110}
111
112
113#endif /* NFC_INCLUDED == TRUE */
114