What’s the relationship between NFC and Bluetooth?

NFC and Bluetooth are data communication technologies with very different characteristics.NFC works through devices proximity of up to 20 cm, using a low data transfer rate, which in the Windows Phone is used only for reading NDEF tags and exchanging connection data. On the other hand, Bluetooth covers a larger area, around 10 meters, having a higher data transfer rate, around 2.1 Mbit/s – depending on Bluetooth profile, being used in the mobile context for files exchange.

In the Windows Phone, NFC facilitates the task of establishing a connection, whether it's a Bluetooth or Infrastructure Wi-Fi connection. Proximity communication API enables the connection through the event PeerFinder. TriggeredConnectionStateChanged, which watches state changes, evidencing when the connection is established, that is, when the state TriggeredConnectState. Completed is achieved. The socket representing the connection established is stored in args.Socket. Thus, the use of Proximity provides an abstraction of the type of connection established, which would allow in the future for the same code to deal with the connections via Wi-Fi Direct. Following, an extract of the code for identification of the connection state changes:


StreamSocket _streamSocket;

void OnTriggeredConnectionStateChanged(object sender, TriggeredConnectionStateChangedEventArgs args)
{

switch (args.State)
{

case TriggeredConnectState.Listening:
// Conectando como ouvinte

break;

case TriggeredConnectState.PeerFound:
// Identificação de proximidade foi realizada, restando iniciar o processo de estabelever a conexão utilizando um dos canais de comunicação disponíveis, como TCP/IP ou Bluetooth

break;

case TriggeredConnectState.Connecting:
// Conectando como cliente

break;

case TriggeredConnectState.Completed:
// Conexão completa, obtém socket responsável pelo envio de dados

_streamSocket = args.Socket;

break;

case TriggeredConnectState.Canceled:
break;

case TriggeredConnectState.Failed:
// Connection was unsuccessful
break;

}
}

Therefore, NFC is a trigger of possibilities for the development of connected applications, and Bluetooth is the communication channel supported in Windows Phone 8.0.

Last edited Aug 6, 2014 at 9:28 PM by brmontei, version 4